mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Refs #34630
This commit is contained in:
parent
4f7d14f8d9
commit
3905ce46d9
1 changed files with 20 additions and 5 deletions
|
@ -93,7 +93,6 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
|
|||
}
|
||||
|
||||
switch (PDO_PARAM_TYPE(param->param_type)) {
|
||||
case PDO_PARAM_LOB:
|
||||
case PDO_PARAM_STMT:
|
||||
return 0;
|
||||
|
||||
|
@ -103,7 +102,23 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
|
|||
}
|
||||
pdo_sqlite_error_stmt(stmt);
|
||||
return 0;
|
||||
|
||||
|
||||
case PDO_PARAM_LOB:
|
||||
if (Z_TYPE_P(param->parameter) == IS_RESOURCE) {
|
||||
php_stream *stm;
|
||||
php_stream_from_zval_no_verify(stm, ¶m->parameter);
|
||||
if (stm) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(¶m->parameter);
|
||||
Z_TYPE_P(param->parameter) = IS_STRING;
|
||||
Z_STRLEN_P(param->parameter) = php_stream_copy_to_mem(stm,
|
||||
&Z_STRVAL_P(param->parameter), PHP_STREAM_COPY_ALL, 0);
|
||||
} else {
|
||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* fall through */
|
||||
|
||||
case PDO_PARAM_STR:
|
||||
default:
|
||||
if (Z_TYPE_P(param->parameter) == IS_NULL) {
|
||||
|
@ -113,9 +128,9 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
|
|||
} else {
|
||||
convert_to_string(param->parameter);
|
||||
if(SQLITE_OK == sqlite3_bind_text(S->stmt, param->paramno + 1,
|
||||
Z_STRVAL_P(param->parameter),
|
||||
Z_STRLEN_P(param->parameter),
|
||||
SQLITE_STATIC)) {
|
||||
Z_STRVAL_P(param->parameter),
|
||||
Z_STRLEN_P(param->parameter),
|
||||
SQLITE_STATIC)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue