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