Annotation of embedaddon/php/ext/pgsql/tests/24sync_query_prepared.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: PostgreSQL sync prepared queries
        !             3: --SKIPIF--
        !             4: <?php
        !             5: include("skipif.inc");
        !             6: if (!function_exists('pg_prepare')) die('skip function pg_prepare() 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_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;");
        !            18:        pg_result_error($result);
        !            19:        pg_free_result($result);
        !            20:        $result = pg_execute($db, "php_test", array(100));
        !            21:        if (!($rows   = pg_num_rows($result)))
        !            22:        {
        !            23:                echo "pg_num_row() error\n";
        !            24:        }
        !            25:        for ($i=0; $i < $rows; $i++) 
        !            26:        {
        !            27:                pg_fetch_array($result, $i, PGSQL_NUM);
        !            28:        }
        !            29:        for ($i=0; $i < $rows; $i++) 
        !            30:        {
        !            31:                pg_fetch_object($result);
        !            32:        }
        !            33:        for ($i=0; $i < $rows; $i++) 
        !            34:        {
        !            35:                pg_fetch_row($result, $i);
        !            36:        }
        !            37:        for ($i=0; $i < $rows; $i++) 
        !            38:        {
        !            39:                pg_fetch_result($result, $i, 0);
        !            40:        }
        !            41: 
        !            42:        pg_result_error($result);
        !            43:        pg_num_rows(pg_execute($db, "php_test", array(100)));
        !            44:        pg_num_fields(pg_execute($db, "php_test", array(100)));
        !            45:        pg_field_name($result, 0);
        !            46:        pg_field_num($result, $field_name);
        !            47:        pg_field_size($result, 0);
        !            48:        pg_field_type($result, 0);
        !            49:        pg_field_prtlen($result, 0);
        !            50:        pg_field_is_null($result, 0);
        !            51: 
        !            52:        $result = pg_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);");
        !            53:        pg_result_error($result);
        !            54:        pg_free_result($result);
        !            55:        $result = pg_execute($db, "php_test2", array(9999, "A'BC"));
        !            56:        pg_last_oid($result);
        !            57: 
        !            58:        pg_free_result($result);
        !            59: }
        !            60: pg_close($db);
        !            61: 
        !            62: echo "OK";
        !            63: ?>
        !            64: --EXPECT--
        !            65: OK

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