PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #6710

tableInfo() always returns field length 0 when using mysqli driver

Details

Submitted2006-02-06 21:38 UTC
Fromgeeksam at gmail dot com
StatusDuplicate
PackageDB
PHP Version5.0.4
OSLinux (kernel 2.4)
Roadmaps(Not assigned)

Comments

[2006-02-06 21:38 UTC] geeksam at gmail dot com

Description:
------------
Field lengths returned by DB::tableInfo() are always zero when using the mysqli driver. (See attached script.)

I'm not sure how to find some of the other requested helpful info. I'm using shared Linux hosting at dreamhost (.com). If more detail is needed, email me.

Test script:
---------------
<?
require_once('DB.php');

// Connect using mysql
$dsn = 'mysql://user:pass@dbhost.example.com/dbname';
$dbWithCorrectBehavior =& DB::connect($dsn);

// Connect using mysqli
$dsn = 'mysqli://user:pass@dbhost.example.com/dbname';
$dbWithBug =& DB::connect($dsn);

// Create a demo table
$sql = "drop table if exists `demo`;\n";
$sql .= "CREATE TABLE `demo` (`id` int(11) default NULL, `foo` varchar(10) default NULL, `bar` varchar(20) default NULL);";
$dbWithCorrectBehavior->query($sql);

// Output tableInfo on the demo table using both drivers
$info = print_r($dbWithCorrectBehavior->tableInfo('demo'), true);
echo "<p>Right metadata (using mysql driver):</p>";
echo "<pre>$info</pre>";

echo "<p>Wrong metadata (using mysqli driver):</p>";
$info = print_r($dbWithBug->tableInfo('demo'), true);
echo "<pre>$info</pre>";

?>

Expected result:
----------------
The two printed arrays should be identical.

Actual result:
--------------
The array returned using mysqli has "[len] => 0" for all columns in the demo table.

(As I look at the output, I also see that the 'id' field has "[flags] => group_by" when using the mysqli driver. This is also odd, but not what I care about.)