Re: using binary data in variable in an INSERT/UPDATE statement

From: Jupiterhost.Net (mlists_at_jupiterhost.net)
Date: 05/10/04


Date: Mon, 10 May 2004 14:18:19 -0500
To:  dbi-users@perl.org

Anyone ever do this before?

JupiterHost.Net wrote:

> Hello DBI folks!
>
> If I have a column that is binary and data that is binary do I simply
> $dbh->quote() it on an insert?
>
> IE
>
> my $binary_content = get_binary_stuff();
>
> my $binary_content_Q = $dbh->quote($binary_content);
>
> $dbh->do("UPDATE MyStuff SET BinaryGoodies=$binary_content_Q WHERE ID=1");
>
> ...
>
> Or do I need to convert it to hex and then $dbh->quote() the hex
> version (or not quote it)?
>
> If I do need to make it hex first do I need to "unhex" it, after I
> SELECT it into a variable, to get it into the original binary format?
>
> (w/ pack()/unpack()??? which is a bit OT for this list...)
>
> TIA
>
> Lee.M - JupiterHost.Net
>
>
>