WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   binärdateien in BLOB-feld von SQL-datenbank speichern (http://www.wcm.at/forum/showthread.php?t=80712)

erdling 16.12.2002 10:04

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)


Alle Zeitangaben in WEZ +2. Es ist jetzt 01:16 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag