Skip Menu |

This queue is for tickets about the DBD-mysqlPP CPAN distribution.

Report information
The Basics
Id: 1957
Status: resolved
Priority: 0/
Queue: DBD-mysqlPP

People
Owner: Nobody in particular
Requestors: lairdshaw [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: '/'s not correctly inserted into BLOB columns for text data
The mysqlPP driver interprets '\'s in text data before inserting into a BLOB column. This bug occurred with the following setups 1) OS: Windows 95 mysql server version 3.23.54 (running on the same machine as the scripts) Perl v5.8.0 from ActiveState DBI version 1.30 DBD::mysqlPP version 0.03 2) OS: Windows 95 mysql server version 3.23.54 (running on the same machine as the scripts) Perl v5.6.1 build 633 from ActiveState DBI version 1.32 DBD::mysqlPP version 0.03 The following source code is adapted from that provided by Ron Savage on the dbi-users mailing list. Show quoted text
-----Begin Demonstration Code----- use strict; use warnings; use DBI; my $input_file_name = 'test.txt'; my $rootpassword; &do_test("mysql"); &do_test("mysqlPP"); sub do_test { my($driver) = shift; print "Driver: $driver\n"; my($dbh) = DBI -> connect ( "DBI:$driver:test:127.0.0.1", 'root', $rootpassword, { AutoCommit => 1, LongReadLen => 150_000, LongTruncOk => 0, PrintError => 0, RaiseError => 1, ShowErrorStatement => 1, } ); eval{$dbh -> do('drop table ttable')}; my($sql) = "create table ttable (b_value blob)"; $dbh -> do($sql); $sql = 'insert into ttable (b_value) values (?)'; my($sth) = $dbh -> prepare($sql); open(INX, $input_file_name) || die("Can't open($input_file_name): $!"); binmode INX; print "File name: $input_file_name. \n"; print "Blob file size: ", -s INX, " bytes.\n"; my($blob); { local $/ = undef; $blob = <INX>; close INX; } print "Blob ram size: ", length($blob), " bytes.\n"; $sth -> execute($blob); $sth -> finish(); $sql = 'select b_value from ttable'; $sth = $dbh -> prepare($sql); $sth -> execute(); $blob = $sth -> fetch(); $blob = $$blob[0]; $sth -> finish(); open(OUTX, ">$input_file_name.$driver"); { local $/ = undef; print OUTX $blob; close OUTX; } print "Blob db size: ", length($blob), " bytes.\n"; $dbh->disconnect; }
-----End Demonstration Code-----
-----Results on screen----- Driver: mysql File name: test.txt. Blob file size: 76 bytes. Blob ram size: 76 bytes. Blob db size: 76 bytes. Driver: mysqlPP File name: test.txt. Blob file size: 76 bytes. Blob ram size: 76 bytes. Blob db size: 74 bytes. -----End Results on screen----- -----begin test.txt----- Do you think this is a bug? Yes\no. The path to the file is c:\bugfix.pl. -----end test.txt----- -----begin test.txt.mysql----- Do you think this is a bug? Yes\no. The path to the file is c:\bugfix.pl. -----end test.txt.mysql----- -----begin test.txt.mysqlPP----- Do you think this is a bug? Yes o. The path to the file is c:ugfix.pl. -----end test.txt.mysqlPP-----
Newest DBD::mysqlPP v0.04 were uploaded to CPAN. Please try it.