[ruby-oci8-commit] [244] trunk/ruby-oci8: * ext/oci8/object.c, ext/oci8/stmt.c:

nobody at rubyforge.org nobody at rubyforge.org
Sun Feb 17 09:58:07 EST 2008


Revision: 244
Author:   kubo
Date:     2008-02-17 09:58:06 -0500 (Sun, 17 Feb 2008)

Log Message:
-----------
* ext/oci8/object.c, ext/oci8/stmt.c:
    change from:
      switch (fixnum_value) {
      case INT2FIX(INT_CONSTANT):
        ....;
    to:
      switch (FIX2INT(fixnum_value)) {
      case INT_CONSTANT:
        ....;
    "case INT2FIX(INT_CONSTANT)" confuses astyle.
    astyle's URL: http://astyle.sourceforge.net
* test/config.rb: sleep 5 seconds and retry again when
    ORA-12516 or ORA-12520. One second was too short on
    my new linux box.
* test/test_oci8.rb: fix a test case for x86_64 linux.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/object.c
    trunk/ruby-oci8/ext/oci8/stmt.c
    trunk/ruby-oci8/test/config.rb
    trunk/ruby-oci8/test/test_oci8.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2008-02-17 10:31:02 UTC (rev 243)
+++ trunk/ruby-oci8/ChangeLog	2008-02-17 14:58:06 UTC (rev 244)
@@ -1,3 +1,20 @@
+2008-02-17  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/object.c, ext/oci8/stmt.c:
+	    change from:
+	      switch (fixnum_value) {
+	      case INT2FIX(INT_CONSTANT):
+	        ....;
+	    to:
+	      switch (FIX2INT(fixnum_value)) {
+	      case INT_CONSTANT:
+	        ....;
+	    "case INT2FIX(INT_CONSTANT)" confuses astyle.
+	    astyle's URL: http://astyle.sourceforge.net
+	* test/config.rb: sleep 5 seconds and retry again when
+	    ORA-12516 or ORA-12520. One second was too short on
+	    my new linux box.
+	* test/test_oci8.rb: fix a test case for x86_64 linux.
+
 2008-01-14  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/extconf.rb: add checking code for intern.h, util.h,
 	    ruby/util.h, ruby_errinfo and rb_errinfo.

Modified: trunk/ruby-oci8/ext/oci8/object.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/object.c	2008-02-17 10:31:02 UTC (rev 243)
+++ trunk/ruby-oci8/ext/oci8/object.c	2008-02-17 14:58:06 UTC (rev 244)
@@ -347,20 +347,20 @@
         oci_lc(OCICollTrim(oci8_envhp, oci8_errhp, size - RARRAY_LEN(val), coll));
     }
     for (idx = 0; idx < RARRAY_LEN(val); idx++) {
-        switch (datatype) {
-        case INT2FIX(ATTR_NAMED_TYPE):
+        switch (FIX2INT(datatype)) {
+        case ATTR_NAMED_TYPE:
             set_attribute(self, datatype, typeinfo, cb_data->data.ptr, elem_ind_ptr, RARRAY_PTR(val)[idx]);
             break;
         default:
             set_attribute(self, datatype, typeinfo, (void*)&cb_data->data, elem_ind_ptr, RARRAY_PTR(val)[idx]);
             break;
         }
-        switch (datatype) {
-        case INT2FIX(ATTR_OCINUMBER):
-        case INT2FIX(ATTR_FLOAT):
-        case INT2FIX(ATTR_INTEGER):
-        case INT2FIX(ATTR_BINARY_DOUBLE):
-        case INT2FIX(ATTR_BINARY_FLOAT):
+        switch (FIX2INT(datatype)) {
+        case ATTR_OCINUMBER:
+        case ATTR_FLOAT:
+        case ATTR_INTEGER:
+        case ATTR_BINARY_DOUBLE:
+        case ATTR_BINARY_FLOAT:
             elem_ptr = &cb_data->data;
             break;
         default:

Modified: trunk/ruby-oci8/ext/oci8/stmt.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/stmt.c	2008-02-17 10:31:02 UTC (rev 243)
+++ trunk/ruby-oci8/ext/oci8/stmt.c	2008-02-17 14:58:06 UTC (rev 244)
@@ -480,26 +480,26 @@
 static VALUE oci8_stmt_get_stmt_type(VALUE self)
 {
     VALUE stmt_type = oci8_get_ub2_attr(DATA_PTR(self), OCI_ATTR_STMT_TYPE);
-    switch (stmt_type) {
-    case INT2FIX(OCI_STMT_SELECT):
+    switch (FIX2INT(stmt_type)) {
+    case OCI_STMT_SELECT:
         return oci8_sym_select_stmt;
-    case INT2FIX(OCI_STMT_UPDATE):
+    case OCI_STMT_UPDATE:
         return oci8_sym_update_stmt;
-    case INT2FIX(OCI_STMT_DELETE):
+    case OCI_STMT_DELETE:
         return oci8_sym_delete_stmt;
-    case INT2FIX(OCI_STMT_INSERT):
+    case OCI_STMT_INSERT:
         return oci8_sym_insert_stmt;
-    case INT2FIX(OCI_STMT_CREATE):
+    case OCI_STMT_CREATE:
         return oci8_sym_create_stmt;
-    case INT2FIX(OCI_STMT_DROP):
+    case OCI_STMT_DROP:
         return oci8_sym_drop_stmt;
-    case INT2FIX(OCI_STMT_ALTER):
+    case OCI_STMT_ALTER:
         return oci8_sym_alter_stmt;
-    case INT2FIX(OCI_STMT_BEGIN):
+    case OCI_STMT_BEGIN:
         return oci8_sym_begin_stmt;
-    case INT2FIX(OCI_STMT_DECLARE):
+    case OCI_STMT_DECLARE:
         return oci8_sym_declare_stmt;
-    case INT2FIX(0):
+    case 0:
         return oci8_sym_other;
     default:
         rb_bug("unexcepted statement type %d in OCIStmt#stmt_type", FIX2INT(stmt_type));

Modified: trunk/ruby-oci8/test/config.rb
===================================================================
--- trunk/ruby-oci8/test/config.rb	2008-02-17 10:31:02 UTC (rev 243)
+++ trunk/ruby-oci8/test/config.rb	2008-02-17 14:58:06 UTC (rev 244)
@@ -56,7 +56,7 @@
         OCI8.new($dbuser, $dbpass, $dbname)
       rescue OCIError
         raise if $!.code != 12516 && $!.code != 12520
-        # sleep one second and try again if
+        # sleep a few second and try again if
         # the error code is ORA-12516 or ORA-12520.
         #
         # ORA-12516 - TNS:listener could not find available handler with
@@ -69,7 +69,7 @@
         # Ref: The Underground PHP and Oracle Manual (page 175 in vesion 1.4)
         #      http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf
         #
-        sleep(1)
+        sleep(5)
         OCI8.new($dbuser, $dbpass, $dbname)
       end
 
@@ -78,7 +78,7 @@
       rescue DBI::DatabaseError
         raise if $!.err != 12516 && $!.err != 12520
         # same as get_oci8_connection()
-        sleep(1)
+        sleep(5)
         DBI.connect("dbi:OCI8:#{$dbname}", $dbuser, $dbpass, 'AutoCommit' => false)
       end
 

Modified: trunk/ruby-oci8/test/test_oci8.rb
===================================================================
--- trunk/ruby-oci8/test/test_oci8.rb	2008-02-17 10:31:02 UTC (rev 243)
+++ trunk/ruby-oci8/test/test_oci8.rb	2008-02-17 14:58:06 UTC (rev 244)
@@ -299,7 +299,7 @@
   def test_select_number
     drop_table('test_table')
     @conn.exec(<<EOS)
-CREATE TABLE test_table (n NUMBER, n14 NUMBER(14), n14_2 NUMBER(14,2), n15_2 NUMBER(15,2), flt FLOAT)
+CREATE TABLE test_table (n NUMBER, n20 NUMBER(20), n14_2 NUMBER(14,2), n15_2 NUMBER(15,2), flt FLOAT)
 STORAGE (
    INITIAL 100k
    NEXT 100k
@@ -308,11 +308,11 @@
    PCTINCREASE 0)
 EOS
     @conn.exec(<<EOS)
-INSERT INTO test_table values(12345678901234, 12345678901234, 123456789012.34, 1234567890123.45, 1234.5)
+INSERT INTO test_table values(12345678901234, 12345678901234567890, 123456789012.34, 1234567890123.45, 1234.5)
 EOS
     @conn.exec("select * from test_table") do |row|
       assert_equal(row[0], 12345678901234)
-      assert_equal(row[1], 12345678901234)
+      assert_equal(row[1], 12345678901234567890)
       assert_equal(row[2], 123456789012.34)
       assert_equal(row[3], 1234567890123.45)
       assert_equal(row[4], 1234.5)




More information about the ruby-oci8-commit mailing list