Req #53657 [Opn->Wfx]: Make at least PDOStatement::bindValue and PDOStatement::bindParam() chainable!
| From: | aharvey@php.net | Date: | Thu, 06 Jan 2011 02:01:38 +0000 |
| Subject: | Req #53657 [Opn->Wfx]: Make at least PDOStatement::bindValue and PDOStatement::bindParam() chainable! | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157645@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53657&edit=1
ID: 53657
Updated by: aharvey@php.net
Reported by: schindhelm at gmail dot com
Summary: Make at least PDOStatement::bindValue and
PDOStatement::bindParam() chainable!
-Status: Open
+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:
The bind methods already have defined return values. I don't see any
benefit to breaking backward compatibility for such a minor potential
gain.
Previous Comments:
------------------------------------------------------------------------
[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