Annotation of embedaddon/php/ext/pgsql/tests/04async_query.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PostgreSQL async query
3: --SKIPIF--
4: <?php include("skipif.inc"); ?>
5: --FILE--
6: <?php
7:
8: include('config.inc');
9:
10: $db = pg_connect($conn_str);
11:
12: if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) {
13: echo "pg_send_query() error\n";
14: }
15: while(pg_connection_busy($db)); // busy wait: intended
16: if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
17: echo "pg_connection_status() error\n";
18: }
19: if (!($result = pg_get_result($db)))
20: {
21: echo "pg_get_result() error\n";
22: }
23:
24: if (!($rows = pg_num_rows($result))) {
25: echo "pg_num_rows() error\n";
26: }
27: for ($i=0; $i < $rows; $i++)
28: {
29: pg_fetch_array($result, $i, PGSQL_NUM);
30: }
31: for ($i=0; $i < $rows; $i++)
32: {
33: pg_fetch_object($result);
34: }
35: for ($i=0; $i < $rows; $i++)
36: {
37: pg_fetch_row($result, $i);
38: }
39: for ($i=0; $i < $rows; $i++)
40: {
41: pg_fetch_result($result, $i, 0);
42: }
43:
44: pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
45: pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
46: pg_field_name($result, 0);
47: pg_field_num($result, $field_name);
48: pg_field_size($result, 0);
49: pg_field_type($result, 0);
50: pg_field_prtlen($result, 0);
51: pg_field_is_null($result, 0);
52:
53: if (!pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');"))
54: {
55: echo "pg_send_query() error\n";
56: }
57:
58: pg_last_oid($result);
59: pg_free_result($result);
60:
61:
62: echo "OK";
63: ?>
64: --EXPECT--
65: OK
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>