Annotation of embedaddon/php/ext/oci8/tests/bind_sqltint.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bind with SQLT_INT
! 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: // Initialization
! 11:
! 12: $stmtarray = array(
! 13: "drop table bind_sqltint_tab",
! 14:
! 15: "create table bind_sqltint_tab (
! 16: id number,
! 17: varchar2_t10 varchar2(10),
! 18: number_t number,
! 19: number_t92 number(9,2))",
! 20:
! 21: );
! 22:
! 23: oci8_test_sql_execute($c, $stmtarray);
! 24:
! 25: function check_col($c, $colname, $id)
! 26: {
! 27: $s = oci_parse($c, "select $colname from bind_sqltint_tab where id = :id");
! 28: oci_bind_by_name($s, ":id", $id);
! 29: oci_execute($s);
! 30: oci_fetch_all($s, $r);
! 31: var_dump($r);
! 32: }
! 33:
! 34: // Run Test
! 35:
! 36: echo "\nTEST141 wrong bind type SQLT_INT\n";
! 37:
! 38: $c2 = "Hood141";
! 39: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, varchar2_t10) VALUES (141, :c2)");
! 40: oci_bind_by_name($s, ":c2", $c2, -1, SQLT_INT);
! 41: oci_execute($s);
! 42:
! 43: check_col($c, 'varchar2_t10', 141);
! 44:
! 45: echo "\nTEST142 insert numbers SQLT_INT\n";
! 46:
! 47: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (142, :n1)");
! 48: $n1 = 42;
! 49: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 50: oci_execute($s);
! 51:
! 52: check_col($c, 'number_t', 142);
! 53:
! 54: echo "\nTEST143 insert numbers, SQLT_INT\n";
! 55:
! 56: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (143, :n1)");
! 57: $n1 = 42.69;
! 58: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 59: oci_execute($s);
! 60:
! 61: check_col($c, 'number_t', 143);
! 62:
! 63: echo "\nTEST144 insert numbers with SQLT_INT\n";
! 64:
! 65: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (144, :n1)");
! 66: $n1 = 0;
! 67: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 68: oci_execute($s);
! 69:
! 70: check_col($c, 'number_t', 144);
! 71:
! 72: echo "\nTEST145 insert numbers with SQLT_INT\n";
! 73:
! 74: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (145, :n1)");
! 75: $n1 = -23;
! 76: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 77: oci_execute($s);
! 78:
! 79: check_col($c, 'number_t', 145);
! 80:
! 81: echo "\nTEST146 insert numbers\n";
! 82:
! 83: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (146, :n1)");
! 84: $n1 = "-23";
! 85: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 86: oci_execute($s);
! 87:
! 88: check_col($c, 'number_t', 146);
! 89:
! 90: echo "\nTEST147 insert numbers with SQLT_INT\n";
! 91:
! 92: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (147, :n1)");
! 93: $n1 = "23";
! 94: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 95: oci_execute($s);
! 96:
! 97: check_col($c, 'number_t', 147);
! 98:
! 99: echo "\nTEST148 insert numbers with SQLT_INT\n";
! 100:
! 101: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (148, :n1)");
! 102: $n1 = 123.56;
! 103: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 104: oci_execute($s);
! 105:
! 106: check_col($c, 'number_t92', 148);
! 107:
! 108: echo "\nTEST149 insert numbers with SQLT_INT\n";
! 109:
! 110: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (149, :n1)");
! 111: $n1 = "123.56";
! 112: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 113: oci_execute($s);
! 114:
! 115: check_col($c, 'number_t92', 149);
! 116:
! 117: echo "\nTEST150 insert numbers with SQLT_INT\n";
! 118:
! 119: $s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (150, :n1)");
! 120: $n1 = "";
! 121: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
! 122: oci_execute($s);
! 123:
! 124: check_col($c, 'number_t92', 150);
! 125:
! 126: // Clean up
! 127:
! 128: $stmtarray = array(
! 129: "drop table bind_sqltint_tab"
! 130: );
! 131:
! 132: oci8_test_sql_execute($c, $stmtarray);
! 133:
! 134: ?>
! 135: ===DONE===
! 136: <?php exit(0); ?>
! 137: --EXPECTF--
! 138: TEST141 wrong bind type SQLT_INT
! 139: array(1) {
! 140: ["VARCHAR2_T10"]=>
! 141: array(1) {
! 142: [0]=>
! 143: string(1) "0"
! 144: }
! 145: }
! 146:
! 147: TEST142 insert numbers SQLT_INT
! 148: array(1) {
! 149: ["NUMBER_T"]=>
! 150: array(1) {
! 151: [0]=>
! 152: string(2) "42"
! 153: }
! 154: }
! 155:
! 156: TEST143 insert numbers, SQLT_INT
! 157: array(1) {
! 158: ["NUMBER_T"]=>
! 159: array(1) {
! 160: [0]=>
! 161: string(2) "42"
! 162: }
! 163: }
! 164:
! 165: TEST144 insert numbers with SQLT_INT
! 166: array(1) {
! 167: ["NUMBER_T"]=>
! 168: array(1) {
! 169: [0]=>
! 170: string(1) "0"
! 171: }
! 172: }
! 173:
! 174: TEST145 insert numbers with SQLT_INT
! 175: array(1) {
! 176: ["NUMBER_T"]=>
! 177: array(1) {
! 178: [0]=>
! 179: string(3) "-23"
! 180: }
! 181: }
! 182:
! 183: TEST146 insert numbers
! 184: array(1) {
! 185: ["NUMBER_T"]=>
! 186: array(1) {
! 187: [0]=>
! 188: string(3) "-23"
! 189: }
! 190: }
! 191:
! 192: TEST147 insert numbers with SQLT_INT
! 193: array(1) {
! 194: ["NUMBER_T"]=>
! 195: array(1) {
! 196: [0]=>
! 197: string(2) "23"
! 198: }
! 199: }
! 200:
! 201: TEST148 insert numbers with SQLT_INT
! 202: array(1) {
! 203: ["NUMBER_T92"]=>
! 204: array(1) {
! 205: [0]=>
! 206: string(3) "123"
! 207: }
! 208: }
! 209:
! 210: TEST149 insert numbers with SQLT_INT
! 211: array(1) {
! 212: ["NUMBER_T92"]=>
! 213: array(1) {
! 214: [0]=>
! 215: string(3) "123"
! 216: }
! 217: }
! 218:
! 219: TEST150 insert numbers with SQLT_INT
! 220: array(1) {
! 221: ["NUMBER_T92"]=>
! 222: array(1) {
! 223: [0]=>
! 224: string(1) "0"
! 225: }
! 226: }
! 227: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>