John wrote:
> On Thursday 29 October 2009 10:22:18 am John wrote:
>> cursor.execute("INSERT INTO test_binary VALUES ( %(img)s)", picdata)
>
> should be:
>
> cursor.execute("INSERT INTO test_binary VALUES ( %s)", picdata)
I figured, thanks. Ok... I just did some testing of my own, and can confirm
that BLOB
updating and inserting isn't working. I used SQLite, using this script:
{{{
import dabo
from dabo.lib import getRandomUUID
picdata = buffer(open("ss/resources/icon_green_16px.png").read())
con = dabo.db.connect(":memory:")
cur = con.cursor()
cur.execute("create table test (id PRIMARY KEY, img BLOB)")
biz = dabo.biz.dBizobj(con, DataSource="test", KeyField="id")
biz.DefaultValues["id"] = getRandomUUID
biz.new()
biz.Record.img = picdata
print len(biz.Record.img)
biz.save()
biz.requery()
print len(biz.Record.img)
}}}
I went ahead and committed my patch, since it doesn't appear to break anything
and I
think it is a step in the right direction.
Actually, I think we need to bite the bullet and convert our INSERT and UPDATE
statements to send the parameters to the dbapi drivers, instead of converting
to
string ourselves. Carl had a patch for that a couple years ago, that couldn't
be
applied because right after he submitted it, we made a lot of incompatible
changes to
dCursorMixin, and we never got an updated patch from him.
I think that BLOB support is important, and am surprised it's gone this long
without
anyone noticing it's been broken.
Please start a ticket.
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]