Einzelnen Beitrag anzeigen
Alt 16.12.2002, 10:04   #1
erdling
Senior Member
 
Registriert seit: 30.10.2001
Beiträge: 107


Standard binärdateien in BLOB-feld von SQL-datenbank speichern

hallo liste,

ich versuche bilder (JPG, GIF) in ein BLOB feld von mySQL zu speichern
das schaut (in python) so aus

file = open("c:\\bild.jpg")
picture = file.read()

sql = 'INSERT INTO tbl_blob (attrName, attrValue) VALUES ("nameOfPicture", ' + picture + ')'

conn = CompatMysqldb.Connection("host", "user", "passw", "db")
curs = conn.cursor()
curs.execute(sql)


alle varianten von einfachen und doppelten hochkommas führen zu einem error
1064 - you have an error in your SQL synthax near '' at line 1

__das ganze funktioniert aber mit textfiles__

weiß jemand wie man richtig 'binaries' übergibt ???


danke für alle tipps


fritz
(-:fs)
erdling ist offline   Mit Zitat antworten