|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53657 Make at least PDOStatement::bindValue and PDOStatement::bindParam() chainable!
Submitted: 2011-01-05 19:33 UTC Modified: 2011-01-06 11:26 UTC
From: schindhelm at gmail dot com Assigned:
Status: Wont fix Package: *Database Functions
PHP Version: 5.3.4 OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-01-05 19:33 UTC] schindhelm at gmail dot com
From manual page:

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...

// what I wish for and what saves a lot of copy & paste, but especially time
$statement->bindValue(':firstName', 'Foo')
          ->bindValue(':lastName', 'Bar');


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-06 03:01 UTC]
-Status: Open +Status: Wont fix
 [2011-01-06 03:01 UTC]
The bind methods already have defined return values. I don't see any
benefit to breaking backward compatibility for such a minor potential
 [2011-01-06 11:26 UTC]
Use: execute(array(values))
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 22:01:26 2024 UTC