Re: difference between statements

Martin Jenkins <mj-Vfh7fEhEWOlaa/[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Organization XQP Ltd
Message-ID <[email protected]>
Dennis Lee Bieber wrote:
> On Wed, 28 Mar 2007 14:32:26 +0100, Martin Jenkins
> <mj-Vfh7fEhEWOlaa/[email protected]> declaimed the following in
> gmane.comp.python.db.pysqlite.user:
> 
>> [email protected] wrote:
>>> I very rarely work directly in sqlite, but Deletes and Inserts have to
>>> have a con.commit() after them.
>> That's not strictly true - unless you turn it off pysqlite will start 
>> transactions behind the scenes for you. have a look at the docs for 
>> "isolation_level".
>>
> 	It will /start them/, but not /end them/. To be compliant with the
> dbapi-2 specs, the module is NOT supposed to default to "auto-commit"
> mode, whereas the command line sqlite tool does run in auto-commit.

Hmmm.

PythonWin 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
(Intel)] on win32.
Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' 
for further copyright information.

 >>> import sqlite3
 >>> C1=sqlite3.Connection("c:/tmp/db1")
 >>> C2=sqlite3.Connection("c:/tmp/db1")
 >>>
 >>> c1=C1.cursor()
 >>> c2=C2.cursor()
 >>>
 >>> c2.execute("select * from sqlite_master").fetchall()
[]
 >>> c1.execute("create table t1(a,b,c)")
<sqlite3.Cursor object at 0x00D91020>
 >>>
 >>> c2.execute("select * from sqlite_master").fetchall()
[(u'table', u't1', u't1', 2, u'CREATE TABLE t1(a,b,c)')]
 >>>
 >>> C1.close()
 >>>
 >>> c2.execute("select * from sqlite_master").fetchall()
[(u'table', u't1', u't1', 2, u'CREATE TABLE t1(a,b,c)')]
 >>>
 >>> C2.close()
 >>>
 >>> C2=sqlite3.Connection("c:/tmp/db1")
 >>> c2=C2.cursor()
 >>> c2.execute("select * from sqlite_master").fetchall()
[(u'table', u't1', u't1', 2, u'CREATE TABLE t1(a,b,c)')]
 >>>

Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.