summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt
blob: eabc4db829515a8caa09681562af45a2661544b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
PDO::ATTR_FETCH_TABLE_NAMES
--SKIPIF--
<?php
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
?>
--FILE--
<?php
    require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
    $db = MySQLPDOTest::factory();
    MySQLPDOTest::createTestTable($db);

    $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 1);
    $stmt = $db->query('SELECT label FROM test LIMIT 1');
    var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
    $stmt->closeCursor();

    $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 0);
    $stmt = $db->query('SELECT label FROM test LIMIT 1');
    var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
    $stmt->closeCursor();

    print "done!";
?>
--EXPECT--
array(1) {
  [0]=>
  array(1) {
    ["test.label"]=>
    string(1) "a"
  }
}
array(1) {
  [0]=>
  array(1) {
    ["label"]=>
    string(1) "a"
  }
}
done!