Skip site navigation (1) Skip section navigation (2)

LOCKing method in my situation?

From: Alexander Popkov <voodoo(at)wenet(dot)ru>
To: pgsql-php(at)postgresql(dot)org
Subject: LOCKing method in my situation?
Date: 2004-02-01 12:39:01
Message-ID: 62364058618.20040201153901@wenet.ru (view raw or flat)
Thread:
Lists: pgsql-php
Hello PostgreSQL gurus!

I am have question to you.

I am have table 'chall_item' in my database.
In many PHP scripts i am do 'SELECT * FROM chall_item....', but
in one script (join.php) i do
  a) SELECT COUNT(*) FROM chall_item WHERE chall_no = XXX;
  b) if returned number less then 10, then i do INSERT INTO chall_item (chall_no, ...) VALUES (XXX, ...);

But if beetwen a) and b) other instance of 'join.php' do part "a)" - then odd row are added ;(

I can do LOCK TABLE chall_item IN ACCESS EXCLUSIVE MODE,
but IMHO this is not true method in this situation, because i need lock only for 'join.php'
not for all scripts. Help me plz. Which other methods are exist in this situation.  

-- 
Best regards,
 Alexander                          mailto:voodoo(at)wenet(dot)ru


Responses

pgsql-php by date

Next:From: Hans-Jürgen SchönigDate: 2004-02-01 15:41:56
Subject: Re: LOCKing method in my situation?
Previous:From: Robby RussellDate: 2004-01-30 16:42:15
Subject: Re: Triggers, Rules and email

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group