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.
- 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