List:Commits« Previous MessageNext Message »
From:jimw Date:December 28 2006 11:35pm
Subject:[svn:DBD-mysql] r8487 - in DBD-mysql/trunk: . lib/DBD t
View as plain text  
Author: jimw
Date: Thu Dec 28 15:35:52 2006
New Revision: 8487

Modified:
   DBD-mysql/trunk/ChangeLog
   DBD-mysql/trunk/lib/DBD/mysql.pm
   DBD-mysql/trunk/t/40listfields.t

Log:
Return a statement handle with an error when column_info is called on
a table that does not exist. (Bug #23974, patch by Philip Stoev)


Modified: DBD-mysql/trunk/ChangeLog
==============================================================================
--- DBD-mysql/trunk/ChangeLog	(original)
+++ DBD-mysql/trunk/ChangeLog	Thu Dec 28 15:35:52 2006
@@ -1,4 +1,6 @@
 <unreleased> Jim Winstead <jimw@stripped> (4.01)
+* Return a statement handle with an error when column_info is called on
+  a table that does not exist. (Bug #23974, patch by Philip Stoev)
 * Fix handling of table names with characters that did not match /\w/ in
   the column_info method. (Bug #22005, reported by Philip Stoev)
 * Fix handling of negative integers bound to a column marked as SQL_INTEGER.

Modified: DBD-mysql/trunk/lib/DBD/mysql.pm
==============================================================================
--- DBD-mysql/trunk/lib/DBD/mysql.pm	(original)
+++ DBD-mysql/trunk/lib/DBD/mysql.pm	Thu Dec 28 15:35:52 2006
@@ -318,6 +318,9 @@
     local $dbh->{FetchHashKeyName} = 'NAME_lc';
     my $desc_sth = $dbh->prepare("DESCRIBE $table_id");
     my $desc = $dbh->selectall_arrayref($desc_sth, { Columns=>{} });
+
+    return $desc_sth if $desc_sth->err();
+
     my $ordinal_pos = 0;
     foreach my $row (@$desc) {
 	my $type = $row->{type};

Modified: DBD-mysql/trunk/t/40listfields.t
==============================================================================
--- DBD-mysql/trunk/t/40listfields.t	(original)
+++ DBD-mysql/trunk/t/40listfields.t	Thu Dec 28 15:35:52 2006
@@ -62,6 +62,7 @@
     # http://bugs.mysql.com/22005
     #  
     $table= 't1$special';
+    $state or $dbh->do("DROP TABLE IF EXISTS `$table`" );
 
     #
     #   Create a new table
@@ -73,6 +74,16 @@
     Test($state or $dbh->table_info(undef,undef,$table));
     Test($state or $dbh->column_info(undef,undef,$table,'%'));
 
+    #
+    # Bug #23974: column_info does not return error when table does not exist
+    #
+    {
+     local $dbh->{PrintError}= 0;
+      Test($state or
+           ($sth= $dbh->column_info(undef,undef,"this_does_not_exist",'%')));
+      Test($sth and $sth->err());
+    }
+
     Test($state or $sth = $dbh->prepare("SELECT * FROM $table"))
 	   or DbiError($dbh->err, $dbh->errstr);
 
Thread
[svn:DBD-mysql] r8487 - in DBD-mysql/trunk: . lib/DBD tjimw28 Dec