On 24 Dec 2014, at 10:50am, Jim Carroll <j...@carroll.com> wrote:

> I understand that performing a SELECT and nested COMMIT on the same table is
> not supported in sqlite, but I would have expected a COMMIT on a separate
> table would not be a problem.  Some test code in python however reveals that
> performing the COMMIT disrupts the SELECT statement, and causes duplicate
> data to be returned.
> 
> 
> 
> If this is not a supported operation, would you mind pointing me to the docs
> so I can understand it better?

All operations on a SQL database, whether read or write, must be performed 
inside a transaction.  So theoretically if you performed a SELECT without 
having done a BEGIN first, SQLite could return an error.  However, continually 
having to write BEGIN and END makes your code look messy so instead the 
programmers of SQLite have been kind to you.  If SQLite notices you issuing a 
command and you haven't already started a transaction it automatically wraps 
your command in BEGIN and COMMIT.  If either the BEGIN or COMMIT fail, the 
error result is returned as if it was an error from your command.

However, I do not see why this, or anything else I know about SQLite, would 
lead to this in your output:

> (0,)
> 
> (1,)
> 
> (0,)
> 
> (1,)
> 
> (2,)

I am mystified,

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

Reply via email to