Author: jimw
Date: Mon Jan 8 17:29:56 2007
New Revision: 8527
Modified:
DBD-mysql/trunk/t/40types.t
Log:
Fix (and simplify) version check in t/40types.t
Modified: DBD-mysql/trunk/t/40types.t
==============================================================================
--- DBD-mysql/trunk/t/40types.t (original)
+++ DBD-mysql/trunk/t/40types.t Mon Jan 8 17:29:56 2007
@@ -7,7 +7,6 @@
$|= 1;
my $mdriver= "";
-my $new_data_types_version= 0;
our ($test_dsn, $test_user, $test_password);
foreach my $file ("lib.pl", "t/lib.pl") {
@@ -21,37 +20,14 @@
my $dbh= DBI->connect($test_dsn, $test_user, $test_password,
{ RaiseError => 1, PrintError => 1, AutoCommit => 0 });
-$dbh = DBI->connect($test_dsn, $test_user, $test_password,
- { RaiseError => 1, AutoCommit => 1}) or ServerError() ;
-my $sth= $dbh->prepare("select version()") or
- DbiError($dbh->err, $dbh->errstr);
+my ($version)= $dbh->selectrow_array("SELECT version()")
+ or DbiError($dbh->err, $dbh->errstr);
-$sth->execute() or
- DbiError($dbh->err, $dbh->errstr);
+plan skip_all => "New data types not supported by server ($version)"
+ if (substr($version, 0, 1) < 5);
-my $row= $sth->fetchrow_arrayref() or
- DbiError($dbh->err, $dbh->errstr);
-
-#
-# DROP/CREATE PROCEDURE will give syntax error
-# for these versions
-#
-if ($row->[0] =~ /^5/)
-{
- $new_data_types_version= 1;
-}
-$sth->finish();
-$dbh->disconnect();
-
-if( !$new_data_types_version)
-{
- plan skip_all => "New data types not supported in version $row->[0], skipping";
-}
-else
-{
- plan tests => 20;
-}
+plan tests => 20;
ok(defined $dbh, "connecting");
@@ -59,7 +35,7 @@
ok($dbh->do(qq{CREATE TABLE t1 (d DECIMAL(5,2))}), "creating table");
-$sth= $dbh->prepare("SELECT * FROM t1 WHERE 1 = 0");
+my $sth= $dbh->prepare("SELECT * FROM t1 WHERE 1 = 0");
ok($sth->execute(), "getting table information");
is_deeply($sth->{TYPE}, [ 3 ], "checking column type");
| Thread |
|---|
| • [svn:DBD-mysql] r8527 - DBD-mysql/trunk/t | jimw | 9 Jan |