Annotation of embedaddon/php/ext/pgsql/tests/03sync_query.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: PostgreSQL sync 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: $result = pg_query($db, "SELECT * FROM ".$table_name.";");
                     13: if (!($rows   = pg_num_rows($result)))
                     14: {
                     15:        echo "pg_num_row() error\n";
                     16: }
                     17: for ($i=0; $i < $rows; $i++) 
                     18: {
                     19:        pg_fetch_array($result, $i, PGSQL_NUM);
                     20: }
                     21: for ($i=0; $i < $rows; $i++) 
                     22: {
                     23:        pg_fetch_object($result);
                     24: }
                     25: for ($i=0; $i < $rows; $i++) 
                     26: {
                     27:        pg_fetch_row($result, $i);
                     28: }
                     29: for ($i=0; $i < $rows; $i++) 
                     30: {
                     31:        pg_fetch_result($result, $i, 0);
                     32: }
                     33: 
                     34: pg_result_error($result);
                     35: if (function_exists('pg_result_error_field')) {
                     36:        pg_result_error_field($result, PGSQL_DIAG_SEVERITY);
                     37:        pg_result_error_field($result, PGSQL_DIAG_SQLSTATE);
                     38:        pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY);
                     39:        pg_result_error_field($result, PGSQL_DIAG_MESSAGE_DETAIL);
                     40:        pg_result_error_field($result, PGSQL_DIAG_MESSAGE_HINT);
                     41:        pg_result_error_field($result, PGSQL_DIAG_STATEMENT_POSITION);
                     42:        if (defined('PGSQL_DIAG_INTERNAL_POSITION'))
                     43:        {
                     44:                pg_result_error_field($result, PGSQL_DIAG_INTERNAL_POSITION);
                     45:        }
                     46:        if (defined('PGSQL_DIAG_INTERNAL_QUERY'))
                     47:        {
                     48:                pg_result_error_field($result, PGSQL_DIAG_INTERNAL_QUERY);
                     49:        }
                     50:        pg_result_error_field($result, PGSQL_DIAG_CONTEXT);
                     51:        pg_result_error_field($result, PGSQL_DIAG_SOURCE_FILE);
                     52:        pg_result_error_field($result, PGSQL_DIAG_SOURCE_LINE);
                     53:        pg_result_error_field($result, PGSQL_DIAG_SOURCE_FUNCTION);
                     54: }
                     55: pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
                     56: pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
                     57: pg_field_name($result, 0);
                     58: pg_field_num($result, $field_name);
                     59: pg_field_size($result, 0);
                     60: pg_field_type($result, 0);
                     61: pg_field_prtlen($result, 0);
                     62: pg_field_is_null($result, 0);
                     63: 
                     64: $result = pg_query($db, "INSERT INTO ".$table_name." VALUES (9999, 'ABC');");
                     65: pg_last_oid($result);
                     66: 
                     67: pg_free_result($result);
                     68: pg_close($db);
                     69: 
                     70: echo "OK";
                     71: ?>
                     72: --EXPECT--
                     73: OK

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>