What steps will reproduce the problem?
import pyodbc
conn = pyodbc.connect(r'Driver=Firebird/InterBase(r)
driver;Database=...;Uid=...;Pwd=...;Charset=UTF8')
curs = conn.cursor()
# curs.execute("CREATE TABLE theTable ( theBlob BLOB );")
curs.execute("INSERT INTO theTable (theBlob) VALUES(?)", ('hello world',))
curs.execute("SELECT * FROM theTable")
s = curs.fetchall()[0][0]
assert str(s) == 'hello world', repr(s)
What is the expected output? What do you see instead?
Expected output is no output, the assert succeeding - alternatively a TypeError
on the insert, indicating that a str value is the wrong type for a BLOB field,
if that is the case. (Considering that the workaround below using buffer()
works so well, I'd consider raising TypeError a valid fix.)
Instead, the assert fails:
AssertionError: bytearray(b'\x0e\x00\x00\x00\x00')
What version of the product are you using? On what operating system?
3.0.6, Python 2.7, WinXP
Please provide any additional information below.
The insert works if instead of a str s, you insert buffer(s):
curs.execute("INSERT INTO theTable (theBlob) VALUES(?)", (buffer('hello
world'),))
Selecting this back produces the expected bytearray(b'hello world').
Original issue reported on code.google.com by and...@jmunch.dk on 3 Dec 2012 at 2:32
Original issue reported on code.google.com by
and...@jmunch.dk
on 3 Dec 2012 at 2:32