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