[ruby-oci8-commit] [426] branches/ruby-oci8-2.0: * ext/oci8/oci8.c: prevent GC on failed-logon connections from freeing

nobody at rubyforge.org nobody at rubyforge.org
Fri Jun 10 09:04:21 EDT 2011


Revision: 426
Author:   kubo
Date:     2011-06-10 09:04:21 -0400 (Fri, 10 Jun 2011)

Log Message:
-----------
* ext/oci8/oci8.c: prevent GC on failed-logon connections from freeing
    alive connections when the service context handle addresses are
    accidentally same.
* ext/oci8/ocidatetime.c: raise "OCIError: ORA-01805: possible error in
    date/time operation" when Oracle 11gR2's client and server timezone versions
    are not same instead of raising a exception "undefined method `*' for
    nil:NilClass." This is a temporary fix.
    See: http://rubyforge.org/forum/forum.php?thread_id=49102&forum_id=1078

Modified Paths:
--------------
    branches/ruby-oci8-2.0/ChangeLog
    branches/ruby-oci8-2.0/ext/oci8/oci8.c
    branches/ruby-oci8-2.0/ext/oci8/ocidatetime.c

Modified: branches/ruby-oci8-2.0/ChangeLog
===================================================================
--- branches/ruby-oci8-2.0/ChangeLog	2011-06-10 03:59:42 UTC (rev 425)
+++ branches/ruby-oci8-2.0/ChangeLog	2011-06-10 13:04:21 UTC (rev 426)
@@ -1,4 +1,14 @@
 2011-06-10  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/oci8.c: prevent GC on failed-logon connections from freeing
+	    alive connections when the service context handle addresses are
+	    accidentally same.
+	* ext/oci8/ocidatetime.c: raise "OCIError: ORA-01805: possible error in
+	    date/time operation" when Oracle 11gR2's client and server timezone versions
+	    are not same instead of raising a exception "undefined method `*' for
+	    nil:NilClass." This is a temporary fix.
+	    See: http://rubyforge.org/forum/forum.php?thread_id=49102&forum_id=1078
+
+2011-06-10  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/env.c, ext/oci8/oci8.h: Free OCI error handles on the
 	    native thread termination, not on the ruby thread termination.
 	    (reported by Jordan Curzon and Aaron Qian)

Modified: branches/ruby-oci8-2.0/ext/oci8/oci8.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/oci8.c	2011-06-10 03:59:42 UTC (rev 425)
+++ branches/ruby-oci8-2.0/ext/oci8/oci8.c	2011-06-10 13:04:21 UTC (rev 426)
@@ -263,12 +263,12 @@
                          RSTRING_ORATEXT(vpassword), RSTRING_LEN(vpassword),
                          NIL_P(vdbname) ? NULL : RSTRING_ORATEXT(vdbname),
                          NIL_P(vdbname) ? 0 : RSTRING_LEN(vdbname));
+        if (IS_OCI_ERROR(rv)) {
+            oci8_raise(oci8_errhp, rv, NULL);
+        }
         svcctx->base.hp.svc = svchp;
         svcctx->base.type = OCI_HTYPE_SVCCTX;
         svcctx->logon_type = T_IMPLICIT;
-        if (rv != OCI_SUCCESS) {
-            oci8_raise(oci8_errhp, rv, NULL);
-        }
         break;
     case T_EXPLICIT:
         /* allocate OCI handles. */

Modified: branches/ruby-oci8-2.0/ext/oci8/ocidatetime.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/ocidatetime.c	2011-06-10 03:59:42 UTC (rev 425)
+++ branches/ruby-oci8-2.0/ext/oci8/ocidatetime.c	2011-06-10 13:04:21 UTC (rev 426)
@@ -143,13 +143,10 @@
     ub4 fsec;
     sb1 tz_hour;
     sb1 tz_minute;
-    sword rv;
-    int have_tz;
 
     oci_lc(OCIDateTimeGetDate(oci8_envhp, oci8_errhp, dttm, &year, &month, &day));
     oci_lc(OCIDateTimeGetTime(oci8_envhp, oci8_errhp, dttm, &hour, &minute, &sec, &fsec));
-    rv = OCIDateTimeGetTimeZoneOffset(oci8_envhp, oci8_errhp, dttm, &tz_hour, &tz_minute);
-    have_tz = (rv == OCI_SUCCESS);
+    oci_lc(OCIDateTimeGetTimeZoneOffset(oci8_envhp, oci8_errhp, dttm, &tz_hour, &tz_minute));
     return rb_ary_new3(9,
                        INT2FIX(year),
                        INT2FIX(month),
@@ -158,8 +155,8 @@
                        INT2FIX(minute),
                        INT2FIX(sec),
                        INT2FIX(fsec),
-                       have_tz ? INT2FIX(tz_hour) : Qnil,
-                       have_tz ? INT2FIX(tz_minute) : Qnil);
+                       INT2FIX(tz_hour),
+                       INT2FIX(tz_minute));
 }
 
 OCIDateTime *oci8_set_ocitimestamp_tz(OCIDateTime *dttm, VALUE val, VALUE svc)




More information about the ruby-oci8-commit mailing list