SQLite create file and remember all operations during a single session , if
I try to reopen file or reconnect to db used, it 'll be empty.
Does anyone know why ? Version is 0.5.0 of PySqlite and the test is this:

import sqlite
cx = sqlite.connect("myDb")
cu = cx.cursor()
cu.execute( "create table myTry( id INTEGER, myText VARCHAR(255) )" )
cu.execute( "insert into myTry values( 1, 'try 1' )" )
cu.execute( "insert into myTry values( 2, 'try 2' )" )

cu.execute( "SELECT sql FROM sqlite_master WHERE type='table'" )
print cu.fetchone()
# ('create table myTry( id INTEGER, myText VARCHAR(255) )',)

cu.execute( "SELECT * from myTry" )
print cu.fetchone()
# (1, 'try 1')
print cu.fetchone()
# (2, 'try 2')



... then I try to reconnect ... with another file to the same database file
...

import sqlite
cx = sqlite.connect("myDb")
cu = cx.cursor()
cu.execute( "SELECT sql FROM sqlite_master WHERE type='table'" )
print cu.fetchone()
# None


The strange thing is tht it seems works fine before I used cx.close() for
another test ...

Reply via email to