Hi!
(Sorry for delay!)

The fragment below shows how I made data dump of the table, containing
binary data.
Then, using editor (Ultraedit) I compared the content of the output file
with the file created by mysqldump.
The difference is that the DBI->quote() did not escape some characters  that
were escaped by mysqldump. (for example double quotes or some characters
that I can not )
As the result, the file created by my script could not run.

 foreach $table (@tablelist) {
      $sth = $dbh->prepare("SELECT * FROM $table");
      $sth->execute($query);
      while (my @row = $sth->fetchrow_array){
       $datadump .= "INSERT INTO $table VALUES ( ";
       my @rowdata;
       for (my $i = 0; $i < @row; $i++) {
        push @rowdata, $dbh->quote($row[$i]);
       }
       $datadump .= join (', ', @rowdata) . ");\n";
      }
      $sth->finish;
 }



----- Original Message -----
From: Sterin, Ilya <[EMAIL PROTECTED]>
To: 'Yannis Livassof ' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, May 02, 2001 4:03 PM
Subject: RE: quoting binaries (MYSQL)


> We need more code than (SELECT... and INSERT...).  How did you see the
funny
> unescaped character?  Did you print them out, in that case did you binmode
> STDOUT?
>
> Use trace() to see exactly what is going on.  Also an error message on
> insert would be very helpful to us.
>
> Ilya Sterin
>
> -----Original Message-----
> From: Yannis Livassof
> To: [EMAIL PROTECTED]
> Sent: 05/02/2001 3:28 AM
> Subject: quoting binaries (MYSQL)
>
> Hi!
>
> Does anybody knows how to quote the binarie fields properly using the
> DBI.pm (on Mysql)?
>
> I used "SELECT ..." ,
> then
> $dnh->quote(some data),
> then
> $dbh->do("INSERT ...")
> The last "do" leads to error.
>
>
> As I see, some funny characters selected from binary fields are not
> escaped. I compared it with the output generated with "mysqldump".
>
> Plese help!!!!!
>
> Yannis Livassov

Reply via email to