Annotation of embedaddon/php/ext/pgsql/tests/80_bug32223.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #32223 (weird behaviour of pg_last_notice)
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6:
7: _skip_lc_messages();
8:
9: @pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
10: $res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
11: begin
12: RAISE NOTICE ''11111'';
13: return ''f'';
14: end;
15: ' LANGUAGE plpgsql;");
16: if (!$res) die('skip PLPGSQL not available');
17: ?>
18: --FILE--
19: <?php
20:
21: require_once('config.inc');
22: require_once('lcmess.inc');
23:
24: $dbh = @pg_connect($conn_str);
25: if (!$dbh) {
26: die ("Could not connect to the server");
27: }
28:
29: _set_lc_messages();
30:
31: $res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
32: begin
33: RAISE NOTICE ''11111'';
34: return ''f'';
35: end;
36: ' LANGUAGE plpgsql;");
37:
38:
39: $res = pg_query($dbh, 'SELECT test_notice()');
40: $row = pg_fetch_row($res, 0);
41: var_dump($row);
42: pg_free_result($res);
43: if ($row[0] == 'f')
44: {
45: var_dump(pg_last_notice($dbh));
46: }
47:
48: pg_close($dbh);
49:
50: ?>
51: ===DONE===
52: --EXPECTF--
53: array(1) {
54: [0]=>
55: string(1) "f"
56: }
57: string(14) "NOTICE: 11111"
58: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>