Annotation of embedaddon/php/ext/oci8/tests/field_funcs2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #41917 (invalid scale and precision)
! 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: $s = oci_parse($c, 'drop table field_funcs2_tab');
! 11: @oci_execute($s);
! 12:
! 13: $t = array("C01" => "NUMBER",
! 14: "C02" => "NUMBER(*,1)",
! 15: "C03" => "NUMBER(9)",
! 16: "C04" => "NUMBER(9,2)",
! 17: "C05" => "NUMBER(9,1)",
! 18: "C06" => "NUMBER(7,-2)",
! 19: "C07" => "DECIMAL(4,9)",
! 20: "C08" => "NUMERIC(4,9)",
! 21: "C09" => "DECIMAL(4)",
! 22: "C10" => "INTEGER",
! 23: "C11" => "INT",
! 24: "C12" => "SMALLINT",
! 25: "C13" => "FLOAT",
! 26: "C14" => "FLOAT(9)",
! 27: "C15" => "DOUBLE PRECISION",
! 28: "C16" => "REAL",
! 29: );
! 30:
! 31: $stmt = "create table field_funcs2_tab (\n";
! 32: foreach ($t as $colname => $type) {
! 33: $stmt .= "$colname $type,\n";
! 34: }
! 35: $stmt[strlen($stmt)-2] = ")";
! 36:
! 37: $s = oci_parse($c, $stmt);
! 38: oci_execute($s);
! 39:
! 40: $s = oci_parse($c, "select * from field_funcs2_tab");
! 41: oci_execute($s);
! 42:
! 43: for ($i = 1; $i <= oci_num_fields($s); $i++) {
! 44: $name = oci_field_name($s, $i);
! 45: $precision = oci_field_precision($s, $i);
! 46: $scale = oci_field_scale($s, $i);
! 47: echo "$name ".$t[$name] .": precision $precision, scale $scale\n";
! 48: }
! 49:
! 50: echo "Done\n";
! 51: ?>
! 52: --EXPECT--
! 53: C01 NUMBER: precision 0, scale -127
! 54: C02 NUMBER(*,1): precision 38, scale 1
! 55: C03 NUMBER(9): precision 9, scale 0
! 56: C04 NUMBER(9,2): precision 9, scale 2
! 57: C05 NUMBER(9,1): precision 9, scale 1
! 58: C06 NUMBER(7,-2): precision 7, scale -2
! 59: C07 DECIMAL(4,9): precision 4, scale 9
! 60: C08 NUMERIC(4,9): precision 4, scale 9
! 61: C09 DECIMAL(4): precision 4, scale 0
! 62: C10 INTEGER: precision 38, scale 0
! 63: C11 INT: precision 38, scale 0
! 64: C12 SMALLINT: precision 38, scale 0
! 65: C13 FLOAT: precision 126, scale -127
! 66: C14 FLOAT(9): precision 9, scale -127
! 67: C15 DOUBLE PRECISION: precision 126, scale -127
! 68: C16 REAL: precision 63, scale -127
! 69: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>