Annotation of embedaddon/php/ext/oci8/tests/bind_empty.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: binding empty values
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: require dirname(__FILE__).'/connect.inc';
                      9: 
                     10: $drop = "DROP table bind_empty_tab";
                     11: $statement = oci_parse($c, $drop);
                     12: @oci_execute($statement);
                     13: 
                     14: $create = "CREATE table bind_empty_tab(name VARCHAR(10))";
                     15: $statement = oci_parse($c, $create);
                     16: oci_execute($statement);
                     17: 
                     18: 
                     19: echo "Test 1\n";
                     20: 
                     21: $name = null;
                     22: $stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name");
                     23: oci_bind_by_name($stmt, ":name", $name);
                     24: 
                     25: var_dump(oci_execute($stmt));
                     26: 
                     27: echo "Test 2\n";
                     28: 
                     29: $name = "";
                     30: $stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name");
                     31: oci_bind_by_name($stmt, ":name", $name);
                     32: 
                     33: var_dump(oci_execute($stmt));
                     34: 
                     35: echo "Test 3\n";
                     36: 
                     37: $stmt = oci_parse($c, "INSERT INTO bind_empty_tab (NAME) VALUES ('abc')");
                     38: $res = oci_execute($stmt);
                     39: 
                     40: $stmt = oci_parse($c, "INSERT INTO bind_empty_tab (NAME) VALUES ('def')");
                     41: $res = oci_execute($stmt);
                     42: 
                     43: $name = null;
                     44: $stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name WHERE NAME = 'abc'");
                     45: oci_bind_by_name($stmt, ":name", $name);
                     46: 
                     47: var_dump(oci_execute($stmt));
                     48: 
                     49: $stid = oci_parse($c, "select * from bind_empty_tab order by 1");
                     50: oci_execute($stid);
                     51: oci_fetch_all($stid, $res);
                     52: var_dump($res);
                     53: 
                     54: echo "Test 4\n";
                     55: 
                     56: $name = "";
                     57: $stmt = oci_parse($c, "UPDATE bind_empty_tab SET name=:name WHERE NAME = 'def'");
                     58: oci_bind_by_name($stmt, ":name", $name);
                     59: 
                     60: var_dump(oci_execute($stmt));
                     61: 
                     62: $stid = oci_parse($c, "select * from bind_empty_tab order by 1");
                     63: oci_execute($stid);
                     64: oci_fetch_all($stid, $res);
                     65: var_dump($res);
                     66: 
                     67: echo "Test 5\n";
                     68: 
                     69: $av = $bv = 'old';
                     70: $s = oci_parse($c, "begin :bv := null; end; ");
                     71: oci_bind_by_name($s, ":bv", $bv);
                     72: oci_execute($s);
                     73: var_dump($av);
                     74: var_dump($bv);
                     75: 
                     76: echo "Test 6\n";
                     77: 
                     78: $av = $bv = null;
                     79: $s = oci_parse($c, "begin :bv := null; end; ");
                     80: oci_bind_by_name($s, ":bv", $bv);
                     81: oci_execute($s);
                     82: var_dump($av);
                     83: var_dump($bv);
                     84: 
                     85: // Clean up
                     86: 
                     87: $drop = "DROP table bind_empty_tab";
                     88: $statement = oci_parse($c, $drop);
                     89: @oci_execute($statement);
                     90: 
                     91: ?>
                     92: ===DONE===
                     93: <?php exit(0); ?>
                     94: --EXPECTF--
                     95: Test 1
                     96: bool(true)
                     97: Test 2
                     98: bool(true)
                     99: Test 3
                    100: bool(true)
                    101: array(1) {
                    102:   ["NAME"]=>
                    103:   array(2) {
                    104:     [0]=>
                    105:     string(3) "def"
                    106:     [1]=>
                    107:     NULL
                    108:   }
                    109: }
                    110: Test 4
                    111: bool(true)
                    112: array(1) {
                    113:   ["NAME"]=>
                    114:   array(2) {
                    115:     [0]=>
                    116:     NULL
                    117:     [1]=>
                    118:     NULL
                    119:   }
                    120: }
                    121: Test 5
                    122: string(3) "old"
                    123: NULL
                    124: Test 6
                    125: NULL
                    126: NULL
                    127: ===DONE===

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