Re: [sqlite] Commit and rollback behaviour during power loss

2017-11-24 Thread Rowan Worth
There is one degenerate case, which has been discussed a few times on this list. With PRAGMA journal_mode=DELETE (the default), the atomic signal that marks a transaction being committed is the deletion of the rollback journal. Deleting a file is a directory level operation, which means there are t

Re: [sqlite] Commit and rollback behaviour during power loss

2017-11-24 Thread Blagovest Buyukliev
> If Commit returns with SQLITE_OK, then YES, it is handed off to the disk > with some caveats, namely: > > A - We are assuming the Python sqlite3 wrapper you use doesn't do > obfuscation of any sort and directly calls the sqlite3 API and returns the > direct result from those calls. If you haven't

Re: [sqlite] Commit and rollback behaviour during power loss

2017-11-24 Thread R Smith
On 2017/11/24 10:47 AM, Blagovest Buyukliev wrote: Let's say we have the following Python code: import sqlite3 conn = sqlite3.connect('mydb.db') c = conn.cursor() c.execute("INSERT INTO ...") conn.commit() c.execute("INSERT INTO ...") conn.commit() Can it be assumed that after conn.commit() h

[sqlite] Commit and rollback behaviour during power loss

2017-11-24 Thread Blagovest Buyukliev
Let's say we have the following Python code: import sqlite3 conn = sqlite3.connect('mydb.db') c = conn.cursor() c.execute("INSERT INTO ...") conn.commit() c.execute("INSERT INTO ...") conn.commit() Can it be assumed that after conn.commit() has returned, fsync() has been called on the file and (a

Re: [sqlite] commit and rollback

2007-11-29 Thread John Stanton
You can use the SQLITE_BUSY returned by sqlite3_step to synchronize. Just pause and resubmit the call when you get it. arbalest06 wrote: about this synchronization of multiple writers, can you please explain on how to make this possible? or your just saying that i need to make a daemon that wil

Re: [sqlite] commit and rollback

2007-11-28 Thread arbalest06
about this synchronization of multiple writers, can you please explain on how to make this possible? or your just saying that i need to make a daemon that will eventually synchronize the writers? John Stanton-3 wrote: > > Multiple writers merely have to be synchronized. > > arbalest06 wrote:

Re: [sqlite] commit and rollback

2007-11-28 Thread John Stanton
Multiple writers merely have to be synchronized. arbalest06 wrote: so there is really no way that multiple processes can write into the database?..but multiple processes can read at the same time right?.. Igor Tandetnik wrote: arbalest06 <[EMAIL PROTECTED]> wrote: q#1: is it possible that mu

Re: [sqlite] commit and rollback

2007-11-28 Thread Trevor Talbot
On 11/28/07, arbalest06 <[EMAIL PROTECTED]> wrote: > ok..thanx for that..now if process A is writing into the database, and > process B attempts to write, does sqlite take note of B's attempt and gives > the permission to B when A is done? like would it be a queue that the first > process that att

RE: [sqlite] commit and rollback

2007-11-28 Thread arbalest06
ok..thanx for that..now if process A is writing into the database, and process B attempts to write, does sqlite take note of B's attempt and gives the permission to B when A is done? like would it be a queue that the first process that attempted to write should be given priority to write? or is it

RE: [sqlite] commit and rollback

2007-11-28 Thread Sreedhar.a
>so there is really no way that multiple processes can write into the database?..but multiple processes can read at the >>same time right?.. --Yes -Sreedhar Igor Tandetnik wrote: > > arbalest06 <[EMAIL PROTECTED]> wrote: >> q#1: is it possible that multiple users can write into the database >

Re: [sqlite] commit and rollback

2007-11-28 Thread arbalest06
so there is really no way that multiple processes can write into the database?..but multiple processes can read at the same time right?.. Igor Tandetnik wrote: > > arbalest06 <[EMAIL PROTECTED]> wrote: >> q#1: is it possible that multiple users can write into the database >> at the same time? >

Re: [sqlite] commit and rollback

2007-11-28 Thread arbalest06
good day! thanx guys for helping me out..i got it working already..i just misunderstood your solutions, that's why it took me a while to get it right.. =^D now i have another question, still related to this topic, but more on theoretical.. q#1: is it possible that multiple users can write into

Re: [sqlite] commit and rollback

2007-11-26 Thread John Stanton
Why not just test the status returned by sqlite3_step? Use sqlite3_prepare_v2 to make the returned status give more information. When you get an error just finalize your COMMIT statement and move your pointer from the prepared COMMIT statement to a ROLLBACK and shortcut the transaction. Inst

Re: [sqlite] commit and rollback

2007-11-26 Thread Trevor Talbot
On 11/26/07, arbalest06 <[EMAIL PROTECTED]> wrote: > John Stanton-3 wrote: > > All you need to do is to test the returned status of your sqlite3_step > > calls and if you get an error launch an SQL statement "ROLLBACK" and > > bail out of the transaction. If there are no errors you complete your

Re: [sqlite] commit and rollback

2007-11-26 Thread arbalest06
good day! i think its really a good solution to this problem. However, im required to implement the c apis of sqlite..so i need to use the sqlite3_commit_hook and sqlite3_rollback_hook..im doing some prototyping to see their functionalities but i really cant make it work..and i also cant find som

Re: [sqlite] commit and rollback

2007-11-14 Thread John Stanton
All you need to do is to test the returned status of your sqlite3_step calls and if you get an error launch an SQL statement "ROLLBACK" and bail out of the transaction. If there are no errors you complete your transaction with an SQL "COMMIT". sqlite_prepare_v2 SQL statements exec BEGI

[sqlite] commit and rollback

2007-11-14 Thread d_maniger06
good day!.. i have a list of records that i want to insert in my database..if ever an error occurred ( e.g. insert was not successful ), i want to undo all the previous inserts that i have done..to do this, i have read that i would need to use sqlite3_commit_hook and sqlite3_rollback_hook..i have

Re: [sqlite] Commit and Rollback

2005-07-28 Thread Will Leshner
On Jul 28, 2005, at 4:29 AM, Edwin Knoppert wrote: And i wish for a test if the transaction is already set or not, without using a callback. You already can: " int sqlite3_get_autocommit(sqlite3*); Test to see whether or not the database connection is in autocommit mode. Return TRUE i

Re: [sqlite] Commit and Rollback

2005-07-28 Thread Edwin Knoppert
And i wish for a test if the transaction is already set or not, without using a callback. Even better, nested tranactions would be the best. :) - Original Message - From: "Marco Bambini" <[EMAIL PROTECTED]> To: Sent: Thursday, July 28, 2005 9:24 AM Subject: [sq

[sqlite] Commit and Rollback

2005-07-28 Thread Marco Bambini
I need to know when a commit or a rollback is executed, I know that I can use the sqlite_commit_hook routine to be notified of a commit command, but what about rollback? Is there a way to know (or to be notified) when a rollback happens? Thanks a lot for your help, Marco Bambini