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

Shridhar Daithankar <shridhar@frodo.hserus.net>

From: Shridhar Daithankar <shridhar@frodo.hserus.net>
To: Michael Meskes <meskes@postgresql.org>
Cc: Zeugswetter Andreas SB SD <ZeugswetterA@spardat.at>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2004-02-27T15:29:10Z
Lists: pgsql-hackers
On Friday 27 February 2004 20:54, Michael Meskes wrote:
> On Fri, Feb 27, 2004 at 04:22:33PM +0530, Shridhar Daithankar wrote:
> > How about, allowing 'connection *'? If somebody puts a 'connection *'
> > there it is used. If it is a string a name search is performed. Best of
> > both worlds.
>
> How shall anyone put a pointer to a connection struct inside the SQL
> statement?
>
> It would help me a lot if you'd be able to give some examples.

EXEC SQL BEGIN DECLARE SECTION;
 connect *connectionPtr;
EXEC SQL END DECLARE SECTION;

EXEC SQL CONNECT TO db AS connectionPtr;
EXEC SQL AT connectionPtr SELECT 1;

After all, it is matter of parsing some code and emitting equivalent C code, 
isn't it?

 Shridhar