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