Re: LOCK TABLE HELP

Поиск
Список
Период
Сортировка
От luca.ciciriello@email.it
Тема Re: LOCK TABLE HELP
Дата
Msg-id cbb469eb01d4190428c680bc639a1289@85.18.140.153
обсуждение исходный текст
Ответ на LOCK TABLE HELP  (luca.ciciriello@email.it)
Ответы Re: LOCK TABLE HELP  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Sorry for the bad text format. Below the right (I hope...)  text:

Hi All.

I'm using for the first time the postgres lock utilities, but brobably I'm doing something of not legal.

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());

       ........................................
       ........................................

        pObj->ReturnNotification(static_cast<string>(notify->relname),connection);

         .........................................
         .........................................

          CleanUpBeforeStop(void *pParam);
}

void CleanUpBeforeStop(void *pParam)
{
          .........................................
          .........................................
          res = PQexec(pPti->conn, "COMMIT WORK;");
}

Well, the function Execute is the detached procedure of a thread. In here I execute the LOCK command on the table "actorTable". Then, in the method ReturnNotification I read the locked table. At last, calling the function CleanUpBeforeStop, I execute the COMMIT command.

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? 

Any Idea?

Thanks in advance.

Luca



--------- Original Message --------
Da: "Richard Huxton" <dev@archonet.com>
To:
Cc: pgsql-general@postgresql.org
Oggetto: Re: [GENERAL] LOCK TABLE HELP
Data: 14/03/08 16:35



luca.ciciriello@email.it wrote:
> Hi All.
>
> I&#39;m using for the first time the postgres lock utilities, but brobably
> I&#39;m doing something of not legal.My action are:void *Execute(void
> *pParam){ ..................................... ... ........................................&nbsp;&nbsp;
> &nbsp; &nbsp; &nbsp;string tableLock = &quot;BEGIN
> WORK;&quot;;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;tableLock.append(&quot;
> LOCK TABLE &quot;);&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;

Could you repost your message without all the &nbsp stuff? There's
probably a "plain text" option in your email package you need to turn on.


--
Richard Huxton
Archonet Ltd

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

----
Email.it, the professional e-mail, gratis per te: clicca qui

Sponsor:
Scopri le tue passioni con Leonardo.it!
Clicca qui

В списке pgsql-general по дате отправления:

Предыдущее
От: paul rivers
Дата:
Сообщение: Re: postgre vs MySQL
Следующее
От: Micah Yoder
Дата:
Сообщение: Re: PG secure for financial applications ...