Ok, I was able to create a testcase for the bug I have.
It seems to definitely be pysqlite2/sqlite bug.

When I run the attached script, I get the following output:

       id      name
        1       string1
        2       None

instead of

       id      name
        1       string1
        2       string2

Does the same script work correctly for you ?

The output script is correct if I comment the line 27:
cursor.execute("CREATE TABLE table2 (id INTEGER PRIMARY KEY AUTOINCREMENT)")

Yann

#!/usr/bin/python2.4

import os
from pysqlite2 import dbapi2 as sqlite

CREATE_SCHEMA = """
    CREATE TABLE types (
        id              INTEGER PRIMARY KEY AUTOINCREMENT, 
        name            TEXT UNIQUE
    );
"""

dbfile = "dbfile.test"
try:
	os.unlink(dbfile)
except:
	pass

f = os.popen("sqlite3 %s" % dbfile, "w")
f.write(CREATE_SCHEMA)
f.close()

db = sqlite.connect(dbfile)
cursor = db.cursor()
cursor.execute("CREATE TABLE table1 (id INTEGER PRIMARY KEY AUTOINCREMENT)")
cursor.execute("INSERT OR REPLACE INTO types VALUES(?, ?)", (None, "string1"))
cursor.execute("CREATE TABLE table2 (id INTEGER PRIMARY KEY AUTOINCREMENT)")
cursor.execute("INSERT OR REPLACE INTO types VALUES(?, ?)", (None, "string2"))

cursor.execute("SELECT * from types")
rows = cursor.fetchall()

print "\tid\tname"

for id, name in rows:
	if name == None:
		name = "None"

	print "\t%s\t%s" % (id,name)


db.commit()
db.close()
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to