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

1.1     ! misho       1: --TEST--
        !             2: Bug #47199 (pg_delete fails on NULL)
        !             3: --SKIPIF--
        !             4: <?php
        !             5: require_once('skipif.inc');
        !             6: ?>
        !             7: --FILE--
        !             8: <?php
        !             9: 
        !            10: require_once('config.inc');
        !            11: 
        !            12: $dbh = pg_connect($conn_str);
        !            13: $tbl_name = 'test_47199';
        !            14: @pg_query("DROP TABLE $tbl_name");
        !            15: pg_query("CREATE TABLE $tbl_name (null_field INT, not_null_field INT NOT NULL)");
        !            16: 
        !            17: pg_insert($dbh, $tbl_name, array('null_field' => null, 'not_null_field' => 1));
        !            18: pg_insert($dbh, $tbl_name, array('null_field' => null, 'not_null_field' => 2));
        !            19: 
        !            20: var_dump(pg_fetch_all(pg_query('SELECT * FROM '. $tbl_name)));
        !            21: 
        !            22: $query = pg_delete($dbh, $tbl_name, array('null_field' => NULL,'not_null_field' => 2), PGSQL_DML_STRING|PGSQL_DML_EXEC);
        !            23: 
        !            24: echo $query, "\n";
        !            25: 
        !            26: $query = pg_update($dbh, $tbl_name, array('null_field' => NULL, 'not_null_field' => 0), array('not_null_field' => 1, 'null_field' => ''), PGSQL_DML_STRING|PGSQL_DML_EXEC);
        !            27: 
        !            28: echo $query, "\n";
        !            29: 
        !            30: var_dump(pg_fetch_all(pg_query('SELECT * FROM '. $tbl_name)));
        !            31: 
        !            32: @pg_query("DROP TABLE $tbl_name");
        !            33: pg_close($dbh);
        !            34: 
        !            35: echo PHP_EOL."Done".PHP_EOL;
        !            36: 
        !            37: ?>
        !            38: --EXPECTF--
        !            39: array(2) {
        !            40:   [0]=>
        !            41:   array(2) {
        !            42:     ["null_field"]=>
        !            43:     NULL
        !            44:     ["not_null_field"]=>
        !            45:     string(1) "1"
        !            46:   }
        !            47:   [1]=>
        !            48:   array(2) {
        !            49:     ["null_field"]=>
        !            50:     NULL
        !            51:     ["not_null_field"]=>
        !            52:     string(1) "2"
        !            53:   }
        !            54: }
        !            55: DELETE FROM test_47199 WHERE null_field IS NULL AND not_null_field=2;
        !            56: UPDATE test_47199 SET null_field=NULL,not_null_field=0 WHERE not_null_field=1 AND null_field IS NULL;
        !            57: array(1) {
        !            58:   [0]=>
        !            59:   array(2) {
        !            60:     ["null_field"]=>
        !            61:     NULL
        !            62:     ["not_null_field"]=>
        !            63:     string(1) "0"
        !            64:   }
        !            65: }
        !            66: 
        !            67: Done

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