Doc #66704 [Opn->Csd]: Small update needs to be made to the manual page

From: Date: Mon, 09 Aug 2021 11:16:28 +0000
Subject: Doc #66704 [Opn->Csd]: Small update needs to be made to the manual page
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19053@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66704&edit=1 ID: 66704 Updated by: cmb@php.net Reported by: php_bugs at multiwebinc dot com Summary: Small update needs to be made to the manual page -Status: Open +Status: Closed Type: Documentation Problem Package: PDO related PHP Version: 5.6Git-2014-02-12 (Git) -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This has recently been fixed; the docs[1] now state: | Prepares and executes an SQL statement without placeholders [1] <https://www.php.net/pdo.query> Previous Comments: ------------------------------------------------------------------------ [2014-02-12 23:21:35] php_bugs at multiwebinc dot com Description: ------------ --- From manual page: http://www.php.net/pdo.query --- From the PDO::query() and PDO::exec() manual pages it looks like they do exactly the same thing with the only difference being the return value, however reviewing the PHP source code, it appears that there is a subtle difference that I feel should be noted. Since PDO::query() internally does a prepare() followed by an execute(), this means that the queries allowed must only contain syntax that is listed in the list of "SQL Syntax Allowed in Prepared Statements" (http://dev.mysql.com/doc/refman/5.6/en/sql-syntax-prepared-statements.html#idm46981480871472) or else you get something like: "SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet" Test script: --------------- <?php // Note "USE" is not permitted in prepared statements (see the URL above) $dbh->query("USE db_name"); // Fails $dbh->exec("USE db_name"); // Works ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66704&edit=1

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