List:General Discussion« Previous MessageNext Message »
From:Chip Turner Date:October 6 1999 7:19pm
Subject:Re: BLOB TRANSLATION PROBLEM
View as plain text  
LSzijarto@stripped writes:

> I am inserting binary data into a BLOB column.  I attempted to "translate" 
> the necessary escaped characters, 0, ', ", \  using PERL   --   and all 
> worked fine except in a single .gif file wherein what appeared as "?" in my 
> vi editor in the original .gif was somehow translated into "NULL" when 
> inserted into the BLOB column in the mysql database.  Does anyone know what 
> that would be?  Are there special issues with "?" that need to be addressed?  
> Thank you so very much for any assistance you may have to offer.

Sounds like a bug in Mysql.pm.  We've encountered it before; I'd
suggest switching full over to DBI and DBD::mysql, but if you can't,
you could try this patch.  It's ugly but it works.

--- Msql-Mysql-modules-1.2203/mysql/lib/Mysql.pm	Sun Aug 22 08:21:41 1999
+++ mysql/lib/Mysql.pm	Mon Aug 23 15:01:31 1999
@@ -168,6 +168,20 @@
 	$db_errstr = $dbh->errstr();
 	return undef;
     }
+
+    # HACK HACK HACK HACK HACK
+    # Fixed on 4/29/99
+    # problem was UPDATE interpreting placeholders for all ? in a string IFF
+    #  the string was surrounded by "" in the query
+    # example: "UPDATE foo SET blah='index.cgi?BISKIT' WHERE id=1"
+    #  without this hack.  This hack digs into DBI (check perldoc for details on
placeholders).
+
+    # chip 4/29/99
+    $sth->{'NUM_OF_PARAMS'} = 0;
+    # END SHORT HACK
+
     $sth->{'PrintError'} = !$Mysql::QUIET;
     my $result = $sth->execute();
     if (!$result) {
<<<<< end patch >>>>>

Chip
-- 
Chip Turner                   chip@stripped
                              Programmer, ZFx, Inc.  www.zfx.com
                              PGP key available at wwwkeys.us.pgp.net
Thread
BLOB TRANSLATION PROBLEMLSzijarto6 Oct
  • Re: BLOB TRANSLATION PROBLEMJames Manning7 Oct
  • Re: BLOB TRANSLATION PROBLEMMartin Ramsch7 Oct
  • Re: BLOB TRANSLATION PROBLEMChip Turner7 Oct