From:             uwendel at mysql dot com
Operating system: Linux
PHP version:      5.3CVS-2008-02-19 (CVS)
PHP Bug Type:     PDO related
Bug description:  Limitations of emulated PS / PDO::prepare() docs are wrong

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:
---------------
[EMAIL PROTECTED]:~/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"
}
[EMAIL PROTECTED]:~/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"
}
[EMAIL PROTECTED]:~/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 bug report at http://bugs.php.net/?id=44169&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44169&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44169&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44169&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44169&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44169&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44169&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44169&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44169&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44169&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44169&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44169&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44169&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44169&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44169&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44169&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44169&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44169&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44169&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44169&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44169&r=mysqlcfg

Reply via email to