diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-08-11 23:56:34 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-08-11 23:56:34 +0400 |
commit | 7435fc88a6edfb555e21d7a063d9f65ea3c67ecc (patch) | |
tree | d77601c75ff1bdd482b69cafe78d4b6238c86ad5 | |
parent | 3ae802508a85dd400cc5004219f2334a0e88c13e (diff) | |
download | php-git-7435fc88a6edfb555e21d7a063d9f65ea3c67ecc.tar.gz |
Fixed pdo_firebird tests failures
-rw-r--r-- | ext/pdo/tests/bug65946.phpt | 7 | ||||
-rw-r--r-- | ext/pdo/tests/bug_38253.phpt | 6 | ||||
-rw-r--r-- | ext/pdo_firebird/firebird_statement.c | 17 |
3 files changed, 25 insertions, 5 deletions
diff --git a/ext/pdo/tests/bug65946.phpt b/ext/pdo/tests/bug65946.phpt index 1c4bd8d6c4..4b63a14bb5 100644 --- a/ext/pdo/tests/bug65946.phpt +++ b/ext/pdo/tests/bug65946.phpt @@ -16,7 +16,12 @@ $db = PDOTest::factory(); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $db->exec('CREATE TABLE test(id int)'); $db->exec('INSERT INTO test VALUES(1)'); -$stmt = $db->prepare('SELECT * FROM test LIMIT :limit'); +if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') { + $sql = 'SELECT FIRST :limit * FROM test'; +} else { + $sql = 'SELECT * FROM test LIMIT :limit'; +} +$stmt = $db->prepare($sql); $stmt->bindValue('limit', 1, PDO::PARAM_INT); if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); diff --git a/ext/pdo/tests/bug_38253.phpt b/ext/pdo/tests/bug_38253.phpt index 4453c3bb23..e749970a5f 100644 --- a/ext/pdo/tests/bug_38253.phpt +++ b/ext/pdo/tests/bug_38253.phpt @@ -22,11 +22,11 @@ $stmt = $pdo->prepare ("SELECT * FROM test"); $stmt->execute(); var_dump($stmt->fetchAll()); -$pdo = PDOTest::factory(); - if ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') { $type = "clob"; -} else{ +} else if ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') { + $type = 'BLOB SUB_TYPE TEXT'; +} else { $type = "text"; } diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 586960cbf7..d21273366b 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -437,7 +437,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T put_cnt += chunk_size; } - zval_ptr_dtor(param); + zval_dtor(param); if (isc_close_blob(H->isc_status, &h)) { RECORD_ERROR(stmt); @@ -521,6 +521,19 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } else { parameter = ¶m->parameter; } + + if (Z_TYPE_P(parameter) == IS_RESOURCE) { + php_stream *stm; + + php_stream_from_zval_no_verify(stm, parameter); + if (stm) { + zval_ptr_dtor(parameter); + ZVAL_STR(parameter, php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0)); + } else { + pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC); + return 0; + } + } switch (var->sqltype & ~1) { case SQL_ARRAY: @@ -601,6 +614,8 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } else { parameter = ¶m->parameter; } + zval_ptr_dtor(parameter); + ZVAL_NULL(parameter); if (firebird_stmt_get_col(stmt, param->paramno, &value, &value_len, &caller_frees TSRMLS_CC)) { switch (PDO_PARAM_TYPE(param->param_type)) { |