#44169 [Opn->Csd]: Limitations of emulated PS / PDO::prepare() docs are wrong
| From: | vrana@php.net | Date: | Fri, 07 Nov 2008 11:47:04 +0000 |
| Subject: | #44169 [Opn->Csd]: Limitations of emulated PS / PDO::prepare() docs are wrong | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1430@lists.php.net to get a copy of this message | ||
ID: 44169
Updated by: vrana@php.net
Reported By: uwendel at mysql dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 5.3CVS-2008-02-19 (CVS)
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"Emulated prepared statements does not communicate with the database
server so PDO::prepare() does not check the statement."
Previous Comments:
------------------------------------------------------------------------
[2008-02-19 14:20:40] uwendel at mysql dot com
Description:
------------
PDO either uses native PS or its own PS emulation. The emulation has
its limits. I tend to say that the manual should be more open in respect
to this and discuss the limitations. I would like to see some
clearification of what is supported and what is not supported by the
emulated PS implemented in PDO. Any chance?
To give an example what I mean, let's "abuse" PDO::prepare() and show
that the manual comes a bit short. The manual says about
PDO::prepare():
"Return Values
If the database server successfully prepares the statement,
PDO->prepare() returns a PDOStatement object. If the database server
cannot successfully prepare the statement, PDO->prepare() returns
FALSE.", http://de.php.net/manual/en/function.PDO-prepare.php
Its wrong that the database server is involed during prepare.
It depends on the driver and the question wheter you use emulated or
native PS. With emulated PS, its likely that prepare() accepts an
invalid statement. The database server will not be used to check the
syntax of the statement. With native PS, its likely that prepare() will
fail to prepare an invalid statement, because the database server gets
contacted by prepare() and has a chance to check the statement.
As said, I don't know what to call this bug report: feature request,
documentation request, bug...
Reproduce code:
---------------
nixnutz@ulflinux:~/php53> sapi/cli/php -r '$pdo=new
PDO("mysql:dbname=phptest;unix_socket=/tmp/mysql.sock", "root",
"root");
var_dump($pdo->prepare("SELECT ice FROM artica AND antarctica"));'
object(PDOStatement)#2 (1) {
["queryString"]=>
string(37) "SELECT ice FROM artica AND antarctica"
}
nixnutz@ulflinux:~/php53> sapi/cli/php -r '$pdo=new
PDO("pgsql:host=localhost port=5432 dbname=phptest user=postgres
password="); var_dump($pdo->prepare("SELECT ice FROM artica AND
antarctica"));'
object(PDOStatement)#2 (1) {
["queryString"]=>
string(37) "SELECT ice FROM artica AND antarctica"
}
nixnutz@ulflinux:~/php53> sapi/cli/php -r '$pdo=new
PDO("sqlite:/tmp/foo.db"); var_dump($pdo->prepare("SELECT ice FROM
artica AND antarctica"));'
bool(false)
Expected result:
----------------
At least a hint in the documentation. Even better would be a full
documentation of how capable emulated prepared statements are in PDO.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44169&edit=1