Doc #70120 [NEW]: PDO::prepare - First argument does not have to be a valid SQL statement

From: Date: Thu, 23 Jul 2015 21:01:59 +0000
Subject: Doc #70120 [NEW]: PDO::prepare - First argument does not have to be a valid SQL statement
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12547@lists.php.net to get a copy of this message
From: chealer at gmail dot com Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:PDO::prepare - First argument does not have to be a valid SQL statement Description: ------------ statement This must be a valid SQL statement for the target database server. --- From manual page: http://www.php.net/pdo.prepare --- In fact, as the text above explains, if parameters are used, the first argument must contain a string similar to a SQL statement, but which is not a valid SQL statement (for example, "SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?"). There is a terminological challenge here - perhaps "statement template" would appropriately describe what the argument actually contains. The text above is less misleading, but is also incorrect: The SQL statement can contain zero or more named (:name) or question mark (?) parameter markers for which real values will be substituted when the statement is executed. You cannot use both named and question mark parameter markers within the same SQL statement; pick one or the other parameter style. By the way, this does not specify what named parameter markers are, and the manual apparently never does that. Quite clearly, these start with a colon, but there is no specification of what constitutes a name. Visibly, names cannot contain a dot, although the error message leaves me wondering whether that is a bug ("PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 0 [Sybase][ODBC Driver][SQL Anywhere]L'expression près de ':?.nomdossier' est incorrecte", while the parameter marker I tried using is ":dossr.nomdossier"). -- Edit bug report at https://bugs.php.net/bug.php?id=70120&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70120&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70120&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70120&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70120&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70120&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70120&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70120&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70120&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70120&r=support Expected behavior: https://bugs.php.net/fix.php?id=70120&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70120&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70120&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70120&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70120&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70120&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70120&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70120&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70120&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70120&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70120&r=mysqlcfg

« previous php.doc.bugs (#12547) next »