Skip to content

Commit 3816248

Browse files
committed
Fix bug_69356.phpt for firebird
Firebird does not support selecting without a table. Use the same code we use elsewhere, which adds "FROM DUAL" or "FROM RDS$DATABASE" as necessary.
1 parent 9294074 commit 3816248

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

ext/pdo/tests/bug_69356.phpt

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,35 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
1616

1717
$db = PDOTest::factory();
1818
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
19-
$stmt = $db->query("
20-
SELECT '
21-
Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
22-
This is a debug function, which dump directly the data on the normal output.
23-
Tip:
24-
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
25-
This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
26-
'
27-
");
19+
$query = <<<'SQL'
20+
SELECT '
21+
Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
22+
This is a debug function, which dump directly the data on the normal output.
23+
Tip:
24+
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
25+
This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
26+
'
27+
SQL;
28+
29+
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
30+
case 'oci':
31+
$query .= ' FROM DUAL';
32+
break;
33+
case 'firebird':
34+
$query .= ' FROM RDB$DATABASE';
35+
break;
36+
}
37+
38+
$stmt = $db->query($query);
2839
var_dump($stmt->debugDumpParams());
2940
?>
3041
--EXPECTF--
31-
SQL: [%d]
32-
SELECT '
33-
Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
34-
This is a debug function, which dump directly the data on the normal output.
35-
Tip:
36-
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
37-
This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
38-
'
39-
42+
SQL: [%s] SELECT '
43+
Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
44+
This is a debug function, which dump directly the data on the normal output.
45+
Tip:
46+
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
47+
This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
48+
'%S
4049
Params: 0
4150
NULL

0 commit comments

Comments
 (0)