Annotation of embedaddon/php/ext/oci8/tests/commit_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test OCI_NO_AUTO_COMMIT constant
! 3: --SKIPIF--
! 4: <?php
! 5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
! 6: require(dirname(__FILE__).'/skipif.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10:
! 11: require(dirname(__FILE__)."/connect.inc");
! 12: require(dirname(__FILE__).'/create_table.inc');
! 13:
! 14: $insert_sql = "insert into ".$schema.$table_name." (id, value) values (1,1)";
! 15:
! 16: if (!($s = oci_parse($c, $insert_sql))) {
! 17: die("oci_parse(insert) failed!\n");
! 18: }
! 19:
! 20: /* check with OCI_NO_AUTO_COMMIT mode */
! 21: for ($i = 0; $i<3; $i++) {
! 22: if (!oci_execute($s, OCI_NO_AUTO_COMMIT)) {
! 23: die("oci_execute(insert) failed!\n");
! 24: }
! 25: }
! 26:
! 27: for ($i = 0; $i<3; $i++) {
! 28: if (!oci_execute($s, OCI_DEFAULT)) {
! 29: die("oci_execute(insert) failed!\n");
! 30: }
! 31: }
! 32:
! 33:
! 34: var_dump(oci_rollback($c));
! 35:
! 36: $select_sql = "select * from ".$schema.$table_name."";
! 37:
! 38: if (!($select = oci_parse($c, $select_sql))) {
! 39: die("oci_parse(select) failed!\n");
! 40: }
! 41:
! 42: /* oci_fetch_all */
! 43: if (!oci_execute($select)) {
! 44: die("oci_execute(select) failed!\n");
! 45: }
! 46: var_dump(oci_fetch_all($select, $all));
! 47: var_dump($all);
! 48:
! 49: /* ocifetchstatement */
! 50: if (!oci_execute($s)) {
! 51: die("oci_execute(select) failed!\n");
! 52: }
! 53:
! 54: $insert_sql = "insert into ".$schema.$table_name." (id, value) values (1,1)";
! 55:
! 56: if (!($s = oci_parse($c, $insert_sql))) {
! 57: die("oci_parse(insert) failed!\n");
! 58: }
! 59:
! 60: for ($i = 0; $i<3; $i++) {
! 61: if (!oci_execute($s, OCI_DEFAULT)) {
! 62: die("oci_execute(insert) failed!\n");
! 63: }
! 64: }
! 65:
! 66: var_dump(oci_commit($c));
! 67:
! 68: /* oci_fetch_all */
! 69: if (!oci_execute($select)) {
! 70: die("oci_execute(select) failed!\n");
! 71: }
! 72: var_dump(oci_fetch_all($select, $all));
! 73: var_dump($all);
! 74:
! 75:
! 76: require(dirname(__FILE__).'/drop_table.inc');
! 77:
! 78: echo "Done\n";
! 79: ?>
! 80: --EXPECTF--
! 81: bool(true)
! 82: int(0)
! 83: array(5) {
! 84: [%u|b%"ID"]=>
! 85: array(0) {
! 86: }
! 87: [%u|b%"VALUE"]=>
! 88: array(0) {
! 89: }
! 90: [%u|b%"BLOB"]=>
! 91: array(0) {
! 92: }
! 93: [%u|b%"CLOB"]=>
! 94: array(0) {
! 95: }
! 96: [%u|b%"STRING"]=>
! 97: array(0) {
! 98: }
! 99: }
! 100: bool(true)
! 101: int(4)
! 102: array(5) {
! 103: [%u|b%"ID"]=>
! 104: array(4) {
! 105: [0]=>
! 106: %string|unicode%(1) "1"
! 107: [1]=>
! 108: %string|unicode%(1) "1"
! 109: [2]=>
! 110: %string|unicode%(1) "1"
! 111: [3]=>
! 112: %string|unicode%(1) "1"
! 113: }
! 114: [%u|b%"VALUE"]=>
! 115: array(4) {
! 116: [0]=>
! 117: %string|unicode%(1) "1"
! 118: [1]=>
! 119: %string|unicode%(1) "1"
! 120: [2]=>
! 121: %string|unicode%(1) "1"
! 122: [3]=>
! 123: %string|unicode%(1) "1"
! 124: }
! 125: [%u|b%"BLOB"]=>
! 126: array(4) {
! 127: [0]=>
! 128: NULL
! 129: [1]=>
! 130: NULL
! 131: [2]=>
! 132: NULL
! 133: [3]=>
! 134: NULL
! 135: }
! 136: [%u|b%"CLOB"]=>
! 137: array(4) {
! 138: [0]=>
! 139: NULL
! 140: [1]=>
! 141: NULL
! 142: [2]=>
! 143: NULL
! 144: [3]=>
! 145: NULL
! 146: }
! 147: [%u|b%"STRING"]=>
! 148: array(4) {
! 149: [0]=>
! 150: NULL
! 151: [1]=>
! 152: NULL
! 153: [2]=>
! 154: NULL
! 155: [3]=>
! 156: NULL
! 157: }
! 158: }
! 159: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>