On Mon, 2007-12-10 at 16:43 -0500, Mathieu Bouchard wrote:
On Mon, 10 Dec 2007, Mike McGonagle wrote:
In one of the early prototypes I wrote for this, I set it up so that the connections were shared. Basically, when an object tried to open a connection, it would check if there was already one open, and if so, it would use that. Else it would create a new connection, which would then get stored in the global connection object.
I think that the first argument of [psql] could be a receive-symbol, followed by the query itself. Then [psql] would not use the receive-symbol to send messages to, it would look at the receiver directly, checking that it's a [psql.connection] object, and then calling a function of that object directly, and get called back when a response is received. This is quite close to how [tabread] works except it inserts a [delay] before the result. It's how [tabread] would work if it were trying to access an array on another computer.
I like this idea. What do you think about using an implicit receive-symbol, '$0-psql.1001', '$0-psql.1002' etc? Would it be possible for psql to automatically discover the psql.conn's receive symbol by using pd_findbyclass(), and then reading a variable in the object struct?
Jamie