Annotation of embedaddon/php/ext/oci8/tests/lob_038.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Array fetch CLOB and BLOB
! 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: echo "Test 1: CLOB\n";
! 15:
! 16: $ora_sql = "INSERT INTO
! 17: ".$schema.$table_name." (clob)
! 18: VALUES (empty_clob())
! 19: RETURNING
! 20: clob
! 21: INTO :v_clob ";
! 22:
! 23: $s = oci_parse($c,$ora_sql);
! 24: $clob = oci_new_descriptor($c,OCI_DTYPE_LOB);
! 25:
! 26:
! 27: oci_bind_by_name($s,":v_clob", $clob,-1,OCI_B_CLOB);
! 28:
! 29: oci_execute($s, OCI_DEFAULT);
! 30: var_dump($clob->save("clob test 1"));
! 31:
! 32: oci_execute($s, OCI_DEFAULT);
! 33: var_dump($clob->save("clob test 2"));
! 34:
! 35: oci_execute($s, OCI_DEFAULT);
! 36: var_dump($clob->save("clob test 3"));
! 37:
! 38:
! 39: $s = oci_parse($c,"select clob from ".$schema.$table_name);
! 40: var_dump(oci_execute($s));
! 41:
! 42: oci_fetch_all($s, $res);
! 43:
! 44: var_dump($res);
! 45:
! 46:
! 47: echo "Test 1b\n";
! 48:
! 49: $s = oci_parse($c, "select clob from ".$schema.$table_name);
! 50: var_dump(oci_execute($s, OCI_DEFAULT));
! 51: while ($row = oci_fetch_array($s, OCI_ASSOC)) {
! 52: var_dump($row);
! 53: $result = $row['CLOB']->load();
! 54: var_dump($result);
! 55: }
! 56:
! 57:
! 58: require dirname(__FILE__).'/drop_table.inc';
! 59:
! 60: echo "Test 2: BLOB\n";
! 61:
! 62: require dirname(__FILE__).'/create_table.inc';
! 63:
! 64: $ora_sql = "INSERT INTO
! 65: ".$schema.$table_name." (blob)
! 66: VALUES (empty_blob())
! 67: RETURNING
! 68: blob
! 69: INTO :v_blob ";
! 70:
! 71: $s = oci_parse($c,$ora_sql);
! 72: $blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
! 73:
! 74:
! 75: oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
! 76:
! 77: oci_execute($s, OCI_DEFAULT);
! 78: var_dump($blob->save("blob test 1"));
! 79:
! 80: oci_execute($s, OCI_DEFAULT);
! 81: var_dump($blob->save("blob test 2"));
! 82:
! 83: oci_execute($s, OCI_DEFAULT);
! 84: var_dump($blob->save("blob test 3"));
! 85:
! 86: $s = oci_parse($c, "select blob from ".$schema.$table_name);
! 87: var_dump(oci_execute($s));
! 88: oci_fetch_all($s, $res);
! 89: var_dump($res);
! 90:
! 91: echo "Test 2b\n";
! 92:
! 93: $s = oci_parse($c, "select blob from ".$schema.$table_name);
! 94: var_dump(oci_execute($s, OCI_DEFAULT));
! 95: while ($row = oci_fetch_array($s, OCI_ASSOC)) {
! 96: var_dump($row);
! 97: $result = $row['BLOB']->load();
! 98: var_dump($result);
! 99: }
! 100:
! 101:
! 102: require dirname(__FILE__).'/drop_table.inc';
! 103:
! 104: echo "Done\n";
! 105:
! 106: ?>
! 107: --EXPECTF--
! 108: Test 1: CLOB
! 109: bool(true)
! 110: bool(true)
! 111: bool(true)
! 112: bool(true)
! 113: array(1) {
! 114: ["CLOB"]=>
! 115: array(3) {
! 116: [0]=>
! 117: string(11) "clob test 1"
! 118: [1]=>
! 119: string(11) "clob test 2"
! 120: [2]=>
! 121: string(11) "clob test 3"
! 122: }
! 123: }
! 124: Test 1b
! 125: bool(true)
! 126: array(1) {
! 127: ["CLOB"]=>
! 128: object(OCI-Lob)#2 (1) {
! 129: ["descriptor"]=>
! 130: resource(%d) of type (oci8 descriptor)
! 131: }
! 132: }
! 133: string(11) "clob test 1"
! 134: array(1) {
! 135: ["CLOB"]=>
! 136: object(OCI-Lob)#3 (1) {
! 137: ["descriptor"]=>
! 138: resource(%d) of type (oci8 descriptor)
! 139: }
! 140: }
! 141: string(11) "clob test 2"
! 142: array(1) {
! 143: ["CLOB"]=>
! 144: object(OCI-Lob)#2 (1) {
! 145: ["descriptor"]=>
! 146: resource(%d) of type (oci8 descriptor)
! 147: }
! 148: }
! 149: string(11) "clob test 3"
! 150: Test 2: BLOB
! 151: bool(true)
! 152: bool(true)
! 153: bool(true)
! 154: bool(true)
! 155: array(1) {
! 156: ["BLOB"]=>
! 157: array(3) {
! 158: [0]=>
! 159: string(11) "blob test 1"
! 160: [1]=>
! 161: string(11) "blob test 2"
! 162: [2]=>
! 163: string(11) "blob test 3"
! 164: }
! 165: }
! 166: Test 2b
! 167: bool(true)
! 168: array(1) {
! 169: ["BLOB"]=>
! 170: object(OCI-Lob)#3 (1) {
! 171: ["descriptor"]=>
! 172: resource(%d) of type (oci8 descriptor)
! 173: }
! 174: }
! 175: string(11) "blob test 1"
! 176: array(1) {
! 177: ["BLOB"]=>
! 178: object(OCI-Lob)#4 (1) {
! 179: ["descriptor"]=>
! 180: resource(%d) of type (oci8 descriptor)
! 181: }
! 182: }
! 183: string(11) "blob test 2"
! 184: array(1) {
! 185: ["BLOB"]=>
! 186: object(OCI-Lob)#3 (1) {
! 187: ["descriptor"]=>
! 188: resource(%d) of type (oci8 descriptor)
! 189: }
! 190: }
! 191: string(11) "blob test 3"
! 192: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>