1--TEST--
2PDO PgSQL PGSQL_ATTR_DISABLE_PREPARES
3--EXTENSIONS--
4pdo
5pdo_pgsql
6--SKIPIF--
7<?php
8require __DIR__ . '/config.inc';
9require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
15$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
16$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
17$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_COLUMN);
18
19$stmt = $db->prepare("SELECT statement FROM pg_prepared_statements", array(
20    PDO::ATTR_EMULATE_PREPARES => true));
21
22$stmt2 = $db->prepare("SELECT (?)::int2");
23$stmt2->execute(array(1));
24var_dump($stmt2->fetch());
25$stmt2->execute(array(2));
26var_dump($stmt2->fetch());
27
28$stmt->execute();
29$first = $stmt->fetchAll();
30
31$stmt3 = $db->prepare("SELECT (?)::int4", array(
32    PDO::PGSQL_ATTR_DISABLE_PREPARES => true));
33$stmt3->execute(array(3));
34var_dump($stmt3->fetch());
35$stmt3->execute(array(4));
36var_dump($stmt3->fetch());
37
38$stmt->execute();
39$second = $stmt->fetchAll();
40
41var_dump($first, $second);
42
43?>
44--EXPECT--
45string(1) "1"
46string(1) "2"
47string(1) "3"
48string(1) "4"
49array(1) {
50  [0]=>
51  string(17) "SELECT ($1)::int2"
52}
53array(1) {
54  [0]=>
55  string(17) "SELECT ($1)::int2"
56}
57