Re: [sqlite] SELECT ... FOR UPDATE

2016-05-24 Thread Hick Gunter
SQLite does not use row level locking, only file level locking. You can use 
BEGIN IMMEDIATE to exclude writers or BEGIN EXCLUSIVE to exclude readers and 
writers. If you do not explicitly start a transaction, each statement 
constitutes it's own transaction.

-Ursprüngliche Nachricht-
Von: sqlite-users-boun...@mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Scott 
Doctor
Gesendet: Dienstag, 24. Mai 2016 19:34
An: sqlite-users@mailinglists.sqlite.org
Betreff: [sqlite] SELECT ... FOR UPDATE

My current project has me bouncing between sqlite and mysql. In mysql, to lock 
a row of data at the start of a process to hold off concurrent operations, the 
recommended technique with the innodb engine is to issue

SELECT field FROM table FOR UPDATE;

This holds off any other process from accessing that row until it is released. 
This is according to the mysql manual.

My question is, looking through the sqlite documentation, it is not clear how 
sqlite will handle that statement. Since I am porting sql between several 
databases, I am trying to figure out if I need to search and destroy any of 
those statements from mysql when converting it to sqlite.


Scott Doctor
sc...@scottdoctor.com
--

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SELECT ... FOR UPDATE

2016-05-24 Thread Simon Slavin

On 24 May 2016, at 8:04pm, Igor Tandetnik  wrote:

> SQLite will report a syntax error. That's pretty easy to confirm 
> experimentally.

Download the command line shell tool as a "precompiled binary" for your 
platform:



and test commands to your heart's content:



Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SELECT ... FOR UPDATE

2016-05-24 Thread Igor Tandetnik

On 5/24/2016 1:34 PM, Scott Doctor wrote:

SELECT field FROM table FOR UPDATE;

My question is, looking through the sqlite documentation, it is not
clear how sqlite will handle that statement.


SQLite will report a syntax error. That's pretty easy to confirm 
experimentally.

--
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SELECT ... FOR UPDATE

2016-05-24 Thread Scott Doctor
My current project has me bouncing between sqlite and mysql. In 
mysql, to lock a row of data at the start of a process to hold 
off concurrent operations, the recommended technique with the 
innodb engine is to issue


SELECT field FROM table FOR UPDATE;

This holds off any other process from accessing that row until 
it is released. This is according to the mysql manual.


My question is, looking through the sqlite documentation, it is 
not clear how sqlite will handle that statement. Since I am 
porting sql between several databases, I am trying to figure out 
if I need to search and destroy any of those statements from 
mysql when converting it to sqlite.



Scott Doctor
sc...@scottdoctor.com
--

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SELECT FOR UPDATE

2006-11-16 Thread Jay Sprenkle

Hi,

We are newbie to SQLite and we would like to lock a table through a select +
update.

Something like that:

BEGIN TRANSACTION

   currentValue = select currentValue from sequence_transactions;

   update sequence_transactions set currentValue = currentValue + 1;

   COMMIT;

END TRANSACTION

When the program reachs the select, we would like other threads /
applications wait for that transaction to finish.

Is there any way of achiving that?



Read through the documentation on locking. It should do what you want
and explain
it so you can understand it. I think what you already have written will probably
work fine, but as always, the difficulty is in the details.

http://sqlite.org/lockingv3.html



--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] SELECT FOR UPDATE

2006-11-16 Thread jfbaro

Hi,

We are newbie to SQLite and we would like to lock a table through a select +
update.

Something like that:

BEGIN TRANSACTION

   currentValue = select currentValue from sequence_transactions;   

   update sequence_transactions set currentValue = currentValue + 1;

   COMMIT;

END TRANSACTION

When the program reachs the select, we would like other threads /
applications wait for that transaction to finish.

Is there any way of achiving that?

Cheers


-- 
View this message in context: 
http://www.nabble.com/SELECT-FOR-UPDATE-tf2645383.html#a7384913
Sent from the SQLite mailing list archive at Nabble.com.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-