On Nov 29, 2007 3:26 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 29, 2007 at 03:17:43PM +0100, Bart wrote:
> > On Nov 29, 2007 1:24 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> > > On Thu, Nov 29, 2007 at 05:22:18AM +0100, Bart wrote:
> > > > Argh, I just don't know what data format is supposed to be, unpickling
> > > > keeps choking on the data.
> > >
> > >    Can you write a short test script that demonstrate the problem?
> >
> > Well, I don't know what it should do, that's the problem:)
>
>    It should put something in the DB and fail while trying to fetch it
> back.

I meant that I have no idea how to format the data I should be setting.
Given that, it's trivial to give you code that doesn't work :), say...

def set_data(id,data):
    '''
       Works around the fact that SQLObject does not handle big queries
       and, because it uses literal queries, therefore not bug BLOBs.
    '''
    from pysqlite2 import dbapi2 as sqlite
    con = sqlite.connect(Thing._dbpath) #my own variable. It needed a place.
    cur = con.cursor()
    pickledata = pickle.dumps(data,2)
    cur.execute("update thing set data=? where id=?",(pickledata,id,) )
    #cur.execute("update thing set data=? where
id=?",(sqlite.Binary(pickledata),id,) )
    con.commit()
    cur.close()
    con.close()



> > When I store an empty dict with sqlobject, then look at the data via
> > sqlite2, I see u'\x02&bn/\x08,'
>
>    Where have you got the data from?

That's the data that sqlobject stored.

That view on it comes from:
  from pysqlite2 import dbapi2 as sqlite
  con = sqlite.connect(Thing._dbpath)
  cur = con.cursor()
  cur.execute("select id,data from thing ")
  print 't(): '+`cur.fetchall()`
  cur.close()
  con.close()

sqlitebrowser shows something similar (that is, it shows
don't-know glyphs for the first and last character).


> > Huh, I didn't see that that code you pasted before was SQLObejct
> > (pseudo)code and not a copy of the quoted page.
>
>    Nothing pseudo there. It was a copy of the exact program I ran. The only
> thing I skipped was import and connection setup.

Well, you didn't import sqlobject, or connect to any backing database
so I it's not exactly runnable code either, nor does it seem to apply to sqlite.

('course, SQLObject is slightly Weird when it comes to state and connections,
 so maybe you're doing something interesting)


> > You're saying 70MB
> > non-parametric data work in sqlite right now without BLOBs?
>
>    Works for me with BLOBCol and PickleCol, no problem.

But sqlite has a 1MB (default) query size limit which causes the
"String or BLOB exceeded size limit" DataError that bugs me so much,
so unless you have a non-standard sqlite
(well.. I don't know how different distros do this)
or tweaked headers when compiling sqlite,
I don't see how this could *not* fail.

Actually, I suppose the quickest short-term (but not so portable)
fix for me is to recompile sqlite.

Thanks anyway,
--Bart

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to