mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
MFH:
- Fixed wrong check - Improved test
This commit is contained in:
parent
bc569c56a6
commit
a912d80adb
2 changed files with 17 additions and 11 deletions
|
@ -2197,14 +2197,14 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
|
|||
uint len;
|
||||
ulong num;
|
||||
|
||||
if (zend_hash_get_current_key_ex(stmt->bound_params, &str, &len, &num, 0, &pos) == HASH_KEY_IS_STRING) {
|
||||
php_stream_printf(out TSRMLS_CC, "Key: Position #%d:\n", num);
|
||||
if (zend_hash_get_current_key_ex(stmt->bound_params, &str, &len, &num, 0, &pos) == HASH_KEY_IS_LONG) {
|
||||
php_stream_printf(out TSRMLS_CC, "Key: Position #%ld:\n", num);
|
||||
} else {
|
||||
php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", len, len, str);
|
||||
}
|
||||
|
||||
php_stream_printf(out TSRMLS_CC, "paramno=%d\nname=[%d] %.*s\nis_param=%d\nparam_type=%d\n",
|
||||
param->paramno, param->namelen, param->namelen, param->name,
|
||||
php_stream_printf(out TSRMLS_CC, "paramno=%d\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
|
||||
param->paramno, param->namelen, param->namelen, param->name ? param->name : "",
|
||||
param->is_param,
|
||||
param->param_type);
|
||||
|
||||
|
|
|
@ -9,23 +9,29 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
|
|||
|
||||
$db = new pdo('sqlite:memory');
|
||||
|
||||
$x= $db->prepare('select :a, :b');
|
||||
$x= $db->prepare('select :a, :b, ?');
|
||||
$x->bindValue(':a', 1, PDO::PARAM_INT);
|
||||
$x->bindValue(':b', 'foo');
|
||||
$x->bindValue(3, 1313);
|
||||
var_dump($x->debugDumpParams());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
SQL: [13] select :a, :b
|
||||
Params: 2
|
||||
Key: Position #0:
|
||||
SQL: [16] select :a, :b, ?
|
||||
Params: 3
|
||||
Key: Name: [2] :a
|
||||
paramno=-1
|
||||
name=[2] :a
|
||||
name=[2] ":a"
|
||||
is_param=1
|
||||
param_type=1
|
||||
Key: Position #0:
|
||||
Key: Name: [2] :b
|
||||
paramno=-1
|
||||
name=[2] :b
|
||||
name=[2] ":b"
|
||||
is_param=1
|
||||
param_type=2
|
||||
Key: Position #2:
|
||||
paramno=2
|
||||
name=[0] ""
|
||||
is_param=1
|
||||
param_type=2
|
||||
NULL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue