Doc #68037 [NEW]: SQLite3Stmt::bindValue() accepts numeric index parameters
| From: | benjamin dot morel at gmail dot com | Date: | Wed, 17 Sep 2014 15:17:16 +0000 |
| Subject: | Doc #68037 [NEW]: SQLite3Stmt::bindValue() accepts numeric index parameters | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-11483@lists.php.net to get a copy of this message | ||
From: benjamin dot morel at gmail dot com
Operating system: Irrelevant
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:SQLite3Stmt::bindValue() accepts numeric index parameters
Description:
------------
The doc for PDOStatement::bindValue():
http://php.net/manual/en/pdostatement.bindvalue.php
Says that $sql_param can only be a string:
public bool SQLite3Stmt::bindValue ( string $sql_param , mixed $value [,
int $type ] )
> sql_param
> An string identifying the statement variable to which the value should
be bound.
However, as the commenter said 4 years ago at the bottom of the page, it
can also be an integer for "?" placeholders:
> Note that this also works with positional placeholders using the '?'
token:
<?php
$stmt = $db->prepare('SELECT * FROM mytable WHERE foo = ? AND bar =
?');
$stmt->bindValue(1, 'somestring', SQLITE3_TEXT);
$stmt->bindValue(2, 42, SQLITE3_INTEGER);
?>
> Positional numbering starts at 1.
So basically it accepts both named parameters and numerically indexed
parameters, just like PDO. It would be nice to add this fact to the
documentation.
--
Edit bug report at https://bugs.php.net/bug.php?id=68037&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68037&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68037&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68037&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68037&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68037&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68037&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68037&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68037&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68037&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68037&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68037&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68037&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68037&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68037&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68037&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68037&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68037&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68037&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68037&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68037&r=mysqlcfg