Re: LOCK TABLE HELP

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: luca(dot)ciciriello(at)email(dot)it, pgsql-general(at)postgresql(dot)org
Subject: Re: LOCK TABLE HELP
Date: 2008-03-14 15:39:41
Message-ID: 20080314153941.GI4843@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> luca(dot)ciciriello(at)email(dot)it wrote:

> My action are:
>
> void *Execute(void *pParam)
> {
> ........................................
> ........................................
>
> & nbsp; string tableLock = "BEGIN WORK;";
> tableLock.append(" LOCK TABLE ");
> tableLock.append(actorTable);
> tableLock.append(" IN ACCESS EXCLUSIVE MODE;");
> res = PQexec(connection, tableLock.c_str());

> Well, all this doesn't work (the connection is th e always the same in
> all methods and functions). Have I to Lock the table, perform some
> operation on this table, and unlock the table all in the same function
> scope?

What do you mean it doesn't work? How exactly it fails?

If anything, I'd suggest to send the LOCK TABLE in a separate PQexec()
call from BEGIN WORK.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2008-03-14 15:39:55 Re: postgre vs MySQL
Previous Message Richard Huxton 2008-03-14 15:37:47 Re: LOCK TABLE HELP