com php-src: Cursor is not opened on singleton selects.: ext/pdo_firebird/firebird_statement.c ext/pdo_firebir d/tests/bug_aaa.phpt
| From: | Anatol Belski | Date: | Sun, 18 Dec 2016 20:53:51 +0000 |
| Subject: | com php-src: Cursor is not opened on singleton selects.: ext/pdo_firebird/firebird_statement.c ext/pdo_firebir d/tests/bug_aaa.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96373@lists.php.net to get a copy of this message | ||
Commit: cf46ac1179376f58895feb6ed914b03bea19e295
Author: Dorin Marcoci <dorin.marcoci@marcodor.com> Thu, 15 Dec 2016 10:57:45 +0200
Committer: Anatol Belski <ab@php.net> Sun, 18 Dec 2016 21:53:51 +0100
Parents: 3e48baa49d45206444a4af4f808ce640ac83d5a4
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cf46ac1179376f58895feb6ed914b03bea19e295
Log:
Cursor is not opened on singleton selects.
Test case for unregistered bug on FB3 singleton selects
Set error mode to warning instead of exception.
Changed paths:
M ext/pdo_firebird/firebird_statement.c
A ext/pdo_firebird/tests/bug_aaa.phpt
Diff:
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index f719ecc..6496842 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -152,8 +152,8 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt) /* {{{ */
}
*S->name = 0;
- S->cursor_open = (S->out_sqlda.sqln > 0); /* A cursor is opened, when more than zero
columns returned */
- S->exhausted = !S->cursor_open;
+ S->cursor_open = S->out_sqlda.sqln && (S->statement_type !=
isc_info_sql_stmt_exec_procedure);
+ S->exhausted = !S->out_sqlda.sqln; /* There are data to fetch */
return 1;
} while (0);
diff --git a/ext/pdo_firebird/tests/bug_aaa.phpt b/ext/pdo_firebird/tests/bug_aaa.phpt
new file mode 100644
index 0000000...821d59a
--- /dev/null
+++ b/ext/pdo_firebird/tests/bug_aaa.phpt
@@ -0,0 +1,19 @@
+--TEST--
+PDO_Firebird: cursor should not be marked as opened on singleton statements
+--SKIPIF--
+<?php if (!extension_loaded('interbase') ||
!extension_loaded('pdo_firebird')) die('skip'); ?>
+--FILE--
+<?php
+require 'testdb.inc';
+$C = new PDO('firebird:dbname='..$test_base, $user, $password, [PDO::ATTR_ERRMODE =>
PDO::ERRMODE_WARNING]) or die;
+@$C->exec('drop table ta_table');
+$C->exec('create table ta_table (id integer)');
+$S = $C->prepare('insert into ta_table (id) values (:id) returning id');
+$S->execute(['id' => 1]);
+$S->execute(['id' => 2]);
+unset($S);
+unset($C);
+echo 'OK';
+?>
+--EXPECT--
+OK
\ No newline at end of file