On Friday 27 February 2004 22:24, Lee Kindness wrote:
> Sort of related, I was thinking about adding some more thread-related
> code such that if a connection wasn't explicitely specified then the
> last connection SET or CONNECTed to for the current thread is used,
> rather than just the "last connection".
> But yeah, specifying the connection by variable (be it string or
> connection ptr) would be a definite step forward. Currently you cannot
> write a generic function like:
> int getit(char *using_connection)
> EXEC SQL BEGIN DECLARE SECTION;
> char *s_connection = using_connection;
> int s_it;
> EXEC SQL END DECLARE SECTION;
> EXEC SQL AT :s_connection SELECT it INTO :s_it FROM some_table;
> return( s_it );
> which could be run concurrently by multiple threads.
Consider another scenario. In a C++ class you want to contain a database
connection. The class needs to make n resources thread safe, including
database connection. Now each instance of class would be referring to
differnet database connection with same code.
Doing same with char strings, is just clean enough IMHO..
In response to
pgsql-hackers by date
|Next:||From: Dennis Bjorklund||Date: 2004-02-28 11:14:29|
|Subject: cvs lock|
|Previous:||From: Tom Lane||Date: 2004-02-28 04:28:25|
|Subject: Re: Schema comparisons |