Re: Ecpg and reentrancy

From: "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at>
To: "Michael Meskes" <meskes(at)postgresql(dot)org>, "Dann Corbit" <DCorbit(at)connx(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Ecpg and reentrancy
Date: 2002-02-05 15:00:01
Message-ID: 46C15C39FEB2C44BA555E356FBCD6FA41EB4D6@m0114.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-02-05 15:29:25 Re: v7.2 rolled last night ...
Previous Message Alessio Bragadini 2002-02-05 14:58:02 Re: v7.2 rolled last night ...