xref: /PHP-8.1/ext/pdo_dblib/tests/bug_47588.phpt (revision 74859783)
1--TEST--
2PDO_DBLIB: Quoted field names
3--EXTENSIONS--
4pdo_dblib
5--SKIPIF--
6<?php
7require __DIR__ . '/config.inc';
8?>
9--FILE--
10<?php
11require __DIR__ . '/config.inc';
12
13$db->query('CREATE TABLE "Test Table" ("My Field" int, "Another Field" varchar(32) not null default \'test_string\')');
14$db->query('INSERT INTO "Test Table" ("My Field") values(1)');
15$db->query('INSERT INTO "Test Table" ("My Field") values(2)');
16$db->query('INSERT INTO "Test Table" ("My Field") values(3)');
17$rs = $db->query('SELECT * FROM "Test Table"');
18var_dump($rs->fetchAll(PDO::FETCH_ASSOC));
19$db->query('DROP TABLE "Test Table"');
20echo "Done.\n";
21?>
22--EXPECT--
23array(3) {
24  [0]=>
25  array(2) {
26    ["My Field"]=>
27    int(1)
28    ["Another Field"]=>
29    string(11) "test_string"
30  }
31  [1]=>
32  array(2) {
33    ["My Field"]=>
34    int(2)
35    ["Another Field"]=>
36    string(11) "test_string"
37  }
38  [2]=>
39  array(2) {
40    ["My Field"]=>
41    int(3)
42    ["Another Field"]=>
43    string(11) "test_string"
44  }
45}
46Done.
47