problem with upgrade 1.1 -> 2.3

Niki Spahiev <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
Hello,

I can't find proper way of handling BLOB records saved with pysqlite 
1.1.7. When i read them with 2.3.2 i got garbage.

Attached test shows the problem.

Platform: win32/py2.4 binary pysqlite-1.1.7 and pysqlite-2.3.2

Niki Spahiev

_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite
_1.py (application/x-python, 813 B)
import os

test_data = 'data\0value\xff'

def v117():
    import sqlite as dbapi
    print dbapi._sqlite.sqlite_version(), dbapi.paramstyle

    os.remove('_1.db')
    dbc = dbapi.connect('_1.db')
    c = dbc.cursor()
    c.execute('create table T1 (v integer, s blob)')
    dbc.commit()
    c.execute('insert into T1 (v, s) values (%s,%s)', (1,dbapi.Binary(test_data)))
    dbc.commit()
    c.execute('select s from T1')
    r = c.fetchone()
    g = r[0]
    print repr(g), g

def v232():
    from pysqlite2 import dbapi2
    print dbapi2.sqlite_version, dbapi2.version

    dbc = dbapi2.connect('_1.db',
        detect_types=dbapi2.PARSE_DECLTYPES
        )
    dbc.text_factory = str
    c = dbc.cursor()
    c.execute('select s from T1')
    r = c.fetchone()
    g = r[0]
    print repr(g), g

v117()
v232()
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.