[DB-SIG] BLOBs
M.-A. Lemburg
mal@lemburg.com
Tue, 14 Aug 2001 21:59:27 +0200
Ryan Weisenberger wrote:
>
> I'm trying to insert and retrieve BLOBs from a SQL Server db using
> mxODBC. I'm assuming I need some function equivalent to addSlashes() to
> escape the binary stream before I insert it in the db. Does anyone know of
> an easy way to do this in Python? Is there such a function?
You normally don't need to do that as long as you pass the BLOB
as bound parameter:
cursor.execute('INSERT INTO ... VALUES (?,?)', (id, blob))
mxODBC will then pass the BLOB data to the ODBC driver and the
driver will apply any escaping which might be necessary (if at all).
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/