1--TEST--
2MySQL PDO->prepare(), native PS, named placeholder
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12    require_once __DIR__ . '/inc/mysql_pdo_test.inc';
13    $db = MySQLPDOTest::factory();
14
15    $table = 'pdo_mysql_prepare_native_column';
16    MySQLPDOTest::createTestTable($table, $db);
17
18    $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
19    if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
20        printf("[002] Unable to turn off emulated prepared statements\n");
21
22    $stmt = $db->prepare("SELECT :param FROM {$table} ORDER BY id ASC LIMIT 1");
23    $stmt->execute(array(':param' => 'id'));
24    var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
25
26    $db->prepare("SELECT :placeholder FROM {$table} WHERE :placeholder > :placeholder");
27    $stmt->execute(array(':placeholder' => 'test'));
28
29    var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
30
31    print "done!";
32?>
33--CLEAN--
34<?php
35require __DIR__ . '/inc/mysql_pdo_test.inc';
36$db = MySQLPDOTest::factory();
37$db->exec('DROP TABLE IF EXISTS pdo_mysql_prepare_native_column');
38?>
39--EXPECTF--
40array(1) {
41  [0]=>
42  array(1) {
43    ["?"]=>
44    string(2) "id"
45  }
46}
47
48Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in %s on line %d
49array(0) {
50}
51done!
52