[racket] Pulling BLOB from SQL DB

From: J G Cho (gcho at fundingmatters.com)
Date: Mon Apr 16 10:07:50 EDT 2012

It works without crashing. Will do more testing.

Thank you.

On Sun, Apr 15, 2012 at 2:00 AM, Ryan Culpepper <ryan at cs.utah.edu> wrote:
> I just pushed some fixes to MySQL's handling of fields larger than about
> 64k. One of the bugs I fixed would account for the out-of-memory error (it
> sometimes tried to allocate far more than it needed).
>
> With my changes I've successfully retrieved blobs of up to 100M. Note: you
> may need to increase your server's "max_allowed_packet" setting if you get
> unexpected NULLs; as far as I can tell, the server replaces blobs longer
> than max_allowed_packet with NULL in query results.
>
> Could you try your program again with a version of Racket that includes my
> changes? (In about four hours there should be a new nightly build at
> http://pre.racket-lang.org/ that includes these changes.)
>
> Ryan
>
>
>
> On 04/14/2012 01:43 PM, J G Cho wrote:
>>>
>>>
>>> How big was the blob? I have have some fixes pending for blobs that don't
>>> fit within a single MySQL "packet", but that limit is pretty low.
>>
>>
>> Not too big by my standards. My predecessor put various .doc and .xls
>> file in db as 'content/doc mgmt'.
>>
>> I dont't have the exact figures but the error message had at least
>> 7~13 digits of chars. I will have to look it up on Monday. (I will CC
>> to the users listing at that point.)
>>
>>>
>>>
>>>> Questions:
>>>>
>>>> How can I give more memory to /usr/local/bin/racket?
>>>
>>>
>>>
>>> Just the standard "ulimit" command.
>>
>>
>> Not too familiar with unlimit. Would that be
>>
>> unlimit racket -t file.rkt
>>
>> or
>>
>> unlimit PID (of racket -t ...)
>>
>> or
>>
>> racket --unlimit (as in java java -Xms64m -Xmx128m)
>>
>>>
>>>
>>>> Or more importantly,
>>>> Is there a way to pipe PORTs (in from MySQL and out to file) such that
>>>> Racket can handle 'very large' BLOBs?
>>>
>>>
>>>
>>> No, that's not possible. But you can try retrieving the blob in separate
>>> chunks (eg use the SUBSTR function with varying offsets).
>>>
>>> Ryan
>>
>>
>> Ended up using python
>> with open(...) as f:
>>     f.write(cursor.fetchone()[0])
>>
>> It would be nice to have that in DB but not a show stopper. If I can
>> help it, I don't usually like to put BLOBs in DB.
>>
>> Thanks, again.
>>
>> jGc
>
>


Posted on the users mailing list.