#43775 [Opn->Bgs]: PDO can't handle prepared SHOW TABLES statements
| From: | johannes@php.net | Date: | Mon, 07 Jan 2008 10:31:36 +0000 |
| Subject: | #43775 [Opn->Bgs]: PDO can't handle prepared SHOW TABLES statements | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121096@lists.php.net to get a copy of this message | ||
ID: 43775
Updated by: johannes@php.net
Reported By: adrianamustdie at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: openSuSE 10.3
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
That's a limitation inside MySQL. But you can use a query like
SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA =
'?'
instead.
Previous Comments:
------------------------------------------------------------------------
[2008-01-07 03:52:15] adrianamustdie at yahoo dot com
Description:
------------
a prepared statement used in a class.
$this->mysql == mysql connection
$database == name of the database
Reproduce code:
---------------
example #1 (work):
$stmt = $this->mysql->prepare("SHOW TABLES FROM ".$database);
$stmt->execute();
example #2 (don't work):
$stmt = $this->mysql->prepare("SHOW TABLES FROM ?");
$stmt->execute(array($database));
Expected result:
----------------
both examples should work!
Actual result:
--------------
error: 42000 1064 You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near ''databasename'' at line 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43775&edit=1