Hello community, here is the log from the commit of package perl-DBD-mysql checked in at Fri Mar 30 16:31:30 CEST 2007. -------- --- perl-DBD-mysql/perl-DBD-mysql.changes 2007-03-02 15:49:24.000000000 +0100 +++ /mounts/work_src_done/STABLE/perl-DBD-mysql/perl-DBD-mysql.changes 2007-03-30 16:10:23.000000000 +0200 @@ -1,0 +2,14 @@ +Fri Mar 30 16:01:24 CEST 2007 - anicka@suse.cz + +- update to 4.004 +* Work around a bug in old 3.23 servers by specifying NOT NULL + for fields used as a primary key in tests. +* Add support for mysql_warning_count statement handle attribute. +* Add support for mysql_multi_statements connection option. +* UTF8-Flag not set with flag mysql_enable_utf8 and column + collation utf8_bin patch, +* Fixed do_error definition +* Conversion of test suite to Test::More +* Fix inclusion of non-primary keys in primary_key_info. + +------------------------------------------------------------------- Old: ---- DBD-mysql-4.002.tar.bz2 New: ---- DBD-mysql-4.004.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-DBD-mysql.spec ++++++ --- /var/tmp/diff_new_pack.v29316/_old 2007-03-30 16:31:25.000000000 +0200 +++ /var/tmp/diff_new_pack.v29316/_new 2007-03-30 16:31:25.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package perl-DBD-mysql (Version 4.002) +# spec file for package perl-DBD-mysql (Version 4.004) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -20,7 +20,7 @@ Requires: perl-DBI perl-Data-ShowTable Requires: perl = %{perl_version} Autoreqprov: on -Version: 4.002 +Version: 4.004 Release: 1 Summary: Interface to the MySQL database Group: Development/Libraries/Perl @@ -63,6 +63,17 @@ /var/adm/perl-modules/perl-DBD-mysql %changelog +* Fri Mar 30 2007 - anicka@suse.cz +- update to 4.004 + * Work around a bug in old 3.23 servers by specifying NOT NULL + for fields used as a primary key in tests. + * Add support for mysql_warning_count statement handle attribute. + * Add support for mysql_multi_statements connection option. + * UTF8-Flag not set with flag mysql_enable_utf8 and column + collation utf8_bin patch, + * Fixed do_error definition + * Conversion of test suite to Test::More + * Fix inclusion of non-primary keys in primary_key_info. * Fri Mar 02 2007 - anicka@suse.cz - update to 4.002 * Rewrote table_info method to support all arguments ++++++ DBD-mysql-4.002.tar.bz2 -> DBD-mysql-4.004.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/ChangeLog new/DBD-mysql-4.004/ChangeLog --- old/DBD-mysql-4.002/ChangeLog 2007-03-01 23:34:46.000000000 +0100 +++ new/DBD-mysql-4.004/ChangeLog 2007-03-22 23:14:20.000000000 +0100 @@ -1,12 +1,33 @@ -2007-02-24 Patrick Galbraith <patg@grazr.com> Jim Winstead <jimw@mysql.com> (4.002) +2007-3-22 Patrick Galbraith <patg@grazr.com> Jim Winstead <jimw@mysql.com> (4.004) +* Work around a bug in old 3.23 servers by specifying NOT NULL for fields used + as a primary key in tests. (Bug #20325, reported by Julian Ladisch) +* Add support for mysql_warning_count statement handle attribute. (Bug #25457, + patch from Philip Stoev) +* Add support for mysql_multi_statements connection option. (RT #12322, based + on patch from Doug Morris) +* Had to bump to 4.003 do to print statement in mysql.pm that made it + into the dist. Even though you can delete a file on CPAN, you cannot + re-upload it if it's the same name. Mea Culpa. +* UTF8-Flag not set with flag mysql_enable_utf8 and column collation utf8_bin patch, + Joost Diepenmaat, (RT #24738) +* Fixed do_error definition (Scott Hildreth, Tim Bunce) +* Conversion of test suite to Test::More + +2007-3-5 Patrick Galbraith <patg@grazr.com> Jim Winstead <jimw@mysql.com> (4.003) +* Fix inclusion of non-primary keys in primary_key_info. (Bug #26786, + reported and patch by Dave Rolsky) + +2007-3-1 Patrick Galbraith <patg@grazr.com> Jim Winstead <jimw@mysql.com> (4.002) +* Fix re-exec of Makefile.PL when forcing $ENV{LANG} to 'C'. (RT #25233, + reported by Slaven Rezic) * Rewrote table_info method to support all arguments (previously it would only ever return all of the tables in the current database, no matter what was specified) -* Fixed version to be a string, which was previously a float, which caused +* Fixed $DBD::mysql::VERSION to be a string instead of a float, which caused problems for certain locales -* Fixed bug #23974. $dbh->column_info now returns empty arrayref upon table not - existing. Much thanks to Tim Bunce for help fixing the problem in mysql.pm - vs. dbdimp.c +* Fixed bug #23974. $dbh->column_info now returns handle with no rows upon + table not existing. Much thanks to Tim Bunce for help fixing the problem + in mysql.pm vs. dbdimp.c * Removed #ifdefs for do error (sqlstate being passed as last arg depending on version) * Fixed insertid test to work with auto_increment_increment replication setup. @@ -89,10 +110,6 @@ * Added multiple fixes to dbd_st_prepare which fixed variable overwrite and unset increment counter. Also improved loop which checks statements for presence of "LIMIT" by using a pointer as opposed to char array -* Added patch for SSL Verify Certificate (Thanks Eric Chen!) -* Added multiple fixes to dbd_st_prepare which fixed variable overwrite - and unset increment counter. Also improved loop which checks statements - for presence of "LIMIT" by using a pointer as opposed to char array increment variable. These errors were showing up in OpenBSD and other Unixen (which I think all BSD-based) (Thanks to Kyle George!) * Added fix to Makefile.PL to obtain correct build flags on VMS @@ -1028,7 +1045,7 @@ * lib/Msql/Statement.pm: Fixed use of Msql::TEXT_TYPE without checking whether we are running Msql 1. -$Id: ChangeLog 9188 2007-03-01 21:13:52Z jimw $ +$Id: ChangeLog 9299 2007-03-22 22:14:29Z capttofu $ DBD::mysql for DBI - Written by Jochen Wiedmann <joe@ispsoft.de> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/dbdimp.c new/DBD-mysql-4.004/dbdimp.c --- old/DBD-mysql-4.002/dbdimp.c 2007-03-01 16:47:26.000000000 +0100 +++ new/DBD-mysql-4.004/dbdimp.c 2007-03-20 14:37:12.000000000 +0100 @@ -8,7 +8,7 @@ * You may distribute this under the terms of either the GNU General Public * License or the Artistic License, as specified in the Perl README file. * - * $Id: dbdimp.c 9183 2007-03-01 15:47:39Z capttofu $ + * $Id: dbdimp.c 9279 2007-03-20 02:45:21Z capttofu $ */ @@ -1558,6 +1558,16 @@ imp_dbh->use_mysql_use_result); } +#if defined(CLIENT_MULTI_STATEMENTS) + if ((svp = hv_fetch(hv, "mysql_multi_statements", 22, FALSE)) && *svp) + { + if (SvTRUE(*svp)) + client_flag |= CLIENT_MULTI_STATEMENTS; + else + client_flag &= ~CLIENT_MULTI_STATEMENTS; + } +#endif + #if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION /* took out client_flag |= CLIENT_PROTOCOL_41; */ /* because libmysql.c already sets this no matter what */ @@ -2792,6 +2802,7 @@ hv_delete((HV*)SvRV(sth), "mysql_table", 11, G_DISCARD); hv_delete((HV*)SvRV(sth), "mysql_type", 10, G_DISCARD); hv_delete((HV*)SvRV(sth), "mysql_type_name", 15, G_DISCARD); + hv_delete((HV*)SvRV(sth), "mysql_warning_count", 20, G_DISCARD); /* Adjust NUM_OF_FIELDS - which also adjusts the row buffer size */ DBIc_NUM_FIELDS(imp_sth)= 0; /* for DBI <= 1.53 */ @@ -2883,6 +2894,10 @@ bind_type_guessing=0; } + if (dbis->debug >= 2) + PerlIO_printf(DBILOGFP, "mysql_st_internal_execute MYSQL_VERSION_ID %d\n", + MYSQL_VERSION_ID ); + salloc= parse_params(svsock, sbuf, &slen, @@ -2890,13 +2905,6 @@ num_params, bind_type_guessing); - if (dbis->debug >= 2) - PerlIO_printf(DBILOGFP, "mysql_st_internal_execute\n"); - - if (dbis->debug >= 2) - PerlIO_printf(DBILOGFP, "mysql_st_internal_execute MYSQL_VERSION_ID %d\n", - MYSQL_VERSION_ID ); - if (salloc) { sbuf= salloc; @@ -3204,6 +3212,8 @@ } } + imp_sth->warning_count = mysql_warning_count(&imp_dbh->mysql); + if (dbis->debug >= 2) { /* @@ -3647,7 +3657,13 @@ sv_setpvn(sv, col, len); /* UTF8 */ #if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION + +#if MYSQL_VERSION_ID >= FIELD_CHARSETNR_VERSION + /* see bottom of: http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html */ + if (imp_dbh->enable_utf8 && fields[i].charsetnr != 63) +#else if (imp_dbh->enable_utf8 && !(fields[i].flags & BINARY_FLAG)) +#endif sv_utf8_decode(sv); #endif /* END OF UTF8 */ @@ -4145,6 +4161,10 @@ else if (strEQ(key, "mysql_use_result")) retsv= boolSV(imp_sth->use_mysql_use_result); break; + case 19: + if (strEQ(key, "mysql_warning_count")) + retsv= sv_2mortal(newSViv((IV) imp_sth->warning_count)); + break; case 20: if (strEQ(key, "mysql_server_prepare")) #if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/dbdimp.h new/DBD-mysql-4.004/dbdimp.h --- old/DBD-mysql-4.002/dbdimp.h 2007-03-01 16:47:26.000000000 +0100 +++ new/DBD-mysql-4.004/dbdimp.h 2007-03-20 14:47:29.000000000 +0100 @@ -12,7 +12,7 @@ * You may distribute this under the terms of either the GNU General Public * License or the Artistic License, as specified in the Perl README file. * - * $Id: dbdimp.h 9183 2007-03-01 15:47:39Z capttofu $ + * $Id: dbdimp.h 9284 2007-03-20 13:47:18Z capttofu $ */ /* @@ -29,6 +29,7 @@ * statements as opposed to emulation in the driver */ #define SQL_STATE_VERSION 40101 +#define FIELD_CHARSETNR_VERSION 40101 /* should equivalent to 4.1.0 */ #define MULTIPLE_RESULT_SET_VERSION 40102 #define SERVER_PREPARE_VERSION 40103 #define LIMIT_PLACEHOLDER_VERSION 50100 @@ -237,6 +238,7 @@ long long_buflen; /* length for long/longraw (if >0) */ bool long_trunc_ok; /* is truncating a long an error */ my_ulonglong insertid; /* ID of auto insert */ + int warning_count; /* Number of warnings after execute() */ imp_sth_ph_t* params; /* Pointer to parameter array */ AV* av_attr[AV_ATTRIB_LAST];/* For caching array attributes */ int use_mysql_use_result; /* TRUE if execute should use */ @@ -282,11 +284,8 @@ #endif #include <dbd_xsh.h> -#if MYSQL_VERSION_ID >= SQL_STATE_VERSION void do_error (SV* h, int rc, const char *what, const char *sqlstate); -#else -void do_error (SV* h, int rc, const char *what); -#endif + SV *dbd_db_fieldlist (MYSQL_RES* res); void dbd_preparse (imp_sth_t *imp_sth, SV *statement); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/lib/Bundle/DBD/mysql.pm new/DBD-mysql-4.004/lib/Bundle/DBD/mysql.pm --- old/DBD-mysql-4.002/lib/Bundle/DBD/mysql.pm 2007-01-15 03:39:33.000000000 +0100 +++ new/DBD-mysql-4.004/lib/Bundle/DBD/mysql.pm 2007-03-20 02:02:47.000000000 +0100 @@ -2,7 +2,7 @@ package Bundle::DBD::mysql; -$VERSION = 4.002; +$VERSION = '4.004'; 1; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/lib/DBD/mysql.pm new/DBD-mysql-4.004/lib/DBD/mysql.pm --- old/DBD-mysql-4.002/lib/DBD/mysql.pm 2007-03-01 23:34:46.000000000 +0100 +++ new/DBD-mysql-4.004/lib/DBD/mysql.pm 2007-03-20 02:33:49.000000000 +0100 @@ -9,7 +9,7 @@ use Carp (); @ISA = qw(DynaLoader); -$VERSION = '4.002'; +$VERSION = '4.004'; bootstrap DBD::mysql $VERSION; @@ -397,7 +397,6 @@ local $dbh->{FetchHashKeyName} = 'NAME_lc'; # only ignore ER_NO_SUCH_TABLE in internal_execute if issued from here - print "DESCRIBE $table_id " . $dbh->quote($column) . "\n"; my $desc_sth = $dbh->prepare("DESCRIBE $table_id " . $dbh->quote($column)); my $desc = $dbh->selectall_arrayref($desc_sth, { Columns=>{} }); @@ -546,7 +545,7 @@ my $desc_sth = $dbh->prepare("SHOW KEYS FROM $table_id"); my $desc = $dbh->selectall_arrayref($desc_sth, { Columns=>{} }); my $ordinal_pos = 0; - foreach my $row (@$desc) { + foreach my $row (grep { $_->{key_name} eq 'PRIMARY'} @$desc) { $col_info{ $row->{column_name} } = { TABLE_CAT => $catalog, TABLE_SCHEM => $schema, @@ -967,6 +966,12 @@ this option is *ineffective* if the server has also been configured to disallow LOCAL.) +=item mysql_multi_statements + +As of MySQL 4.1, support for multiple statements seperated by a semicolon +(;) may be enabled by using this option. Enabling this option may cause +problems if server-side prepared statements are also enabled. + =item Prepared statement support (server side prepare) As of 3.0002_1, server side prepare statements were on by default (if your @@ -1348,8 +1353,11 @@ Similar to mysql, but type names and not numbers are returned. Whenever possible, the ANSI SQL name is preferred. -=back +=item mysql_warning_count + +The number of warnings generated during execution of the SQL statement. +=back =head1 TRANSACTION SUPPORT diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/Makefile.PL new/DBD-mysql-4.004/Makefile.PL --- old/DBD-mysql-4.002/Makefile.PL 2007-01-04 04:14:50.000000000 +0100 +++ new/DBD-mysql-4.004/Makefile.PL 2007-03-02 04:34:39.000000000 +0100 @@ -10,7 +10,7 @@ "LANG='C' before running 'perl Makefile.PL or by upgrading your Perl'\n\n\n"; sleep(5); - exec ("$Config{perlpath} $0", @ARGV )|| die $!; + exec ($Config{perlpath}, $0, @ARGV )|| die $!; } } use strict; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/MANIFEST new/DBD-mysql-4.004/MANIFEST --- old/DBD-mysql-4.002/MANIFEST 2007-03-01 16:54:44.000000000 +0100 +++ new/DBD-mysql-4.004/MANIFEST 2007-03-22 18:46:54.000000000 +0100 @@ -1,5 +1,5 @@ t/00base.t -t/10dsnlist.t +t/10connect.t t/20createdrop.t t/30insertfetch.t t/35limit.t @@ -22,6 +22,7 @@ t/80procs.t t/lib.pl t/insertid.t +t/multi_statement.t t/mysql.dbtest t/texecute.t t/prepare_noerror.t diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/META.yml new/DBD-mysql-4.004/META.yml --- old/DBD-mysql-4.002/META.yml 2007-03-02 04:29:26.000000000 +0100 +++ new/DBD-mysql-4.004/META.yml 2007-03-22 23:23:07.000000000 +0100 @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: DBD-mysql -version: 4.002 +version: 4.004 version_from: lib/DBD/mysql.pm installdirs: site requires: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/10connect.t new/DBD-mysql-4.004/t/10connect.t --- old/DBD-mysql-4.002/t/10connect.t 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-mysql-4.004/t/10connect.t 2007-03-22 18:46:14.000000000 +0100 @@ -0,0 +1,30 @@ +#!perl -w +# vim: ft=perl + +use Test::More tests => 2; +use DBI; +use DBI::Const::GetInfoType; +use strict; +use vars qw($mdriver); +$|= 1; + +our ($test_dsn, $test_user, $test_password); +$mdriver = ""; +for my $file ("lib.pl", "t/lib.pl", "DBD-mysql/t/lib.pl") { + do $file; if ($@) + { + print STDERR "Error while executing lib.pl: $@\n"; + exit 10; + } + if ($mdriver ne '') + { + last; + } +} +my @dsn; +my $dbh= DBI->connect($test_dsn, $test_user, $test_password, + { RaiseError => 1, PrintError => 1, AutoCommit => 0 }); + +ok(defined $dbh, "Connected to database"); + +ok($dbh->disconnect()); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/10dsnlist.t new/DBD-mysql-4.004/t/10dsnlist.t --- old/DBD-mysql-4.002/t/10dsnlist.t 2006-12-23 19:03:30.000000000 +0100 +++ new/DBD-mysql-4.004/t/10dsnlist.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,82 +0,0 @@ -#!/usr/local/bin/perl -# -# $Id: 10dsnlist.t 8435 2006-12-23 19:03:49Z capttofu $ -# -# This test creates a database and drops it. Should be executed -# after listdsn. -# - - -# -# Include lib.pl -# -require DBI; -$mdriver = ""; -foreach $file ("lib.pl", "t/lib.pl", "DBD-mysql/t/lib.pl") { - do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n"; - exit 10; - } - if ($mdriver ne '') { - last; - } -} -if ($mdriver eq 'pNET' || $mdriver eq 'Adabas') { - print "1..0\n"; - exit 0; -} -print "Driver is $mdriver\n"; - -sub ServerError() { - print STDERR ("Cannot connect: ", $DBI::errstr, "\n", - "\tEither your server is not up and running or you have no\n", - "\tpermissions for acessing the DSN $test_dsn.\n", - "\tThis test requires a running server and write permissions.\n", - "\tPlease make sure your server is running and you have\n", - "\tpermissions, then retry.\n"); - exit 10; -} - -# -# Main loop; leave this untouched, put tests into the loop -# -while (Testing()) { - # Check if the server is awake. - $dbh = undef; - Test($state or ($dbh = DBI->connect($test_dsn, $test_user, - $test_password))) - or ServerError(); - - Test($state or (@dsn = DBI->data_sources($mdriver, {user=> $test_user, password=> $test_password})) >= 0); - if (!$state) { - my $d; - print "List of $mdriver data sources:\n"; - foreach $d (@dsn) { - print " $d\n"; - } - print "List ends.\n"; - } - Test($state or $dbh->disconnect()); - - # - # Try different DSN's - # - my(@dsnList); - if (($mdriver eq 'mysql' or $mdriver eq 'mysqlEmb') - and $test_dsn eq "DBI:$mdriver:test") { - @dsnList = ("DBI:$mdriver:test:localhost", - "DBI:$mdriver:test;localhost", - "DBI:$mdriver:database=test;host=localhost"); - } - my($dsn); - foreach $dsn (@dsnList) { - Test($state or ($dbh = DBI->connect($dsn, $test_user, - $test_password))) - or print "Cannot connect to DSN $dsn: ${DBI::errstr}\n"; - Test($state or $dbh->disconnect()); - } -} - -exit 0; - -# Hate -w :-) -$test_dsn = $test_user = $test_password = $DBI::errstr; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/20createdrop.t new/DBD-mysql-4.004/t/20createdrop.t --- old/DBD-mysql-4.002/t/20createdrop.t 2007-03-01 16:47:26.000000000 +0100 +++ new/DBD-mysql-4.004/t/20createdrop.t 2007-03-20 14:02:28.000000000 +0100 @@ -1,86 +1,32 @@ -#!/usr/local/bin/perl -# -# $Id: 20createdrop.t 9183 2007-03-01 15:47:39Z capttofu $ -# -# This is a skeleton test. For writing new tests, take this file -# and modify/extend it. -# +#!perl -w +# vim: ft=perl +use Test::More tests => 4; +use DBI; +use DBI::Const::GetInfoType; use strict; -use vars qw($test_dsn $test_user $test_password $mdriver $dbdriver); -use DBI (); +$|= 1; -# -# Include lib.pl -# -$mdriver = ""; -my $file; -foreach $file ("lib.pl", "t/lib.pl") { - do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n"; - exit 10; - } - if ($mdriver ne '') { - last; - } -} - -sub ServerError() { - print STDERR ("Cannot connect: ", $DBI::errstr, "\n", - "\tEither your server is not up and running or you have no\n", - "\tpermissions for acessing the DSN $test_dsn.\n", - "\tThis test requires a running server and write permissions.\n", - "\tPlease make sure your server is running and you have\n", - "\tpermissions, then retry.\n"); +my $mdriver= ""; +our ($test_dsn, $test_user, $test_password); +foreach my $file ("lib.pl", "t/lib.pl") { + do $file; + if ($@) { + print STDERR "Error while executing $file: $@\n"; exit 10; + } + last if $mdriver ne ''; } -# -# Main loop; leave this untouched, put tests into the loop -# -use vars qw($state); -while (Testing()) { - # - # Connect to the database - my $dbh; - Test($state or $dbh = DBI->connect($test_dsn, $test_user, $test_password)) - or ServerError(); - - # - # Find a possible new table name - # - my $table; - Test($state or $table = FindNewTable($dbh)) - or DbiError($dbh->err, $dbh->errstr); - - # - # Create a new table - # - my $def; - if (!$state) { - ($def = TableDefinition($table, - ["id", "INTEGER", 4, 0], - ["name", "CHAR", 64, 0])); - print "Creating table:\n$def\n"; - } - Test($state or $dbh->do($def)) - or DbiError($dbh->err, $dbh->errstr); - - - # - # ... and drop it. - # - Test($state or $dbh->do("DROP TABLE $table")) - or DbiError($dbh->err, $dbh->errstr); - - # - # ... check do() sets $dbh->{Statement} - # - Test($state or $dbh->{Statement} eq "DROP TABLE $table") - or DbiError(1, "do() didn't set Statement attribute"); - - # - # Finally disconnect. - # - Test($state or $dbh->disconnect()) - or DbiError($dbh->err, $dbh->errstr); -} +my $dbh= DBI->connect($test_dsn, $test_user, $test_password, + { RaiseError => 1, PrintError => 1, AutoCommit => 0 }); +ok(defined $dbh, "Connected to database"); + +ok($dbh->do(qq{DROP TABLE IF EXISTS t1}), "making slate clean"); + +ok($dbh->do(qq{CREATE TABLE t1 (id INT(4), name VARCHAR(64))}), "creating table"); + +ok($dbh->do(qq{DROP TABLE t1}), "dropping created table"); + +$dbh->disconnect(); + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/30insertfetch.t new/DBD-mysql-4.004/t/30insertfetch.t --- old/DBD-mysql-4.002/t/30insertfetch.t 2006-12-23 19:03:30.000000000 +0100 +++ new/DBD-mysql-4.004/t/30insertfetch.t 2007-03-22 18:06:12.000000000 +0100 @@ -1,110 +1,45 @@ -#!/usr/local/bin/perl -# -# $Id: 30insertfetch.t 8435 2006-12-23 19:03:49Z capttofu $ -# -# This is a simple insert/fetch test. -# -$^W = 1; - -# -# Make -w happy -# -$test_dsn = ''; -$test_user = ''; -$test_password = ''; - - -# -# Include lib.pl -# -use DBI; -$mdriver = ""; -foreach $file ("lib.pl", "t/lib.pl", "DBD-mysql/t/lib.pl") { - do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n"; - exit 10; - } - if ($mdriver ne '') { - last; - } -} +#!perl -w +# vim: ft=perl -sub ServerError() { - print STDERR ("Cannot connect: ", $DBI::errstr, "\n", - "\tEither your server is not up and running or you have no\n", - "\tpermissions for acessing the DSN $test_dsn.\n", - "\tThis test requires a running server and write permissions.\n", - "\tPlease make sure your server is running and you have\n", - "\tpermissions, then retry.\n"); +use Test::More tests => 9; +use DBI; +use DBI::Const::GetInfoType; +use strict; +$|= 1; + +my $mdriver= ""; +our ($test_dsn, $test_user, $test_password); +foreach my $file ("lib.pl", "t/lib.pl") { + do $file; + if ($@) { + print STDERR "Error while executing $file: $@\n"; exit 10; + } + last if $mdriver ne ''; } -# -# Main loop; leave this untouched, put tests after creating -# the new table. -# -while (Testing()) { - # - # Connect to the database - Test($state or $dbh = DBI->connect($test_dsn, $test_user, $test_password)) - or ServerError(); - #DBI->trace(2); - - # - # Find a possible new table name - # - Test($state or $table = FindNewTable($dbh)) - or DbiError($dbh->err, $dbh->errstr); - - # - # Create a new table; EDIT THIS! - # - Test($state or ($def = TableDefinition($table, - ["id", "INTEGER", 4, 0], - ["name", "CHAR", 64, 0]), - $dbh->do($def))) - or DbiError($dbh->err, $dbh->errstr); - - - # - # Insert a row into the test table....... - # - Test($state or $dbh->do("INSERT INTO $table" - . " VALUES(1, 'Alligator Descartes')")) - or DbiError($dbh->err, $dbh->errstr); - - # - # ...and delete it........ - # - Test($state or $dbh->do("DELETE FROM $table WHERE id = 1")) - or DbiError($dbh->err, $dbh->errstr); - - # - # Now, try SELECT'ing the row out. This should fail. - # - Test($state or $sth = $dbh->prepare("SELECT * FROM $table" - . " WHERE id = 1")) - or DbiError($dbh->err, $dbh->errstr); - - Test($state or $sth->execute) - or DbiError($sth->err, $sth->errstr); - - my ($row, $errstr); - Test($state or (!defined($row = $sth->fetchrow_arrayref) && - (!defined($errstr = $sth->errstr) || - $sth->errstr eq ''))) - or DbiError($sth->err, $sth->errstr); - - Test($state or $sth->finish, "\$sth->finish failed") - or DbiError($sth->err, $sth->errstr); - - Test($state or undef $sth || 1); - - - # - # Finally drop the test table. - # - Test($state or $dbh->do("DROP TABLE $table")) - or DbiError($dbh->err, $dbh->errstr); +my $dbh= DBI->connect($test_dsn, $test_user, $test_password, + { RaiseError => 1, PrintError => 1, AutoCommit => 0 }); +ok(defined $dbh, "Connected to database"); + +ok($dbh->do(qq{DROP TABLE IF EXISTS t1}), "making slate clean"); + +ok($dbh->do(qq{CREATE TABLE t1 (id INT(4), name VARCHAR(64))}), "creating table"); + +ok($dbh->do("INSERT INTO t1 VALUES(1, 'Alligator Descartes')"), "loading data"); + +ok($dbh->do("DELETE FROM t1 WHERE id = 1"), "deleting from table t1"); + +my $sth= $dbh->prepare("SELECT * FROM t1 WHERE id = 1"); + +ok($sth->execute()); + +ok(not $sth->fetchrow_arrayref()); + +ok($sth->finish()); + +ok($dbh->do("DROP TABLE t1"),"Dropping table"); + +$dbh->disconnect(); -} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/35limit.t new/DBD-mysql-4.004/t/35limit.t --- old/DBD-mysql-4.002/t/35limit.t 2006-12-23 19:03:30.000000000 +0100 +++ new/DBD-mysql-4.004/t/35limit.t 2007-03-22 23:16:08.000000000 +0100 @@ -1,131 +1,73 @@ -#!/usr/local/bin/perl -# -# $Id: 35limit.t 8435 2006-12-23 19:03:49Z capttofu $ -# -# This is a simple insert/fetch test. -# -$^W = 1; - -# -# Make -w happy -# -$test_dsn = ''; -$test_user = ''; -$test_password = ''; - +#!perl -w +# vim: ft=perl -# -# Include lib.pl -# +use Test::More tests => 111; use DBI; -use Carp qw(croak); -$mdriver = ""; -foreach $file ("lib.pl", "t/lib.pl", "DBD-mysql/t/lib.pl") { - do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n"; - exit 10; - } - if ($mdriver ne '') { - last; - } +use DBI::Const::GetInfoType; +use strict; +$|= 1; + +my $rows = 0; +my $sth; +my $testInsertVals; +our ($test_dsn, $test_user, $test_password, $mdriver); +$mdriver=''; +foreach my $file ("lib.pl", "t/lib.pl") { + do $file; + if ($@) { + print STDERR "Error while executing $file: $@\n"; + exit 10; + } + last if $mdriver ne ''; } -sub ServerError() { - print STDERR ("Cannot connect: ", $DBI::errstr, "\n", - "\tEither your server is not up and running or you have no\n", - "\tpermissions for acessing the DSN $test_dsn.\n", - "\tThis test requires a running server and write permissions.\n", - "\tPlease make sure your server is running and you have\n", - "\tpermissions, then retry.\n"); - exit 10; +my $dbh= DBI->connect($test_dsn, $test_user, $test_password, + { RaiseError => 1, PrintError => 1, AutoCommit => 0 }); +ok(defined $dbh, "Connected to database"); + +ok($dbh->do(qq{DROP TABLE IF EXISTS t1}), "making slate clean"); + +ok($dbh->do(qq{CREATE TABLE t1 (id INT(4), name VARCHAR(64))}), "creating table"); + +ok(($sth = $dbh->prepare("INSERT INTO t1 VALUES (?,?)"))); + +print "PERL testing insertion of values from previous prepare of insert statement:\n"; +for (my $i = 0 ; $i < 100; $i++) { + my @chars = grep !/[0O1Iil]/, 0..9, 'A'..'Z', 'a'..'z'; + my $random_chars = join '', map { $chars[rand @chars] } 0 .. 16; +# save these values for later testing + $testInsertVals->{$i} = $random_chars; + ok(($rows = $sth->execute($i, $random_chars))); } +print "PERL rows : " . $rows . "\n"; + +#print "PERL testing prepare of select statement with INT and VARCHAR placeholders:\n"; +#ok(($sth = $dbh->prepare("SELECT * FROM t1 WHERE id = ? AND name = ?"))); + +#for my $id (keys %$testInsertVals) { +# print "id $id value $testInsertVals->{$id}\n"; +# $sth->execute($id, $testInsertVals->{$id}); +#} + +print "PERL testing prepare of select statement with LIMIT placeholders:\n"; +ok($sth = $dbh->prepare("SELECT * FROM t1 LIMIT ?, ?")); + +print "PERL testing exec of bind vars for LIMIT\n"; +ok($sth->execute(20, 50)); + +my ($row, $errstr, $array_ref); +ok( (defined($array_ref = $sth->fetchall_arrayref) && + (!defined($errstr = $sth->errstr) || $sth->errstr eq ''))); + +ok(@$array_ref == 50); + +ok($sth->finish); # -# Main loop; leave this untouched, put tests after creating -# the new table. +# Finally drop the test table. # -while (Testing()) { - my $testInsertVals = {}; - # - # Connect to the database - Test($state or $dbh = DBI->connect($test_dsn, $test_user, $test_password)) - or ServerError(); - - #Test($state or $dbh->trace("3", "/tmp/trace.log")) or DbiError($dbh->err, $dbh->errstr); - # - # Find a possible new table name - # - #Test($state or $table = FindNewTable($dbh)) - # or DbiError($dbh->err, $dbh->errstr); - $table = 'prepare_test'; - - Test($state or ($dbh->do("DROP TABLE IF EXISTS $table")) or DbiError($dbh->err, $dbh->errstr)); - # - # Create a new table; EDIT THIS! - # - Test($state or ($def = TableDefinition($table, - ["id", "INTEGER", 4, 0], - ["name", "CHAR", 64, 0]), - $dbh->do($def))) - or DbiError($dbh->err, $dbh->errstr); - - - print "PERL testing prepare of insert statement:\n"; - Test($state or $sth = $dbh->prepare("INSERT INTO $table VALUES (?,?)")) - or DbiError($dbh->err, $dbh->errstr); - - print "PERL testing insertion of values from previous prepare of insert statement:\n"; - my $rows = 0; - for (my $i = 0 ; $i < 100; $i++) { - my @chars = grep !/[0O1Iil]/, 0..9, 'A'..'Z', 'a'..'z'; - my $random_chars = join '', map { $chars[rand @chars] } 0 .. 16; - # save these values for later testing - $testInsertVals->{$i} = $random_chars; - Test( - $state or - $rows = $sth->execute($i, $random_chars) - ) or - DbiError($dbh->err, $dbh->errstr); - - } - print "PERL rows : " . $rows . "\n"; - - print "PERL testing prepare of select statement with INT and VARCHAR placeholders:\n"; - Test($state or $sth = $dbh->prepare("SELECT * FROM $table WHERE id = ? AND name = ?")) - or DbiError($dbh->err, $dbh->errstr); - - for my $id (keys %$testVals) { - Test($state or $sth->execute($id, $testVals->{$id})) - or DbiError($sth->err, $sth->errstr); - } - - print "PERL testing prepare of select statement with LIMIT placeholders:\n"; - Test($state or $sth = $dbh->prepare("SELECT * FROM $table LIMIT ?, ?")) - or DbiError($dbh->err, $dbh->errstr); - - print "PERL testing exec of bind vars for LIMIT\n"; - Test($state or $sth->execute(20, 50)) - or DbiError($sth->err, $sth->errstr); - - my ($row, $errstr, $array_ref); - Test( - $state or - (defined($array_ref = $sth->fetchall_arrayref) && - (!defined($errstr = $sth->errstr) || $sth->errstr eq ''))) - or DbiError($sth->err, $sth->errstr); - - Test ($state or @$array_ref == 50) or print "results not equaling 50\n"; - - Test($state or $sth->finish, "\$sth->finish failed") - or DbiError($sth->err, $sth->errstr); - - Test($state or undef $sth || 1); - - - # - # Finally drop the test table. - # - Test($state or $dbh->do("DROP TABLE $table")) or DbiError($dbh->err, $dbh->errstr); +ok($dbh->do("DROP TABLE t1")); + +ok($dbh->disconnect); - Test($state or $dbh->disconnect) or DBiError($dbh->err, $dbh-errstr); -} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/40catalog.t new/DBD-mysql-4.004/t/40catalog.t --- old/DBD-mysql-4.002/t/40catalog.t 2007-03-02 04:25:49.000000000 +0100 +++ new/DBD-mysql-4.004/t/40catalog.t 2007-03-20 02:02:48.000000000 +0100 @@ -4,6 +4,7 @@ use Data::Dumper; use Test::More; use DBI; +use DBI::Const::GetInfoType; use strict; $|= 1; @@ -22,7 +23,7 @@ my $dbh= DBI->connect($test_dsn, $test_user, $test_password, { RaiseError => 1, PrintError => 1, AutoCommit => 0 }); -plan tests => 75; +plan tests => 77; ok(defined $dbh, "connecting"); @@ -89,6 +90,9 @@ # the server we are using for testing. # SKIP: { + skip "Server can't handle tricky table names", 33 + if $dbh->get_info($GetInfoType{SQL_DBMS_VER}) lt "4.1"; + my $sth = $dbh->table_info("%", undef, undef, undef); is(scalar @{$sth->fetchall_arrayref()}, 0, "No catalogs expected"); @@ -205,6 +209,8 @@ # Try without any table type specified $sth = $dbh->table_info(undef, undef, "bug26603%"); my $info = $sth->fetchall_arrayref({}); + is($info->[0]->{TABLE_NAME}, "bug26603_t1"); + is($info->[0]->{TABLE_TYPE}, "TABLE"); is($info->[1]->{TABLE_NAME}, "bug26603_v1"); is($info->[1]->{TABLE_TYPE}, "VIEW"); is(scalar @$info, 2, "two rows expected"); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/41bindparam.t new/DBD-mysql-4.004/t/41bindparam.t --- old/DBD-mysql-4.002/t/41bindparam.t 2006-12-23 18:54:54.000000000 +0100 +++ new/DBD-mysql-4.004/t/41bindparam.t 2007-03-20 02:02:48.000000000 +0100 @@ -48,7 +48,7 @@ DbiError($dbh->err, $dbh->errstr); Test($state or - $dbh->do("create table $table (a int, primary key (a))")) or + $dbh->do("create table $table (a int not null, primary key (a))")) or DbiError($dbh->err, $dbh->errstr); Test($state or diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/42bindparam.t new/DBD-mysql-4.004/t/42bindparam.t --- old/DBD-mysql-4.002/t/42bindparam.t 2007-01-06 15:51:00.000000000 +0100 +++ new/DBD-mysql-4.004/t/42bindparam.t 2007-03-20 02:02:48.000000000 +0100 @@ -45,7 +45,7 @@ DbiError($dbh->err, $dbh->errstr); Test($state or - $dbh->do("create table $table (a int, b double, primary key (a))")) or + $dbh->do("create table $table (a int not null, b double, primary key (a))")) or DbiError($dbh->err, $dbh->errstr); Test($state or diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/multi_statement.t new/DBD-mysql-4.004/t/multi_statement.t --- old/DBD-mysql-4.002/t/multi_statement.t 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-mysql-4.004/t/multi_statement.t 2007-03-22 20:23:55.000000000 +0100 @@ -0,0 +1,49 @@ +#!perl -w +# vim: ft=perl + +use Test::More tests => 7; +use DBI; +use DBI::Const::GetInfoType; +use strict; +$|= 1; + +my $mdriver= ""; +our ($test_dsn, $test_user, $test_password); +foreach my $file ("lib.pl", "t/lib.pl") { + do $file; + if ($@) { + print STDERR "Error while executing $file: $@\n"; + exit 10; + } + last if $mdriver ne ''; +} + +my $dbh= DBI->connect($test_dsn, $test_user, $test_password, + { RaiseError => 1, PrintError => 1, AutoCommit => 0, + mysql_multi_statements => 1 }); +ok(defined $dbh, "Connected to database with multi statement support"); + +$dbh->{mysql_server_prepare}= 0; + +SKIP: { + skip "Server doesn't support multi statements", 6 + if $dbh->get_info($GetInfoType{SQL_DBMS_VER}) lt "4.1"; + + ok($dbh->do("DROP TABLE IF EXISTS t1"), "clean up"); + ok($dbh->do("CREATE TABLE t1 (a INT)"), "create table"); + + ok($dbh->do("INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2);")); + + $dbh->disconnect(); + + $dbh= DBI->connect($test_dsn, $test_user, $test_password, + { RaiseError => 0, PrintError => 0, AutoCommit => 0, + mysql_multi_statements => 0 }); + ok(defined $dbh, "Connected to database without multi statement support"); + + ok(not $dbh->do("INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2);")); + + ok($dbh->do("DROP TABLE IF EXISTS t1"), "clean up"); +}; + +$dbh->disconnect(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/DBD-mysql-4.002/t/utf8.t new/DBD-mysql-4.004/t/utf8.t --- old/DBD-mysql-4.002/t/utf8.t 2007-01-06 20:07:23.000000000 +0100 +++ new/DBD-mysql-4.004/t/utf8.t 2007-03-20 02:24:13.000000000 +0100 @@ -102,7 +102,7 @@ # Create a new table; In an ideal world, it'd be more sensible to # make the whole database UTF8... # - $query = "CREATE TABLE $table (name VARCHAR(64) CHARACTER SET utf8, bincol BLOB, shape GEOMETRY)"; + $query = "CREATE TABLE $table (name VARCHAR(64) CHARACTER SET utf8, bincol BLOB, shape GEOMETRY, binutf VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin)"; Test($state or $dbh->do($query)) or ErrMsgF("Cannot create table: Error %s.\n", $dbh->errstr); @@ -126,11 +126,11 @@ Test( $state or ( $dbh->{ mysql_enable_utf8 } ) ) or ErrMsg( "mysql_enable_utf8 didn't survive connect()\n" ); - $query = qq{INSERT INTO $table (name, bincol, shape) VALUES (?,?, GeomFromText('Point(132865 501937)'))}; - Test( $state or $dbh->do( $query, {}, $utf8_str,$blob ) ) + $query = qq{INSERT INTO $table (name, bincol, shape, binutf) VALUES (?,?, GeomFromText('Point(132865 501937)'), ?)}; + Test( $state or $dbh->do( $query, {}, $utf8_str,$blob, $utf8_str ) ) or ErrMsgF( "INSERT failed: query $query, error %s.\n", $dbh->errstr ); - $query = "SELECT name,bincol,asbinary(shape) FROM $table LIMIT 1"; + $query = "SELECT name,bincol,asbinary(shape), binutf FROM $table LIMIT 1"; Test( $state or ($sth = $dbh->prepare( $query ) ) ) or ErrMsgF( "prepare failed: query $query, error %s.\n", $dbh->errstr ); @@ -143,7 +143,14 @@ # Finally, check that we got back UTF-8 correctly. Test( $state or ($ref->[0] eq $utf8_str) ) - or ErrMsgF( "got back '$ref->[0]' instead of '$utf8_str'.\n" ); + or ErrMsgF( "got back '$ref->[0]' instead of '$utf8_str' (normal utf8 collation).\n" ); + + # same as above for utf8_bin column + Test( $state or ($ref->[3] eq $utf8_str) ) + or ErrMsgF( "got back '$ref->[3]' instead of '$utf8_str' (binary utf8 collation).\n" ); + + + if (eval "use Encode;") { # Check for utf8 flag ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de