Message97943
Since buffer() is deprecated in Python 2.7, it should not be used for BLOB input/output.
SAMPLES = (
('unicode', u''),
('bytes', ''),
('buffer', buffer('')),
# ('bytearray', bytearray('')), # unsupported
# ('memoryview', memoryview('')) # unsupported
)
import sqlite3
conn = sqlite3.connect(':memory:')
c = conn.cursor()
c.execute('create table test(s varchar, b blob)')
c.executemany('insert into test(s, b) values (?, ?)', SAMPLES)
c.execute('select s, b from test')
print('\n'.join(str(l) for l in c.fetchall()))
# Output:
# (u'unicode', u'')
# (u'bytes', u'')
# (u'buffer', <read-write buffer ptr 0x1d8ccd0, size 0 at 0x1d8cc80>)
#
# Errors and warnings:
# __main__:4: DeprecationWarning: buffer() not supported in 3.x
# sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type.
Here is the Python 3 input/output:
SAMPLES = ( # Python3
('unicode', ''),
('bytes', b''),
('bytearray', bytearray(b'')),
('memoryview', memoryview(b''))
)
# ('unicode', '')
# ('bytes', b'')
# ('bytearray', b'')
# ('memoryview', b'') |
|
Date |
User |
Action |
Args |
2010-01-17 13:45:53 | flox | set | recipients:
+ flox |
2010-01-17 13:45:53 | flox | set | messageid: <1263735953.04.0.426363629034.issue7723@psf.upfronthosting.co.za> |
2010-01-17 13:45:51 | flox | link | issue7723 messages |
2010-01-17 13:45:51 | flox | create | |
|