This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author flox
Recipients flox
Date 2010-01-17.13:45:50
SpamBayes Score 0.0014089169
Marked as misclassified No
Message-id <1263735953.04.0.426363629034.issue7723@psf.upfronthosting.co.za>
In-reply-to
Content
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'')
History
Date User Action Args
2010-01-17 13:45:53floxsetrecipients: + flox
2010-01-17 13:45:53floxsetmessageid: <1263735953.04.0.426363629034.issue7723@psf.upfronthosting.co.za>
2010-01-17 13:45:51floxlinkissue7723 messages
2010-01-17 13:45:51floxcreate