From: Oleg B. <ph...@ph...> - 2005-06-14 11:27:56
|
Hello! On Fri, May 27, 2005 at 04:03:53PM -0400, Kevin Dangoor wrote: > Attached is the svn diff for my pysqlite2 changes. Well, I just committed my current work on it - revision 815. I have ran a lot of tests with SQLite 3.2.1 and Postgres 7.2, and the status is: Python 2.2 AND (pysqlite1 OR psycopg): Most tests passed; some failed due to the very py.test (re)introduced incompatibility with Python 2.2. Python 2.3 AND (pysqlite1 OR psycopg): Most tests passed; some failed due to known problems in Pg 7.2. Python 2.4 AND (pysqlite2 OR psycopg): Most tests passed; some failed due to known problems in Pg 7.2. Some tests failed due to problems with PySQLite2. test_basic.py and test_delete.py failed with error "OperationalError: database table is locked". test_validation.py failed with the error def confirmSubclass(self, value, state): if not isinstance(value, self.subclass): raise InvalidField(self.message('subclass', "%(object)s is not a subclass of %(subclass)s") % {'object': repr(value), 'subclass': self.subclass}, E value, state) > InvalidField: u'y' is not a subclass of <type 'str'>. Value: u'y' It seems PySQLite2 had converted the default value to unicode. test_unicode.py failed with UnicodeDecodeError and I don't know how I can fix it. The following program #! /usr/local/bin/python -O # -*- coding: koi8-r -*- from pysqlite2 import dbapi2 as sqlite con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table person (id integer primary key, name varchar)") cur.execute("insert into person values (1, 'Олег')") # this is my name 'Oleg' in koi8-r cur.execute("select * from person") print cur.fetchall() fails: cur.execute("select * from person") UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-2: invalid data There must be a way to set encoding for cur.execute("insert into person ... but I don't know what it is. Any idea? Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |