[PD-dev] Fwd: Fwd: Fwd: Fwd: Connecting up an SQL Database to PD
jamie at postlude.co.uk
jamie at postlude.co.uk
Tue Nov 13 20:47:25 CET 2007
Mike McGonagle wrote:
> After looking at you code for passing messages into the external,
> instead of on the creation args, I agree, this is a little more
> elegant of a design.
>
> That being said, I did notice a couple of things that might result is
> very subtle bugs.
>
> 1. Suppose we have a statement like this...
>
> sql select onset, pitch, velocity, 1, duration from myscore endsql
>
> Not having been able to compile your external, I am not quite certain,
> but I think in this case there would be 5 different messages sent to
> the external as follows:
>
> a. sql select onset
> b. pitch
> c. velocity
> d. 1
> e. duration from myscore endsql
>
You are correct in that 5 separate messages are sent to the external.
However, the variable x->sqlStringStore is used to accumulate the query if
it is split between several Pd messages. psql_anything() also takes care
of adding the string ", " to sqlStringStore to compensate for the missing
commas. It can do this because data stored in the object struct persists
between method calls. The object stops accumulating the string, sends the
query to the database and clears the sqlStringStore array when a message
with the symbolic selector 'sqlend' is received.
Jamie
More information about the Pd-dev
mailing list