sixd            Fri Jul  6 23:31:36 2007 UTC

  Modified files:              
    /php-src/ext/oci8/tests     field_funcs2.phpt field_funcs_old.phpt 
                                field_funcs.phpt 
  Log:
  Bug #41917: New OCI8 tests for scale and precision
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/field_funcs2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/oci8/tests/field_funcs2.phpt
diff -u /dev/null php-src/ext/oci8/tests/field_funcs2.phpt:1.2
--- /dev/null   Fri Jul  6 23:31:36 2007
+++ php-src/ext/oci8/tests/field_funcs2.phpt    Fri Jul  6 23:31:36 2007
@@ -0,0 +1,70 @@
+--TEST--
+Bug #41917 (invalid scale and precision)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$s = oci_parse($c, 'drop table b41917t');
[EMAIL PROTECTED]($s);
+
+$t = array("C01" => "NUMBER",
+                  "C02" => "NUMBER(*,1)",
+                  "C03" => "NUMBER(9)",
+                  "C04" => "NUMBER(9,2)",
+                  "C05" => "NUMBER(9,1)",
+                  "C06" => "NUMBER(7,-2)",
+                  "C07" => "DECIMAL(4,9)",
+                  "C08" => "NUMERIC(4,9)",
+                  "C09" => "DECIMAL(4)",
+                  "C10" => "INTEGER",
+                  "C11" => "INT",
+                  "C12" => "SMALLINT",
+                  "C13" => "FLOAT",
+                  "C14" => "FLOAT(9)",
+                  "C15" => "DOUBLE PRECISION",
+                  "C16" => "REAL",
+                  );
+
+$stmt = "create table b41917t (\n";
+foreach ($t as $colname => $type) {
+       $stmt .= "$colname $type,\n";
+}
+$stmt[strlen($stmt)-2] = ")";
+
+$s = oci_parse($c, $stmt);
+oci_execute($s);
+
+$s = oci_parse($c, "select * from b41917t");
+oci_execute($s);
+
+for ($i = 1; $i <= oci_num_fields($s); $i++) {
+       $name = oci_field_name($s, $i);
+       $precision = oci_field_precision($s, $i);
+       $scale = oci_field_scale($s, $i);
+       echo "$name ".$t[$name] .": precision $precision, scale $scale\n";
+}
+
+echo "Done\n";
+?>
+--EXPECT--
+C01 NUMBER: precision 0, scale -127
+C02 NUMBER(*,1): precision 38, scale 1
+C03 NUMBER(9): precision 9, scale 0
+C04 NUMBER(9,2): precision 9, scale 2
+C05 NUMBER(9,1): precision 9, scale 1
+C06 NUMBER(7,-2): precision 7, scale -2
+C07 DECIMAL(4,9): precision 4, scale 9
+C08 NUMERIC(4,9): precision 4, scale 9
+C09 DECIMAL(4): precision 4, scale 0
+C10 INTEGER: precision 38, scale 0
+C11 INT: precision 38, scale 0
+C12 SMALLINT: precision 38, scale 0
+C13 FLOAT: precision 126, scale -127
+C14 FLOAT(9): precision 9, scale -127
+C15 DOUBLE PRECISION: precision 126, scale -127
+C16 REAL: precision 63, scale -127
+Done
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/field_funcs_old.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/oci8/tests/field_funcs_old.phpt
diff -u php-src/ext/oci8/tests/field_funcs_old.phpt:1.6 
php-src/ext/oci8/tests/field_funcs_old.phpt:1.7
--- php-src/ext/oci8/tests/field_funcs_old.phpt:1.6     Fri Nov 10 16:56:19 2006
+++ php-src/ext/oci8/tests/field_funcs_old.phpt Fri Jul  6 23:31:36 2007
@@ -54,7 +54,7 @@
 echo "Done\n";
 
 ?>
---EXPECTF--
+--EXPECT--
 array(5) {
   [0]=>
   string(1) "1"
@@ -71,14 +71,14 @@
 string(2) "ID"
 string(6) "NUMBER"
 int(2)
-int(%d)
+int(-127)
 int(0)
 int(22)
 bool(false)
 string(5) "VALUE"
 string(6) "NUMBER"
 int(2)
-int(%d)
+int(-127)
 int(0)
 int(22)
 bool(true)
@@ -103,7 +103,7 @@
 int(0)
 int(10)
 Done
---UEXPECTF--
+--UEXPECT--
 array(5) {
   [0]=>
   unicode(1) "1"
@@ -120,14 +120,14 @@
 unicode(2) "ID"
 unicode(6) "NUMBER"
 int(2)
-int(0)
+int(-127)
 int(0)
 int(22)
 bool(false)
 unicode(5) "VALUE"
 unicode(6) "NUMBER"
 int(2)
-int(0)
+int(-127)
 int(0)
 int(22)
 bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/field_funcs.phpt?r1=1.7&r2=1.8&diff_format=u
Index: php-src/ext/oci8/tests/field_funcs.phpt
diff -u php-src/ext/oci8/tests/field_funcs.phpt:1.7 
php-src/ext/oci8/tests/field_funcs.phpt:1.8
--- php-src/ext/oci8/tests/field_funcs.phpt:1.7 Fri Nov 10 16:56:19 2006
+++ php-src/ext/oci8/tests/field_funcs.phpt     Fri Jul  6 23:31:36 2007
@@ -54,7 +54,7 @@
 echo "Done\n";
 
 ?>
---EXPECTF--
+--EXPECT--
 array(5) {
   [0]=>
   string(1) "1"
@@ -71,14 +71,14 @@
 string(2) "ID"
 string(6) "NUMBER"
 int(2)
-int(%d)
+int(-127)
 int(0)
 int(22)
 bool(false)
 string(5) "VALUE"
 string(6) "NUMBER"
 int(2)
-int(%d)
+int(-127)
 int(0)
 int(22)
 bool(true)
@@ -103,7 +103,7 @@
 int(0)
 int(10)
 Done
---UEXPECTF--
+--UEXPECT--
 array(5) {
   [0]=>
   unicode(1) "1"
@@ -120,14 +120,14 @@
 unicode(2) "ID"
 unicode(6) "NUMBER"
 int(2)
-int(0)
+int(-127)
 int(0)
 int(22)
 bool(false)
 unicode(5) "VALUE"
 unicode(6) "NUMBER"
 int(2)
-int(0)
+int(-127)
 int(0)
 int(22)
 bool(true)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to