DBD::mysql 3.0008 patch to fix fail in t/50commit w/ MySQL 4.x installation
"Tim Hunter" <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Hi folks, don't ask me why I'd be perverse enough to still be using MySQL 4.0.14. In any case, an install of DBD::mysql 3.0008 give the following error during 'make test': t/50commit...........DBD::mysql::db do failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ENGINE=innodb' at line 1 at t/50commit.t line 86. I've written a relatively simple patch to t/mysql.dbtest to fix this, and attached it. An extended error log is also attached. tim -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]
patch-3.008-mysql4
(text/plain, 1.7 KB)
--- t/mysql.dbtest.orig 2006-11-27 03:46:39.770032000 +0000
+++ t/mysql.dbtest 2006-11-27 03:46:23.807078400 +0000
@@ -1,17 +1,18 @@
# Hej, Emacs, give us -*- perl -*- mode here!
#
# $Id: mysql.dbtest 7820 2006-09-10 12:52:09Z capttofu $
#
# database specific definitions for a 'mysql' database
my $have_transactions;
+my $type_or_engine;
# This function generates a mapping of ANSI type names to
# database specific type names; it is called by TableDefinition().
#
sub AnsiTypeToDb ($;$) {
my ($type, $size) = @_;
my ($ret);
if ((lc $type) eq 'blob') {
if ($size >= 1 << 16) {
@@ -72,21 +73,21 @@
}
push(@colDefs, $colDef);
}
if (@keys) {
$keyDef = ", PRIMARY KEY (" . join(", ", @keys) . ")";
} else {
$keyDef = "";
}
my $suffix = "";
if ($have_transactions) {
- $suffix = " ENGINE=$have_transactions";
+ $suffix = " $type_or_engine=$have_transactions";
}
$def = sprintf("CREATE TABLE %s (%s%s)%s", $tablename,
join(", ", @colDefs), $keyDef, $suffix);
}
#
# This function generates a list of tables associated to a
# given DSN.
#
@@ -142,16 +143,28 @@
$row->{'Value'} eq 'YES') {
$have_transactions = "innodb";
last;
}
if ($row->{'Variable_name'} eq 'have_gemini' &&
$row->{'Value'} eq 'YES') {
$have_transactions = "gemini";
last;
}
}
+
+ $sth = $dbh->prepare("select version()");
+ $sth->execute();
+ my $ref= $sth->fetchall_arrayref();
+ my $version= $ref->[0][0];
+ $version =~ /^(\d)\.(\d)/;
+ print "version $version version # $1 dot $2\n";
+ if ($1 < 5) {
+ $type_or_engine = "type";
+ } else {
+ $type_or_engine = "ENGINE";
+ }
}
return $have_transactions;
}
1;
buglog.txt
(text/plain, 7.9 KB)
$ mysql -V
mysql Ver 12.21 Distrib 4.0.14, for pc-cygwin (i686)
$ env PATH="${PATH}:/usr/local/mysql/bin" perl Makefile.PL 2>&1 | tee -a ../buglog.txt
I will use the following settings for compiling and testing:
cflags (mysql_config) = -I'/usr/local/mysql/include/mysql'
embedded (mysql_config) =
libs (mysql_config) = -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (default ) =
To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.
Checking if your kit is complete...
Looks good
Using DBI 1.53 (for perl 5.008007 on cygwin-thread-multi-64int) installed in /usr/lib/perl5/site_perl/5.8/cygwin/auto/DBI/
Writing Makefile for DBD::mysql
$ env PATH="${PATH}:/usr/local/mysql/bin" make 2>&1 | tee -a ../buglog.txt
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/Mysql.pm blib/lib/Mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
gcc -c -I/usr/lib/perl5/site_perl/5.8/cygwin/auto/DBI -I'/usr/local/mysql/include/mysql' -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB -O3 -DVERSION=\"3.0008\" -DXS_VERSION=\"3.0008\" "-I/usr/lib/perl5/5.8/cygwin/CORE" dbdimp.c
dbdimp.c: In function `mysql_db_FETCH_attrib':
dbdimp.c:2047: warning: cast from pointer to integer of different size
dbdimp.c: In function `mysql_st_FETCH_attrib':
dbdimp.c:3514: warning: cast from pointer to integer of different size
/usr/bin/perl.exe -p -e "s/~DRIVER~/mysql/g" /usr/lib/perl5/site_perl/5.8/cygwin/auto/DBI/Driver.xst > mysql.xsi
/usr/bin/perl.exe /usr/lib/perl5/5.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 224
Warning: duplicate function definition 'rows' detected in mysql.xs, line 567
gcc -c -I/usr/lib/perl5/site_perl/5.8/cygwin/auto/DBI -I'/usr/local/mysql/include/mysql' -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include -DUSEIMPORTLIB -O3 -DVERSION=\"3.0008\" -DXS_VERSION=\"3.0008\" "-I/usr/lib/perl5/5.8/cygwin/CORE" mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.dll
/usr/bin/perl.exe myld ld2 -s -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.dll \
/usr/lib/perl5/5.8/cygwin/CORE/libperl.dll.a -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm \
gcc -shared -o mysql.dll -Wl,--out-implib=libmysql.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--stack,8388608 -Wl,--enable-auto-image-base \
-s -L/usr/local/lib dbdimp.o mysql.o /usr/lib/perl5/5.8/cygwin/CORE/libperl.dll.a -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lm
mv mysql.dll libmysql.dll.a blib/arch/auto/DBD/mysql/
chmod 755 blib/arch/auto/DBD/mysql/mysql.dll
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
$ env PATH="${PATH}:/usr/local/mysql/bin" make test 2>&1 | tee -a ../buglog.txt
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base.............ok
t/10dsnlist..........ok
t/20createdrop.......ok
t/30insertfetch......ok
t/35limit............ok
t/35prepare..........ok
t/40bindparam........ok
t/40bindparam2.......ok
t/40blobs............ok
t/40listfields.......ok
t/40nulls............ok
t/40numrows..........ok
t/41bindparam........ok
t/41blobs_prepare....ok
t/42bindparam........ok
t/50chopblanks.......ok
t/50commit...........DBD::mysql::db do failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ENGINE=innodb' at line 1 at t/50commit.t line 86.
DBD::mysql::db do failed: Table 'test.testak' doesn't exist at t/50commit.t line 107.
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
DBD::mysql::db do failed: Table 'test.testak' doesn't exist at t/50commit.t line 120.
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
DBD::mysql::db do failed: Table 'test.testak' doesn't exist at t/50commit.t line 132.
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
DBD::mysql::db do failed: Table 'test.testak' doesn't exist at t/50commit.t line 169.
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
Confused test output: test 9 answered after test 9
Confused test output: test 10 answered after test 11
Confused test output: test 11 answered after test 13
Confused test output: test 12 answered after test 15
Confused test output: test 13 answered after test 17
DBD::mysql::st execute failed: Table 'test.testak' doesn't exist at t/50commit.t line 43.
DBD::mysql::db do failed: Table 'test.testak' doesn't exist at t/50commit.t line 185.
DBD::mysql::db do failed: Table 'test.testak' doesn't exist at t/50commit.t line 202.
DBD::mysql::db do failed: Unknown table 'testak' at t/50commit.t line 219.
Confused test output: test 14 answered after test 18
Confused test output: test 15 answered after test 20
Confused test output: test 16 answered after test 21
Confused test output: test 17 answered after test 23
Confused test output: test 18 answered after test 24
Confused test output: test 19 answered after test 26
Confused test output: test 20 answered after test 27
Confused test output: test 21 answered after test 28
Confused test output: test 22 answered after test 29
FAILED tests 5-16, 18-22, 24-25, 27, 29
Failed 21/30 tests, 30.00% okay
t/60leaks............skipped
all skipped: $ENV{SLOW_TESTS} is not set or Proc::ProcessTable not installed
t/dbdadmin...........ok
t/insertid...........ok
t/param_values.......ok
t/prepare_noerror....skipped
all skipped: test - will only run with MySQL 5.1 and above.
t/texecute...........ok
Failed Test Stat Wstat Total Fail List of Failed
-------------------------------------------------------------------------------
t/50commit.t 30 21 5-16 18-22 24-25 27 29
2 tests skipped.
Failed 1/23 test scripts. 21/440 subtests failed.
Files=23, Tests=440, 71 wallclock secs ( 5.67 cusr + 4.17 csys = 9.84 CPU)
Failed 1/23 test programs. 21/440 subtests failed.
make: *** [test_dynamic] Error 14
$ cd t; patch < /tmp/patch-mysql4; cd ..
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base.............ok
t/10dsnlist..........ok
t/20createdrop.......ok
t/30insertfetch......ok
t/35limit............ok
t/35prepare..........ok
t/40bindparam........ok
t/40bindparam2.......ok
t/40blobs............ok
t/40listfields.......ok
t/40nulls............ok
t/40numrows..........ok
t/41bindparam........ok
t/41blobs_prepare....ok
t/42bindparam........ok
t/50chopblanks.......ok
t/50commit...........ok
t/60leaks............skipped
all skipped: $ENV{SLOW_TESTS} is not set or Proc::ProcessTable not installed
t/dbdadmin...........ok
t/insertid...........ok
t/param_values.......ok
t/prepare_noerror....skipped
all skipped: test - will only run with MySQL 5.1 and above.
t/texecute...........ok
All tests successful, 2 tests skipped.
Files=23, Tests=440, 36 wallclock secs ( 5.41 cusr + 4.31 csys = 9.72 CPU)