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