ID: 40048 Updated by: [EMAIL PROTECTED] Reported By: bugs dot php dot net at andrewprendergast dot com -Status: Open +Status: Bogus Bug Type: PDO related Operating System: Linux Red Hat EL PHP Version: 5.2.1RC2 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. PDO does not implement query parsing it is entirely up to the database. So the features you are talking about would only work if supported by the underlying database. Previous Comments: ------------------------------------------------------------------------ [2007-01-07 13:35:55] bugs dot php dot net at andrewprendergast dot com Description: ------------ PDO doesn't allow one to SELECT or DELETE groups of records based on their primary key. Specifically, the SQL clauses WHERE ... IN (...) and WHERE ... = ANY (...) does not work for more than one record. As a workaround I can construct an SQL query and execute it myself but that defeats the niceness of PDO. Reproduce code: --------------- the following should return the records with ID 1 & 2: $dbh = new PDO('mysql:host=localhost;dbname=mobop', "root", ""); $stmt = $dbh->prepare("SELECT * FROM news_item WHERE news_item_id IN(?)"); if ( $stmt->execute(array("1, 2")) ) while ( ($row = $stmt->fetch()) ) print_r($row); But it doesn't. The following execute statement fails as well: $stmt->execute(array(array(2,1))) NB: The intention of the 2nd example is that when binding an array, it seems natural that PDO would assume its part of an IN or =ANY clause and convert it into a bunch of comma separated keys automagically. Some of the higher level PDO based O/R abstractions currently bouncing around like Doctrine would then be able to support (without any modificaiton) queries that affect multiple records. Expected result: ---------------- Two records should be loaded. Actual result: -------------- One record is loaded. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40048&edit=1