Re: Thread safe connection-name mapping in ECPG. Is it

Michael Meskes <meskes@postgresql.org>

From: Michael Meskes <meskes@postgresql.org>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Lee Kindness <lkindness@csl.co.uk>, shridhar@frodo.hserus.net, Michael Meskes <meskes@postgresql.org>, Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2004-03-07T14:46:52Z
Lists: pgsql-hackers
On Wed, Mar 03, 2004 at 08:47:50AM -0500, Bruce Momjian wrote:
> > 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.

Why? What doesn't work? AFAIRC the AT statement does indeed allow a
variable as connection_target.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!