Concurrent Access

F

FeelLikeANut

When you need to update a value in a file, it's pretty simple: lock
exclusively, read the value, manipulate it, write it, and release the
lock. I'm not sure how this world work with an SQL database, however.
I can use the select statement to read the value and the update
statement to write the value, but how do I make sure that the value
isn't tampered with between those two statements?
 
X

xhoster

When you need to update a value in a file, it's pretty simple: lock
exclusively, read the value, manipulate it, write it, and release the
lock. I'm not sure how this world work with an SQL database, however.
I can use the select statement to read the value and the update
statement to write the value, but how do I make sure that the value
isn't tampered with between those two statements?

That depends on what database engine you use.

Also, it has nearly nothing to do with Perl.

Xho
 
C

Charlton Wilbur

FLAN> I can use the select statement to read the value and the
FLAN> update statement to write the value, but how do I make sure
FLAN> that the value isn't tampered with between those two
FLAN> statements?

This has more to do with databases than with Perl, and in particular
with your choice of databases; but the answer is generally either
transactions, table locking, or sensible database schema design.

Charlton
 
C

Ch Lamprecht

When you need to update a value in a file, it's pretty simple: lock
exclusively, read the value, manipulate it, write it, and release the
lock. I'm not sure how this world work with an SQL database, however.
I can use the select statement to read the value and the update
statement to write the value, but how do I make sure that the value
isn't tampered with between those two statements?
Search your database docs:

SELECT ..... FOR UPDATE

does a row level lock for the current transaction e.g. in Postgresql, but I
think it's standard SQL.

Christoph
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top