MySQL Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'b'\xff\。。。。。。
以上提醒的其實是語法錯誤,平時我用的插入數據的格式是:
cursor.execute("insert into initlogin(userId,deviceId,pictureFeature,userPass) value('%s','%s','%s','%s')" % ('1031','110','1250146201456','000000'))
但是如果有個字段是blob格式時,使用上述格式是會出現開頭我說的錯誤的,
當有字段是blob,二進制數據插入時,使用以下格式的語句就不會有錯誤了:
cursor.execute('insert into persons_to_updated(ZJ,operationType,facePicture,operationTime) value(%s,%s,%s,%s)',(['1040','new_ad',MySQLdb.Binary(img),dt]))