diff options
author | Wez Furlong <wez@php.net> | 2005-09-24 18:55:56 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2005-09-24 18:55:56 +0000 |
commit | 3905ce46d9c4e12af1d6a40d4ae1458dcf0d7af7 (patch) | |
tree | ba6068bb8ac50bed8f256d1dedc28ea1cde7be3d /ext/pdo_sqlite/sqlite_statement.c | |
parent | 4f7d14f8d9c80d04ce652ba60db6a2a1f2bf9c3e (diff) | |
download | php-git-3905ce46d9c4e12af1d6a40d4ae1458dcf0d7af7.tar.gz |
Refs #34630
Diffstat (limited to 'ext/pdo_sqlite/sqlite_statement.c')
-rw-r--r-- | ext/pdo_sqlite/sqlite_statement.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index dd52402030..cf9b5e043b 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -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; } } |