I having troubles inserting data into a blob with zmysqlda, it seems to get messed up with the escaping... I fiddled around a bit and put a "blob" type into the code in Shared/DA/ZRDB/sqlvar.py and it still seems to get some errors when trying to insert Gif's. Anyone else managed to get blobs to work nicely with the sql code?
The code I added was:
elif t == 'blob':
# Convert the data into a string.
v=str(v)
if find(v,"\\") >= 0: v = join(split(v,"\\"),"\\\\")
if find(v,"\x00") >= 0: v = join(split(v,"\x00"),"\\0")
if find(v,"\032") >= 0: v = join(split(v,"\032"),"\\z")
if find(v,"'") >= 0: v = join(split(v,"'"),"\\'")
if find(v,"\"") >= 0: v = join(split(v,"\""),"\\\"")
if find(v,"\n") >= 0: v = join(split(v,"\n"),"\\n")
if find(v,"\r") >= 0: v = join(split(v,"\r"),"\\r")
v = "'" + v + "'"
Thanks!
David.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Morning,
I having troubles inserting data into a blob with zmysqlda, it seems to get messed up with the escaping... I fiddled around a bit and put a "blob" type into the code in Shared/DA/ZRDB/sqlvar.py and it still seems to get some errors when trying to insert Gif's. Anyone else managed to get blobs to work nicely with the sql code?
The code I added was:
elif t == 'blob':
# Convert the data into a string.
v=str(v)
if find(v,"\\") >= 0: v = join(split(v,"\\"),"\\\\")
if find(v,"\x00") >= 0: v = join(split(v,"\x00"),"\\0")
if find(v,"\032") >= 0: v = join(split(v,"\032"),"\\z")
if find(v,"'") >= 0: v = join(split(v,"'"),"\\'")
if find(v,"\"") >= 0: v = join(split(v,"\""),"\\\"")
if find(v,"\n") >= 0: v = join(split(v,"\n"),"\\n")
if find(v,"\r") >= 0: v = join(split(v,"\r"),"\\r")
v = "'" + v + "'"
Thanks!
David.