Annotation of embedaddon/php/ext/pgsql/tests/23sync_query_params.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: PostgreSQL sync query params
        !             3: --SKIPIF--
        !             4: <?php 
        !             5: include("skipif.inc"); 
        !             6: if (!function_exists('pg_query_params')) die('skip function pg_query_params() does not exist');
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: 
        !            11: include('config.inc');
        !            12: 
        !            13: $db = pg_connect($conn_str);
        !            14: 
        !            15: $version = pg_version($db);
        !            16: if ($version['protocol'] >= 3) {
        !            17:        $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
        !            18:        if (!($rows   = pg_num_rows($result)))
        !            19:        {
        !            20:                echo "pg_num_row() error\n";
        !            21:        }
        !            22:        for ($i=0; $i < $rows; $i++) 
        !            23:        {
        !            24:                pg_fetch_array($result, $i, PGSQL_NUM);
        !            25:        }
        !            26:        for ($i=0; $i < $rows; $i++) 
        !            27:        {
        !            28:                pg_fetch_object($result);
        !            29:        }
        !            30:        for ($i=0; $i < $rows; $i++) 
        !            31:        {
        !            32:                pg_fetch_row($result, $i);
        !            33:        }
        !            34:        for ($i=0; $i < $rows; $i++) 
        !            35:        {
        !            36:                pg_fetch_result($result, $i, 0);
        !            37:        }
        !            38: 
        !            39:        pg_result_error($result);
        !            40:        pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
        !            41:        pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
        !            42:        pg_field_name($result, 0);
        !            43:        pg_field_num($result, $field_name);
        !            44:        pg_field_size($result, 0);
        !            45:        pg_field_type($result, 0);
        !            46:        pg_field_prtlen($result, 0);
        !            47:        pg_field_is_null($result, 0);
        !            48: 
        !            49:        $result = pg_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
        !            50:        pg_last_oid($result);
        !            51: 
        !            52:        pg_free_result($result);
        !            53: }
        !            54: pg_close($db);
        !            55: 
        !            56: echo "OK";
        !            57: ?>
        !            58: --EXPECT--
        !            59: OK

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