Skip to content

Commit cf46ac1

Browse files
madorinweltling
authored andcommitted
Cursor is not opened on singleton selects.
Test case for unregistered bug on FB3 singleton selects Set error mode to warning instead of exception.
1 parent 3e48baa commit cf46ac1

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ext/pdo_firebird/firebird_statement.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt) /* {{{ */
152152
}
153153

154154
*S->name = 0;
155-
S->cursor_open = (S->out_sqlda.sqln > 0); /* A cursor is opened, when more than zero columns returned */
156-
S->exhausted = !S->cursor_open;
155+
S->cursor_open = S->out_sqlda.sqln && (S->statement_type != isc_info_sql_stmt_exec_procedure);
156+
S->exhausted = !S->out_sqlda.sqln; /* There are data to fetch */
157157

158158
return 1;
159159
} while (0);

ext/pdo_firebird/tests/bug_aaa.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
PDO_Firebird: cursor should not be marked as opened on singleton statements
3+
--SKIPIF--
4+
<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?>
5+
--FILE--
6+
<?php
7+
require 'testdb.inc';
8+
$C = new PDO('firebird:dbname='.$test_base, $user, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING]) or die;
9+
@$C->exec('drop table ta_table');
10+
$C->exec('create table ta_table (id integer)');
11+
$S = $C->prepare('insert into ta_table (id) values (:id) returning id');
12+
$S->execute(['id' => 1]);
13+
$S->execute(['id' => 2]);
14+
unset($S);
15+
unset($C);
16+
echo 'OK';
17+
?>
18+
--EXPECT--
19+
OK

0 commit comments

Comments
 (0)