Doc #68037 [Opn->Csd]: SQLite3Stmt::bindValue() accepts numeric index parameters
| From: | cmb@php.net | Date: | Sat, 28 Jan 2017 12:45:39 +0000 |
| Subject: | Doc #68037 [Opn->Csd]: SQLite3Stmt::bindValue() accepts numeric index parameters | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14379@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68037&edit=1
ID: 68037
Updated by: cmb@php.net
Reported by: benjamin dot morel at gmail dot com
Summary: SQLite3Stmt::bindValue() accepts numeric index
parameters
-Status: Open
+Status: Closed
Type: Documentation Problem
-Package: Documentation problem
+Package: SQLite related
Operating System: Irrelevant
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Note that PDOStatement and SQLite3Stmt are unrelated classes. I
assume that this bug report is about SQLite3Stmt (as PDOStatement
already stated
mixed then this ticket has been filed), and as
such this issue is resolved with
<http://svn.php.net/viewvc?view=revision&revision=339509>.
Previous Comments:
------------------------------------------------------------------------
[2014-09-17 15:17:16] benjamin dot morel at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=68037&edit=1