[ruby-oci8-commit] [509] trunk/ruby-oci8: fix to raise a RuntimeError when a connection retrieved from a connection pool is set as non-blocking on ruby 1 .8.

nobody at rubyforge.org nobody at rubyforge.org
Sat Apr 21 10:57:50 UTC 2012


Revision: 509
Author:   kubo
Date:     2012-04-21 10:57:49 +0000 (Sat, 21 Apr 2012)
Log Message:
-----------
fix to raise a RuntimeError when a connection retrieved from a connection pool is set as non-blocking on ruby 1.8.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/oci8.c

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2012-04-21 06:26:26 UTC (rev 508)
+++ trunk/ruby-oci8/ChangeLog	2012-04-21 10:57:49 UTC (rev 509)
@@ -1,4 +1,9 @@
 2012-04-21  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/oci8.c: fix to raise a RuntimeError when a connection
+	    retrieved from a connection pool is set as non-blocking on 
+	    ruby 1.8.
+
+2012-04-21  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/lob.c: OCI8::LOB#read() returns an empty string '' when
 	    it is an empty lob.
 

Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c	2012-04-21 06:26:26 UTC (rev 508)
+++ trunk/ruby-oci8/ext/oci8/oci8.c	2012-04-21 10:57:49 UTC (rev 509)
@@ -338,6 +338,7 @@
 static VALUE oci8_logon2(VALUE self, VALUE username, VALUE password, VALUE dbname, VALUE mode)
 {
     oci8_svcctx_t *svcctx = DATA_PTR(self);
+    ub4 logon2_mode;
 
     if (svcctx->logoff_strategy != NULL) {
         rb_raise(rb_eRuntimeError, "Could not reuse the session.");
@@ -349,6 +350,7 @@
     if (!NIL_P(dbname)) {
         OCI8SafeStringValue(dbname);
     }
+    logon2_mode = NUM2UINT(mode);
 
     /* logon */
     svcctx->base.type = OCI_HTYPE_SVCCTX;
@@ -356,10 +358,14 @@
                         RSTRING_ORATEXT(username), RSTRING_LEN(username),
                         RSTRING_ORATEXT(password), RSTRING_LEN(password),
                         NIL_P(dbname) ? NULL : RSTRING_ORATEXT(dbname),
-                        NIL_P(dbname) ? 0 : RSTRING_LEN(dbname), NUM2UINT(mode)),
+                        NIL_P(dbname) ? 0 : RSTRING_LEN(dbname), logon2_mode),
            &svcctx->base);
     svcctx->logoff_strategy = &simple_logoff;
 
+    if (logon2_mode & OCI_LOGON2_CPOOL) {
+        svcctx->state |= OCI8_STATE_CPOOL;
+    }
+
     /* setup the session handle */
     chker2(OCIAttrGet(svcctx->base.hp.ptr, OCI_HTYPE_SVCCTX, &svcctx->usrhp, 0, OCI_ATTR_SESSION, oci8_errhp),
            &svcctx->base);



More information about the ruby-oci8-commit mailing list