#1211 [Bgs]: Site docs for Db:tableInfo error
| From: | js at nexista dot com | Date: | Tue, 20 Apr 2004 05:00:00 +0000 |
| Subject: | #1211 [Bgs]: Site docs for Db:tableInfo error | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-3659@lists.php.net to get a copy of this message | ||
ID: 1211
User updated by: js at nexista dot com
Reported By: js at nexista dot com
Status: Bogus
Bug Type: Documentation
PHP Version: Irrelevant
Assigned To: danielc
New Comment:
Small correction in what I said. That code never worked
but in older version I used $res->tableInfo() as you've
probably figured out I meant.
Joshua
Previous Comments:
------------------------------------------------------------------------
[2004-04-20 00:56:56] js at nexista dot com
Huh. I have mysql, php 4.3x, latest DB and no it doesn't
work. It worked before so mysql is not an issue.
Code:
include('pear/DB.php');
$db =& DB::connect('mysql://root:@localhost/dbname');
$res =& $db->query('SELECT * FROM clients');
$row =& $res->fetchRow();
$info = $db->tableInfo($res);
print_r($info);
prints zilch. It works if I use an older version of DB and
I can print the table info as:
$info = $db->tableInfo('clients');
Are you telling me that you can get this to work on mysql
with the RESULT object????? I'm checking once more before
I file this as a bug. I don't believe I have misunderstood
the syntax.
Thanks for your time
Joshua
------------------------------------------------------------------------
[2004-04-15 03:41:30] danielc at analysisandsolutions dot com
I pasted the example into my test script and it worked flawlessly.
Note, not all DBMS's support getting info from query results. If you
need further help, the pear-general mailing list is the best resource.
Thanks.
------------------------------------------------------------------------
[2004-04-14 19:12:56] js at nexista dot com
I did not have latest version. Now it doesn't work at all.
It still accepts a table name but passing a result object
returns nothing. reverting back to old version.
------------------------------------------------------------------------
[2004-04-14 15:58:26] danielc at analysisandsolutions dot com
The manual is correct for current versions of DB -- meaning including
1.6.0 and greater.
If I get a moment I'll add a note to the docs about this.
Thanks.
------------------------------------------------------------------------
[2004-04-14 14:20:28] js at nexista dot com
Description:
------------
The docs for Db::tableInfo may be wrong. On page:
http://pear.php.net/manual/en/package.database.db.intro-fetch.php
at the very bottom example we have:
// Once you have a valid DB object named $db...
$res =& $db->query('SELECT * FROM phptest');
print_r($db->tableInfo($res));
however this does not work. You can pass a table name or call
tableInfo as a method of result object but this above returned
nothing on Mysql. This did:
print_r($res->tableInfo());
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=1211&edit=1