Я использую следующий код:
Код: Выделить всё
image = open(fileName, 'rb').read() # open binary file in read mode
#image = base64.b64encode(image)
#image_read = image.read()
conn, cursor = Functions.openDB(self, dbname='books')
mime = 'image/jpeg'
query = "UPDATE `cover` SET `datafile` = '%s', WHERE idx = %s " % (image, idx )
try:
cursor.execute(query)
conn.commit()
except Error as e:
Functions.handle_error(self, message=e)
self.container.close()
Код: Выделить всё
Syntax error: near 'xffxd8xffxe0x00x10JFIFx00x01x01x01x00'x00'x00x00xffxdbx00Cx00' at line 1
Я поискал в сети, и все, что я нашел, это примерно приведенный выше код
Подробнее здесь: https://stackoverflow.com/questions/791 ... nto-a-blob