Home » Database » DB » Bug #1307
Allow tableInfo to accept also the db name
Details
| Request #1307 | Allow tableInfo to accept also the db name |
|---|---|
| Submitted | 2004-04-28 15:06 UTC |
| From | tricera_it at yahoo dot it |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | Irrelevant |
| OS | Linux |
| 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.