From: PFC <lists@peufeu.com>
To: mario.splivalo@mobart.hr, "Achilleus Mantzios" <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: 'locking' the SELECTs based on indices...
Date: Thu, 23 Feb 2006 17:35:21 +0100
Message-ID: <op.s5fpo7sncigqcu@apollo13> (raw)
In-Reply-To: <1140692542.5002.26.camel@localhost.localdomain>
References: <Pine.LNX.4.44.0602231349430.15710-100000@matrix.gatewaynet.com>
<1140692542.5002.26.camel@localhost.localdomain>
> Now, If some other user want's his prize, when checking his code, if he
> sends code for some other service then service 1, that's ok. If he's
> sends code for the service 1 the PERFORM will wait untill I'm finished
> with previous user.
Sorry for the double post.
If the rows in your table represent associations between codes and
services that are one-use only, you could simply use UPDATE or DELETE, to
mark the row in question as having been "consumed".
Then, you check how many rows were deleted or updated. If it's 1, good.
If it's 0, the code has been used already.
If the code itself is one-use only, you should have a codes table and a
codes_to_services table, with an ON DELETE CASCADE so that, when you use a
code, you delete it from the codes table and it's "consumed" for all
services.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: lists@peufeu.com, achill@matrix.gatewaynet.com
Subject: Re: 'locking' the SELECTs based on indices...
In-Reply-To: <op.s5fpo7sncigqcu@apollo13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox