Annotation of embedaddon/php/ext/pgsql/tests/80_bug32223.phpt, revision 1.1.1.2
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: ?>
1.1.1.2 ! misho 18: --INI--
! 19: pgsql.ignore_notice=0
1.1 misho 20: --FILE--
21: <?php
22:
23: require_once('config.inc');
24: require_once('lcmess.inc');
25:
26: $dbh = @pg_connect($conn_str);
27: if (!$dbh) {
28: die ("Could not connect to the server");
29: }
30:
31: _set_lc_messages();
32:
33: $res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
34: begin
35: RAISE NOTICE ''11111'';
36: return ''f'';
37: end;
38: ' LANGUAGE plpgsql;");
39:
40:
41: $res = pg_query($dbh, 'SELECT test_notice()');
42: $row = pg_fetch_row($res, 0);
43: var_dump($row);
44: pg_free_result($res);
45: if ($row[0] == 'f')
46: {
47: var_dump(pg_last_notice($dbh));
48: }
49:
50: pg_close($dbh);
51:
52: ?>
53: ===DONE===
54: --EXPECTF--
55: array(1) {
56: [0]=>
57: string(1) "f"
58: }
59: string(14) "NOTICE: 11111"
60: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>