Package: python-apsw
Version: 3.3.13-r1-1

As the program below shows, ASCII values of type string which are
written into the database are converted to Unicode strings when
reading them back.  This doesn't really match what the documentation
says, so I believe this is a bug.  (I've got existing code which
relies heavily on non-Unicode strings, which worked before, but
perhaps it's better to update the documentation to reflect the new
behavior.)


import apsw

db = apsw.Connection(':memory:')
try:
    c = db.cursor()
    c.execute("CREATE TABLE t (a TEXT, b BLOB, c BINARY, d INTEGER)")
    def insert(x, i=0):
        c.execute("INSERT INTO t VALUES (?, ?, ?, ?)", (x, x, x, i))
    insert('a')
    insert(buffer('b'))
    insert(u'c')
    insert(0)
    insert('0', '0')
    insert('0.1', '0.1')
    for row in c.execute("SELECT * FROM t"):
        for x in row:
            print "%s (%s) " % (x, repr(type(x))),
        print
finally:
    db.close()


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to