Re: [PDO-Users]PDO and BLOBs
pythondbo-users-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Fri, 28 Oct 2005 15:36:07 -0400
| Newsgroups | gmane.comp.python.db.pdo.user |
|---|---|
| Message-ID | <[email protected]> |
pythondbo-users-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
wrote:
> pythondbo-users-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> wrote:
>
>> [Sorry for this duplicate -- I just realized that my last post
>> accidentally fell under another thread, where it was not appropriate.]
>>
>> How do I read and write BLOBs using pdo? I'm specifically concerned
>> with MySQL, but I assume the principles would be the same under other
>> databases. It seems like binary fields rely on streams, which have to
>> be created at the client side, but maybe there's something else that
>> I'm missing.
>>
>
> Okay, I'm catching on. It sounds like I simply need to open a file and
> .read() its contents into a field, then .write() the resultset field
> back into a file. I'm still not sure how to convert the resultset array
> into a string/stream, however.
Since I've embarrassed myself by posting a silly question, I might as
well go further and post the answer to it. The only tricks with getting
the information into the database were (a) having to send it in parts,
and (b) having to escape certain characters (',", and \). It gets
returned in an array, which I could loop over and write() to the file.
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information