multiple statements.. and locking

Поиск
Список
Период
Сортировка
От Benjamin
Тема multiple statements.. and locking
Дата
Msg-id 406C2BFD.4080905@netyantra.com
обсуждение исходный текст
Ответы Re: multiple statements.. and locking  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hi there,

Novice I am, when it comes to PostGreSql.
Would like to be in the know.

At this point of time, I am stuck at one peculiar problem.
I read of a similar problem in the archives, not not quite wot i was
lookin for.

I have a C application. I have to modify a row in a table, n then
immediately access a field in that row.
These operation of modifying and accessing has to be atomic.So, i have
to lock the row.

So, for that, I have prepared a query, having

BEGIN; LOCK TABLE tablename in ROW EXCLUSIVE MODE; UPDATE tablename set
colname=value WHERE rowprimary='a' ; SELECT b from tablename WHERE
rowprimary='a'; COMMIT;

n  then doin a -  PGexec(connection, query); PQresultStatus(pgresult);

i am not sure, if i am doin the rite thing.
i read in one of the archive mails, abt using PQsendQuery.

how do i get the results back??wot structure will have the results??
is such locking and succesive accesing fields possible??

Some help regarding this would be greatly appreciated.

Thanx.

Hope to get into the developers list.. someday ;-)

cheerz

--

Benjamin Jacob.

Disclaimer :
------------------------------------------------------------------------------
If you are not the intended recipient of this transmission to whom it is
addressed, or have received this transmission in error, you are hereby
notified that any dissemination, distribution or copying of this transmission
is strictly prohibited. Please notify us immediately and delete this e-mail
from your system. The sender does not accept liability for any errors or
omissions in the contents of this message which arise as a result of e-mail
transmission, which cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete, arrive at wrong address or contain viruses. If verification
is required please request a hard-copy version.  This e-mail contains only the
personal opinions of the sender and does not represent an official
communication from NetYantra of any manner.
------------------------------------------------------------------------------



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

Предыдущее
От: "Manfred Koroschetz"
Дата:
Сообщение: Help for MSSQL "Compute" equivalent in Postgres
Следующее
От: "Paul Semenick"
Дата:
Сообщение: dotnet stored procedures with postgresql