Hi,

Just a sanity chack here for working with uploaded binary files.

To get them into postgres, I open the file as binary (encoding and
translation) and read the whole thing. Then I transform the data to Hex
using "binary scan H* $bindata hexdata" and insert into postgres using
"insert ... decode('$hexdata', 'hex') ...".

On selecting the data, I simple select it, so I get it in Postgress
awkward (and slightly inefficient?) "escaped" format. This is where I was
pondering on a routine to get it into binary again. Then it dawned on me.
As it escapes most characters using the \xxx format and \\ for an actual
slash, I could just use "subst -nocommands -novariable $escapeddata" and
either scan it to HEX for return to the client or simply write it to a
file.

Now, this SEEMS to work 100%. But does anyone see a problem with this that
might jump up and bite me one day when I least expect it? Is this common
practice, or is there a better/offical way to do this?

Thanks for your time!

Bas.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to