On 3/22/06 8:38 PM, Daniel Pittman wrote:
> Daniel Pittman <[EMAIL PROTECTED]> writes:
>> Sean Davis <[EMAIL PROTECTED]> writes:
>>> Just tried it and Base64 encoding works fine.  I can presumably
>>> inflate and deflate within my RDBO class.  Thanks for the idea.
>> 
>> Presumably that works because nothing in the Base64 string requires
>> BYTEA encoding when you insert it.[1]
>> 
>> On the negative side, you just expanded the storage consumed in your
>> BYTEA column by twenty-five percent, by not storing direct binary data
>> in there.
> 
> Unless I am mistaken, then, without the explicit type binding for the
> column there isn't much point in using BYTEA compared to a TEXT column
> with base64 stored in it.

Looking here:

http://www.postgresql.org/docs/8.1/interactive/datatype-binary.html

it seems that there's already an ASCII-ified format for bytea columns.

"to escape an octet, it is converted into the three-digit octal number
equivalent of its decimal octet value, and preceded by two backslashes."

CREATE TABLE t1 (b BYTEA);
INSERT INTO t1 (b) VALUES ('\\001\\002\\003'::bytea);
SELECT * FROM t1;

      b       
--------------
 \001\002\003

That's no different, conceptually, from the way BIT columns are handled in
Postgres already.  So no bind_param() magic should be required, although
there will be some hit for parsing and formatting these values.

-John




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to