Re: Ecpg and reentrancy - Mailing list pgsql-hackers

From Zeugswetter Andreas SB SD
Subject Re: Ecpg and reentrancy
Date
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA41EB4D6@m0114.s-mxs.net
Whole thread Raw
In response to Ecpg and reentrancy  ("Dann Corbit" <DCorbit@connx.com>)
List pgsql-hackers
> > If (instead) we had a user supplied sqlca, it could be used by multiple
> > threads.
> 
> How do you want to supply it? 

Informix does this:

#else /* IFX_THREAD */
extern long * ifx_sqlcode();
extern struct sqlca_s * ifx_sqlca();
#define SQLCODE (*(ifx_sqlcode()))
#define SQLSTATE ((char *)(ifx_sqlstate()))
#define sqlca (*(ifx_sqlca()))
#endif /* IFX_THREAD */

They use one sqlca per active connection/thread. A connection is basically tied 
to a specific thread. If you want to use the conn in another thread you need 
to:
EXEC SQL SET CONNECTION DORMANT; EXEC SQL SET CONNECTION ...
When using the esql processor, you need to specify which thread package you use
(posix, dce, ...), so they know with which functioncall to get the current 
thread id. Of course this costs, so they have a switch to turn it on (-thread).

Andreas


pgsql-hackers by date:

Previous
From: Denis Perchine
Date:
Subject: Re: v7.2 rolled last night ...
Next
From: Peter Eisentraut
Date:
Subject: Re: v7.2 rolled last night ...