Using libpq in a multithreaded environment

From: Rini Dutta <rinid(at)rocketmail(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Using libpq in a multithreaded environment
Date: 2000-02-25 16:47:31
Message-ID: 20000225164731.18954.qmail@web2903.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

Hi,
I need to use libpq in a multithreaded environment.
Ideally I would like to open a single connection to
the database and use that for all threads.
I just discovered that the PGconn returned when a
connection is opened is usable for only one thread
since it also seems to store the result (PGresult *)
and the errorMessage. Could you tell me if there is a
way to use one connection in multiple threads, or
whether I will need to necessarily open one Connection
per thread ? Which is the preferred course of action ?

Thanks,
Rini

ps : Sorry, but I've been unable to search the
archives before sending this mail. For the last three
days each time I try a search I get the folllowing
message :

The document contained no data. Try again later or
contact the server's administrator.
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-02-25 16:54:40 Re: [SQL] how to create index on timestamp field in pre v7 database
Previous Message Tom Lane 2000-02-25 16:36:23 Re: missing function datetime()

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2000-02-25 18:19:34 Re: [HACKERS] Using libpq in a multithreaded environment
Previous Message Tom Lane 2000-02-25 04:48:29 Re: [INTERFACES] arrays of varchar and "