libpq and transactions

Поиск
Список
Период
Сортировка
Искать

libpq and transactions

От:
Alex du Plessis <alexdup01@telkomsa.net>
Дата:
Hi list,

I wish to use libpq to create a new database using a sql statement 
"CREATE DATABSE".  However, it seems this command cannot be enclosed 
within a transaction.  How do I go about executing such a statement via 
libpq i.e. which function should I use.  (Any information would be helpful)

Thanks

Alex

Re: libpq and transactions

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Alex du Plessis  writes:
> I wish to use libpq to create a new database using a sql statement 
> "CREATE DATABSE".  However, it seems this command cannot be enclosed 
> within a transaction.  How do I go about executing such a statement via 
> libpq i.e. which function should I use.  (Any information would be helpful)

Use PQexec(), same as any other SQL command.  The no-transaction
restriction just means you can't put it between BEGIN and COMMIT
commands.

			regards, tom lane

Re: libpq and transactions

От:
Alex du Plessis <alexdup01@telkomsa.net>
Дата:

Thanks Tom - I'll try that straightaway

Tom Lane wrote:
> Alex du Plessis  writes:
>> I wish to use libpq to create a new database using a sql statement 
>> "CREATE DATABSE".  However, it seems this command cannot be enclosed 
>> within a transaction.  How do I go about executing such a statement via 
>> libpq i.e. which function should I use.  (Any information would be helpful)
> 
> Use PQexec(), same as any other SQL command.  The no-transaction
> restriction just means you can't put it between BEGIN and COMMIT
> commands.
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
> 
> 
FAQ