Edit report at http://bugs.php.net/bug.php?id=53657&edit=1
ID: 53657 Updated by: u...@php.net Reported by: schindhelm at gmail dot com Summary: Make at least PDOStatement::bindValue and PDOStatement::bindParam() chainable! Status: Wont fix Type: Feature/Change Request Package: *Database Functions Operating System: any PHP Version: 5.3.4 Block user comment: N Private report: N New Comment: Use: execute(array(values)) Previous Comments: ------------------------------------------------------------------------ [2011-01-06 03:01:38] ahar...@php.net The bind methods already have defined return values. I don't see any benefit to breaking backward compatibility for such a minor potential gain. ------------------------------------------------------------------------ [2011-01-05 19:33:25] schindhelm at gmail dot com Description: ------------ --- >From manual page: http://www.php.net/pdostatement.bindvalue --- The PDOStatement::bindValue and PDOStatement::bindParam methods should be chainable. Look at my test script below for an example. Test script: --------------- // create a new PDO $dbh = new PDO($dsn, $user, $pass); // the example SQL statement $sql = "INSERT INTO db.table (id, firstName, lastName) VALUES(NULL, :firstName, :lastName)"; $statement = $dbh->prepare($sql); // current behaviour $statement->bindValue(':firstName', 'Foo'); $statement->bindValue(':lastName', 'Bar'); // and so on... $statement->execute(); // what I wish for and what saves a lot of copy & paste, but especially time $statement->bindValue(':firstName', 'Foo') ->bindValue(':lastName', 'Bar'); ->execute(); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53657&edit=1