Bug #14309 $dbh->column_info
Submitted: 25 Oct 2005 22:58 Modified: 10 Jan 2006 2:26
Reporter: Daniel Kasak (Candidate Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S2 (Serious)
Version:3.0002_p3 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[25 Oct 2005 22:58] Daniel Kasak
Description:
$dbh->column_info is defective in this release. When asked for info on *all* columns, I get only 1 or 2.

How to repeat:
Install DBD::mysql-3.0002_p3 on client. Install MySQL-4.0.14 on server. Choose a table with a decent number of columns, and do:

---

$sth = $self->{dbh}->column_info ( undef, undef, $some_table, '%' );

while ( my $column_info_row = $sth->fetchrow_hashref ) {
   print $column_info_row->{COLUMN_NAME} . " is a " . $column_info_row->{TYPE_NAME} . "\n";
}

---

Under DBD::mysql-2.9007, I get a record per field in the table.
Under DBD::mysql-3.0002_p3, I only get a couple of records and then it bails out.
[3 Nov 2005 15:49] Valeriy Kravchuk
Thank you for a problem report. Sorry, but I was not able to repeat it using the following simple script:

use DBI;
$dsn = "DBI:mysql:database=mysql;host=localhost;port=3306";
$dbh = DBI->connect($dsn, 'root', '', { RaiseError => 1, AutoCommit => 0 });
$some_table = 'user';
$sth = $dbh->column_info ( undef, undef, $some_table, '%' );
while ( my $column_info_row = $sth->fetchrow_hashref ) {
   print $column_info_row->{COLUMN_NAME} . " is a " .
$column_info_row->{TYPE_NAME} . "\n";
}
$dbh->disconnect;

I put it in the 14309.pl file and performed the following (connecting to the latest 4.1.16-BK build of MySQL server):

[openxs@Fedora 4.1]$ perl -w 14309.pl
Shutdown_priv is a ENUM
Password is a VARCHAR
Repl_client_priv is a ENUM
ssl_cipher is a BLOB
Lock_tables_priv is a ENUM
Process_priv is a ENUM
Reload_priv is a ENUM
User is a VARCHAR
Execute_priv is a ENUM
Select_priv is a ENUM
max_questions is a INT
Host is a VARCHAR
Delete_priv is a ENUM
Create_tmp_table_priv is a ENUM
Update_priv is a ENUM
max_connections is a INT
ssl_type is a ENUM
Super_priv is a ENUM
x509_issuer is a BLOB
File_priv is a ENUM
Alter_priv is a ENUM
Grant_priv is a ENUM
References_priv is a ENUM
Drop_priv is a ENUM
max_updates is a INT
x509_subject is a BLOB
Insert_priv is a ENUM
Repl_slave_priv is a ENUM
Create_priv is a ENUM
Show_db_priv is a ENUM
Index_priv is a ENUM
[openxs@Fedora 4.1]$ uname -a
Linux Fedora 2.4.22-1.2115.nptl #1 Wed Oct 29 15:42:51 EST 2003 i686 i686 i386 GNU/Linux
[openxs@Fedora 4.1]$ perl -v

This is perl, v5.8.1 built for i386-linux-thread-multi
...

I used DBD-mysql-3.0002_3.tar.gz, compiled and installed as usual on this machine, with libraries from this server version.
[6 Jan 2006 5:03] Daniel Kasak
I can certainly repeat it. I'm attaching a 'create table' command for one of the tables this is happening to - though I'm pretty sure it's happening to all tables.

DBD::mysql is version 3.0002_p4, built against mysql-5.0.18.

Using the above script, I get the following output under DBD::mysql-3.0002_p4:

---

TelecomSpend is a MEDIUMINT
Address is a VARCHAR
BusinessTypeID is a SMALLINT
ElectricitySpend is a MEDIUMINT
State is a CHAR
GasSpend is a MEDIUMINT
PostCode is a SMALLINT
Suburb is a VARCHAR
Client is a VARCHAR
LeadNo is a MEDIUMINT

---

However reverting to DBD::mysql-2.9007 ( also built against mysql-5.0.18 ), I get the correct output:

---

TelecomSpend is a MEDIUMINT
TelecomSupplier is a SMALLINT
DateEntered is a DATE
Locations is a SMALLINT
Status is a SMALLINT
SubNo is a MEDIUMINT
Address is a VARCHAR
Archived is a DATE
DontCall is a DATETIME
TooSmall is a DATETIME
ElectricitySpend is a MEDIUMINT
State is a CHAR
Turnover is a BIGINT
GasSpend is a MEDIUMINT
FileNo is a MEDIUMINT
Suburb is a VARCHAR
Client is a VARCHAR
Region is a ENUM
BusinessDescription is a VARCHAR
ACN is a VARCHAR
Autonomous is a SMALLINT
Employees is a MEDIUMINT
FuelSpend is a MEDIUMINT
BusinessTypeID is a SMALLINT
EnteredBy is a MEDIUMINT
EnergySupplier is a SMALLINT
SignedBy is a MEDIUMINT
WebPage is a VARCHAR
PostCode is a SMALLINT
ParentID is a MEDIUMINT
LeadNo is a MEDIUMINT

---
[6 Jan 2006 5:04] Daniel Kasak
Table definition to test script with

Attachment: Prospects.sql (text/x-sql), 2.90 KiB.

[10 Jan 2006 2:26] Daniel Kasak
Should I submit a fresh bug report?