PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #1307

Allow tableInfo to accept also the db name

Details

Request #1307Allow tableInfo to accept also the db name
Submitted2004-04-28 15:06 UTC
Fromtricera_it at yahoo dot it
Assigneddanielc
StatusBogus
PackageDB
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2004-04-28 15:06 UTC] tricera_it at yahoo dot it

Description:
------------
As you explane with Example 22-1 it is possible finding info about a table simply passing the table name:

<?php
// Once you have a valid DB object named $db...
$info = $db->tableInfo('tablename');
print_r($info);
?>

but if you don't specify a valid db into the DSN string and you try with:

<?php
// Once you have a valid DB object named $db...
$info = $db->tableInfo('dbname.tablename');
print_r($info);
?>

you will get an error.

[2004-06-25 21:56 UTC] tricera_it at yahoo dot it

Sorry for the delay.
I'm using MySQL and msSQl. About Pear DB I'm using the last one (1.6.4).

[2004-06-28 08:55 UTC] tricera_it at yahoo dot it

I've solved replacing:
$id = @mysql_list_fields($this->dsn['database'], $result, $this->connection);

with:
$pos = strpos($result, ".");
if ($pos === false){
$id = @mysql_list_fields($this->dsn['database'],$result, $this->connection);
} else {
$id = @mysql_list_fields(substr($result, 0, $pos), substr($result, $pos+1), $this->connection);
}

So the function works passing both db_name.table_name and just table_name.

This is valid for mysql and mssql. I don't know with other DBs.