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