[ruby-oci8-commit] [250] trunk/ruby-oci8: * ext/oci8/apiwrap.c.tmpl, ext/oci8/apiwrap.h.tmpl:

nobody at rubyforge.org nobody at rubyforge.org
Thu Mar 6 09:06:04 EST 2008


Revision: 250
Author:   kubo
Date:     2008-03-06 09:06:04 -0500 (Thu, 06 Mar 2008)

Log Message:
-----------
* ext/oci8/apiwrap.c.tmpl, ext/oci8/apiwrap.h.tmpl:
    rewrite apiwrap.[ch].tmpl. All non-static variables
    and functions have 'oci8_' prefix name.
* ext/oci8/apiwrap.rb, ext/oci8/apiwrap.yml,
  ext/oci8/extconf.rb: change format of apiwrap.yml
    to use both OCIAttrGet() and OCIAttrGet_nb().
* ext/oci8/oci8.c, test/config.rb: add OCI8.oracle_client_version.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/apiwrap.c.tmpl
    trunk/ruby-oci8/ext/oci8/apiwrap.h.tmpl
    trunk/ruby-oci8/ext/oci8/apiwrap.rb
    trunk/ruby-oci8/ext/oci8/apiwrap.yml
    trunk/ruby-oci8/ext/oci8/extconf.rb
    trunk/ruby-oci8/ext/oci8/oci8.c
    trunk/ruby-oci8/test/config.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/ChangeLog	2008-03-06 14:06:04 UTC (rev 250)
@@ -1,3 +1,12 @@
+2008-03-06  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/apiwrap.c.tmpl, ext/oci8/apiwrap.h.tmpl:
+	    rewrite apiwrap.[ch].tmpl. All non-static variables
+	    and functions have 'oci8_' prefix name.
+	* ext/oci8/apiwrap.rb, ext/oci8/apiwrap.yml,
+	  ext/oci8/extconf.rb: change format of apiwrap.yml
+	    to use both OCIAttrGet() and OCIAttrGet_nb().
+	* ext/oci8/oci8.c, test/config.rb: add OCI8.oracle_client_version.
+
 2008-03-05  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/env.c, ext/oci8/oci8.h: use native API to get a thread
 	    local errhp (ruby 1.9 only)

Modified: trunk/ruby-oci8/ext/oci8/apiwrap.c.tmpl
===================================================================
--- trunk/ruby-oci8/ext/oci8/apiwrap.c.tmpl	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/ext/oci8/apiwrap.c.tmpl	2008-03-06 14:06:04 UTC (rev 250)
@@ -5,89 +5,72 @@
 #define API_WRAP_C 1
 #include "apiwrap.h"
 <%
+prev_name = ''
 funcs.each do |f|
-  if f.version == 800
-    if f.remote
-######################################################################
-##
-## remote API without runtime-check - start
-##
-######################################################################
+  next if f.name == prev_name
+  prev_name = f.name
 %>
-/*
- * <%=f.name%>
- */
-typedef struct {
-<% f.args.each do |a|
-%>    <%= a.dcl %>;
-<% end
-%>} <%=f.name%>_data_t;
-
-static VALUE <%=f.name%>_cb(void *user_data)
-{
-    <%=f.name%>_data_t *data = (<%=f.name%>_data_t *)user_data;
-    return (VALUE)<%=f.name%>(<%= f.args.collect do |a| 'data->' + a.name; end.join(', ') %>);
-}
-
-sword <%=f.name%>_nb(oci8_svcctx_t *svcctx, <%=f.args.collect {|arg| arg.dcl}.join(', ')%>)
-{
-    <%=f.name%>_data_t data;
-<% f.args.each do |a|
-%>    data.<%=a.name%> = <%=a.name%>;
-<% end
-%>    return oci8_blocking_region(svcctx, <%=f.name%>_cb, &data);
-}
+/* <%=f.name%> */
+#if defined RUNTIME_API_CHECK
+typedef <%=f.ret%> (*oci8_<%=f.name%>_func_t)(<%=f.args.collect {|arg| arg.dcl}.join(', ')%>);
+static oci8_<%=f.name%>_func_t oci8_<%=f.name%>_func;
+#define <%=f.name%> oci8_<%=f.name%>_func
+#elif ORACLE_CLIENT_VERSION < <%=f.version%>
+#define <%=f.name%>(<%=f.args.collect {|a| a.name}.join(', ')%>) (0)
+#endif
 <%
+end # funcs.each
+
+funcs.each do |f|
+  if f.remote
 ######################################################################
 ##
-## remote API without runtime-check - end
-##
-######################################################################
-    end
-  else # f.version == 800
-    if f.remote
-######################################################################
-##
 ## remote API with runtime-check - start
 ##
 ######################################################################
 %>
 /*
- * <%=f.name%>
+ * <%=f.name%>_nb
  */
 typedef struct {
 <% f.args.each do |a|
 %>    <%= a.dcl %>;
 <% end
-%>} <%=f.name%>_data_t;
+%>} oci8_<%=f.name%>_data_t;
 
 #if defined RUNTIME_API_CHECK
-int have_<%=f.name%>_nb;
-typedef sword (*<%=f.name%>_func_t)(<%=f.args.collect {|arg| arg.dcl}.join(', ')%>);
-static <%=f.name%>_func_t <%=f.name%>_func;
-#define <%=f.name%> <%=f.name%>_func
+int oci8_have_<%=f.name%>_nb;
 #endif
 
 #if defined RUNTIME_API_CHECK || ORACLE_CLIENT_VERSION >= <%=f.version%>
-static VALUE <%=f.name%>_cb(void *user_data)
+static VALUE oci8_<%=f.name%>_cb(void *user_data)
 {
-    <%=f.name%>_data_t *data = (<%=f.name%>_data_t *)user_data;
-    return (VALUE)<%=f.name%>(<%= f.args.collect do |a| 'data->' + a.name; end.join(', ') %>);
+    oci8_<%=f.name%>_data_t *data = (oci8_<%=f.name%>_data_t *)user_data;
+<% if f.ret == 'void'
+%>    (VALUE)<%=f.name%>(<%= f.args.collect do |a| 'data->' + a.name; end.join(', ') %>);
+    return Qnil;
+<% else
+%>    return (VALUE)<%=f.name%>(<%= f.args.collect do |a| 'data->' + a.name; end.join(', ') %>);
+<% end %>
 }
 #else
-#define <%=f.name%>_cb NULL /* dummy value to pass compiilation. */
+#define oci8_<%=f.name%>_cb NULL
 #endif
 
-sword <%=f.name%>_nb(oci8_svcctx_t *svcctx, <%=f.args.collect {|arg| arg.dcl}.join(', ')%>)
+<%=f.ret%> oci8_<%=f.name%>_nb(oci8_svcctx_t *svcctx, <%=f.args.collect {|arg| arg.dcl}.join(', ')%>, const char *file, int line)
 {
     if (have_<%=f.name%>_nb) {
-        <%=f.name%>_data_t data;
+        oci8_<%=f.name%>_data_t data;
 <% f.args.each do |a|
 %>        data.<%=a.name%> = <%=a.name%>;
 <% end
-%>        return oci8_blocking_region(svcctx, <%=f.name%>_cb, &data);
-    } else {
-        rb_bug("undefined OCI function %s is called", "<%=f.name%>_nb");
+   if f.ret == 'void'
+%>        oci8_blocking_region(svcctx, oci8_<%=f.name%>_cb, &data);
+<% else
+%>        return oci8_blocking_region(svcctx, oci8_<%=f.name%>_cb, &data);
+<% end
+%>    } else {
+        rb_raise(rb_eRuntimeError, "undefined OCI function %s is called", "<%=f.name%>_nb");
     }
 }
 <%
@@ -96,7 +79,7 @@
 ## remote API with runtime-check - end
 ##
 ######################################################################
-    else
+  else
 ######################################################################
 ##
 ## local API with runtime-check - start
@@ -107,27 +90,19 @@
  * <%=f.name%>
  */
 #if defined RUNTIME_API_CHECK
-int have_<%=f.name%>;
-typedef sword (*<%=f.name%>_func_t)(<%=f.args.collect {|arg| arg.dcl}.join(', ')%>);
-static <%=f.name%>_func_t <%=f.name%>_func;
-#elif ORACLE_CLIENT_VERSION >= <%=f.version%>
-#define <%=f.name%>_func <%=f.name%>
-#else
-#define <%=f.name%>_func(<%=f.args.collect {|arg| arg.name}.join(', ')%>) (0)
+int oci8_have_<%=f.name%>;
 #endif
 
-sword <%=f.name%>_fn(<%=f.args.collect {|arg| arg.dcl}.join(', ')%>)
+<%=f.ret%> oci8_<%=f.name%>(<%=f.args.collect {|arg| arg.dcl}.join(', ')%>, const char *file, int line)
 {
     if (have_<%=f.name%>) {
-#if defined RUNTIME_API_CHECK
-        return <%=f.name%>_func(<%=f.args.collect {|arg| arg.name}.join(', ')%>);
-#elif ORACLE_CLIENT_VERSION >= <%=f.version%>
-        return <%=f.name%>(<%=f.args.collect {|arg| arg.name}.join(', ')%>);
-#else
-        return 0;
-#endif
-    } else {
-        rb_bug("undefined OCI function %s is called", "<%=f.name%>_nb");
+<%  if f.ret == 'void'
+%>        <%=f.name%>(<%=f.args.collect {|arg| arg.name}.join(', ')%>);
+<%  else
+%>        return <%=f.name%>(<%=f.args.collect {|arg| arg.name}.join(', ')%>);
+<% end
+%>    } else {
+        rb_raise(rb_eRuntimeError, "undefined OCI function %s is called", "<%=f.name%>");
     }
 }
 <%
@@ -136,7 +111,6 @@
 ## local API with runtime-check - end
 ##
 ######################################################################
-    end
   end
 end # funcs.each
 ######################################################################
@@ -152,10 +126,9 @@
 
 void Init_oci8_apiwrap(void)
 {
-    oracle_client_version = 800;
+    oracle_client_version = 0;
 <%
 funcs.each do |f|
-  next if f.version == 800
   if current_version != f.version
     unless have_vars.empty?
 %>    /* pass Oracle <%=current_version.to_s.gsub(/(.)(.)$/, '.\1.\2')%> API */
@@ -173,8 +146,8 @@
 <%
   end
   have_vars << 'have_' + f.name + (f.remote ? '_nb' : '')
-%>    <%=f.name%>_func = (<%=f.name%>_func_t)oci8_find_symbol("<%=f.name%>");
-    if (<%=f.name%>_func == NULL)
+%>    oci8_<%=f.name%>_func = (oci8_<%=f.name%>_func_t)oci8_find_symbol("<%=f.name%>");
+    if (oci8_<%=f.name%>_func == NULL)
         return;
 <%
 end

Modified: trunk/ruby-oci8/ext/oci8/apiwrap.h.tmpl
===================================================================
--- trunk/ruby-oci8/ext/oci8/apiwrap.h.tmpl	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/ext/oci8/apiwrap.h.tmpl	2008-03-06 14:06:04 UTC (rev 250)
@@ -14,56 +14,48 @@
 #endif
 <%
 funcs.each do |f|
-  if f.version == 800
-    if f.remote
+  if f.remote
 %>
 /*
  * <%=f.name%>
  *   version: <%=f.version%>
- *   remote:  <%=f.remote%>
- */
-sword <%=f.name%>_nb(oci8_svcctx_t *svcctx, <%=f.args.collect {|arg| arg.dcl}.join(', ')%>);
-<%
-    end
-  else # f.version == 800
-    if f.remote
-%>
-/*
- * <%=f.name%>
- *   version: <%=f.version%>
  *   remote:  true
  */
-sword <%=f.name%>_nb(oci8_svcctx_t *svcctx, <%=f.args.collect {|arg| arg.dcl}.join(', ')%>);
+<%=f.ret%> oci8_<%=f.name%>_nb(oci8_svcctx_t *svcctx, <%=f.args.collect {|arg| arg.dcl}.join(', ')%>, const char *file, int line);
+#define <%=f.name%>_nb(svcctx, <%=f.args.collect do |a| a.name; end.join(', ')%>) \
+      oci8_<%=f.name%>_nb(svcctx, <%=f.args.collect do |a| a.name; end.join(', ')%>, __FILE__, __LINE__)
 #if defined RUNTIME_API_CHECK
-extern int have_<%=f.name%>_nb;
+extern int oci8_have_<%=f.name%>_nb;
+#define have_<%=f.name%>_nb oci8_have_<%=f.name%>_nb
 #elif ORACLE_CLIENT_VERSION >= <%=f.version%>
 #define have_<%=f.name%>_nb (1)
 #else
 #define have_<%=f.name%>_nb (0)
 #endif
 <%
-    else
+  else
 %>
 /*
  * <%=f.name%>
  *   version: <%=f.version%>
  *   remote:  false
  */
-sword <%=f.name%>_fn(<%=f.args.collect {|arg| arg.dcl}.join(', ')%>);
+<%=f.ret%> oci8_<%=f.name%>(<%=f.args.collect {|arg| arg.dcl}.join(', ')%>, const char *file, int line);
+#ifndef API_WRAP_C
+#undef <%=f.name%>
+#define <%=f.name%>(<%=f.args.collect do |a| a.name; end.join(', ')%>) \
+      oci8_<%=f.name%>(<%=f.args.collect do |a| a.name; end.join(', ')%>, __FILE__, __LINE__)
+#endif
 #if defined RUNTIME_API_CHECK
-extern int have_<%=f.name%>;
+extern int oci8_have_<%=f.name%>;
+#define have_<%=f.name%> oci8_have_<%=f.name%>
 #elif ORACLE_CLIENT_VERSION >= <%=f.version%>
 #define have_<%=f.name%> (1)
 #else
 #define have_<%=f.name%> (0)
 #endif
-#ifndef API_WRAP_C
-#undef <%=f.name%>
-#define <%=f.name%> <%=f.name%>_fn
-#endif
 <%
-    end
-  end  # f.version == 800
+  end
 end # funcs.each
 %>
 #endif /* APIWRAP_H */

Modified: trunk/ruby-oci8/ext/oci8/apiwrap.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/apiwrap.rb	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/ext/oci8/apiwrap.rb	2008-03-06 14:06:04 UTC (rev 250)
@@ -17,11 +17,18 @@
   attr_reader :version
   attr_reader :remote
   attr_reader :args
+  attr_reader :ret
 
   def initialize(key, val)
-    @name = key
+    if key[-3..-1] == '_nb'
+      @name = key[0..-4]
+      @remote = true
+    else
+      @name = key
+      @remote = false
+    end
     @version = val[:version]
-    @remote = val[:remote]
+    @ret = val[:ret] || 'sword'
     @args = val[:args].collect do |arg|
       ArgDef.new(arg)
     end

Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml
===================================================================
--- trunk/ruby-oci8/ext/oci8/apiwrap.yml	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/ext/oci8/apiwrap.yml	2008-03-06 14:06:04 UTC (rev 250)
@@ -3,9 +3,9 @@
 #
 
 # round trip: 0, 1, or 2
+# use thie for 0 round trip
 OCIAttrGet:
   :version: 800
-  :remote:  true
   :args:    - const dvoid *trgthndlp
             - ub4 trghndltyp
             - dvoid *attributep
@@ -13,10 +13,19 @@
             - ub4 attrtype
             - OCIError *errhp
 
+# use thie for 1 or 2 round trips
+OCIAttrGet_nb:
+  :version: 800
+  :args:    - const dvoid *trgthndlp
+            - ub4 trghndltyp
+            - dvoid *attributep
+            - ub4 *sizep
+            - ub4 attrtype
+            - OCIError *errhp
+
 # round trip: 1
-OCIDescribeAny:
+OCIDescribeAny_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - dvoid *objptr
@@ -27,51 +36,45 @@
             - OCIDescribe *dschp
 
 # round trip: 1
-OCILobFileClose:
+OCILobFileClose_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *filep
 
 # round trip: 1
-OCILobFileCloseAll:
+OCILobFileCloseAll_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
 
 # round trip: 1
-OCILobFileExists:
+OCILobFileExists_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *filep
             - boolean *flag
 
 # round trip: 1
-OCILobFileOpen:
+OCILobFileOpen_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *filep
             - ub1 mode
 
 # round trip: 1
-OCILobGetLength:
+OCILobGetLength_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
             - ub4 *lenp
 
 # round trip: 0 or 1
-OCILobRead:
+OCILobRead_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
@@ -85,18 +88,16 @@
             - ub1 csfrm
 
 # round trip: 1
-OCILobTrim:
+OCILobTrim_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
             - ub4 newlen
 
 # round trip: 0 or 1
-OCILobWrite:
+OCILobWrite_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
@@ -111,16 +112,14 @@
             - ub1 csfrm
 
 # round trip: 1
-OCILogoff:
+OCILogoff_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
 
 # round trip: 1
-OCILogon:
+OCILogon_nb:
   :version: 800
-  :remote:  true
   :args:    - OCIEnv *envhp
             - OCIError *errhp
             - OCISvcCtx **svchp
@@ -132,9 +131,8 @@
             - ub4 dbname_len
 
 # round trip: 0 or 1
-OCIObjectPin:
+OCIObjectPin_nb:
   :version: 800
-  :remote:  true
   :args:    - OCIEnv *env
             - OCIError *err
             - OCIRef *object_ref
@@ -145,9 +143,8 @@
             - dvoid **object
 
 # round trip: 1
-OCISessionBegin:
+OCISessionBegin_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCISession *usrhp
@@ -155,18 +152,16 @@
             - ub4 mode
 
 # round trip: 1
-OCISessionEnd:
+OCISessionEnd_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCISession *usrhp
             - ub4 mode
 
 # round trip: 1
-OCIServerAttach:
+OCIServerAttach_nb:
   :version: 800
-  :remote:  true
   :args:    - OCIServer *srvhp
             - OCIError *errhp
             - const text *dblink
@@ -174,17 +169,15 @@
             - ub4 mode
 
 # round trip: 1
-OCIServerDetach:
+OCIServerDetach_nb:
   :version: 800
-  :remote:  true
   :args:    - OCIServer *srvhp
             - OCIError *errhp
             - ub4 mode
 
 # round trip: 1
-OCIStmtExecute:
+OCIStmtExecute_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIStmt *stmtp
             - OCIError *errhp
@@ -195,9 +188,8 @@
             - ub4 mode
 
 # round trip: 0 if a next row is in pre-fetch buffer, otherwise 1
-OCIStmtFetch:
+OCIStmtFetch_nb:
   :version: 800
-  :remote:  true
   :args:    - OCIStmt *stmtp
             - OCIError *errhp
             - ub4 nrows
@@ -205,17 +197,15 @@
             - ub4 mode
 
 # round trip: 1
-OCITransCommit:
+OCITransCommit_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - ub4 flags
 
 # round trip: 1
-OCITransRollback:
+OCITransRollback_nb:
   :version: 800
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - ub4 flags
@@ -226,17 +216,15 @@
 #
 
 # round trip: 1
-OCILobClose:
+OCILobClose_nb:
   :version: 810
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
 
 # round trip: 1
-OCILobCreateTemporary:
+OCILobCreateTemporary_nb:
   :version: 810
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
@@ -247,9 +235,8 @@
             - OCIDuration duration
 
 # round trip: 1
-OCILobGetChunkSize:
+OCILobGetChunkSize_nb:
   :version: 810
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
@@ -258,25 +245,22 @@
 # round trip: 0
 OCILobIsTemporary:
   :version: 810
-  :remote:  false
   :args:    - OCIEnv *envp
             - OCIError *errhp
             - OCILobLocator *locp
             - boolean *is_temporary
 
 # round trip: 1 if either destination or source lob is a temporary, otherwise 0
-OCILobLocatorAssign:
+OCILobLocatorAssign_nb:
   :version: 810
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - const OCILobLocator *src_locp
             - OCILobLocator **dst_locpp
 
 # round trip 1
-OCILobOpen:
+OCILobOpen_nb:
   :version: 810
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
@@ -285,7 +269,6 @@
 # round trip: 0
 OCIReset:
   :version: 810
-  :remote:  false
   :args:    - dvoid *hndlp
             - OCIError *errhp
 
@@ -296,7 +279,6 @@
 # round trip: 0 (not docmented. I guess.)
 OCIRowidToChar:
   :version: 900
-  :remote:  false
   :args:    - OCIRowid *rowidDesc
             - OraText *outbfp
             - ub2 *outbflp
@@ -309,7 +291,6 @@
 # round trip: 0 (not docmented. I guess.)
 OCINlsCharSetIdToName:
   :version: 920
-  :remote:  false
   :args:    - dvoid *envhp
             - oratext *buf
             - size_t buflen
@@ -320,18 +301,16 @@
 #
 
 # round trip: 1
-OCILobGetLength2:
+OCILobGetLength2_nb:
   :version: 1010
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
             - oraub8 *lenp
 
 # round trip: 0 or 1
-OCILobRead2:
+OCILobRead2_nb:
   :version: 1010
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
@@ -347,18 +326,16 @@
             - ub1 csfrm
 
 # round trip: 1
-OCILobTrim2:
+OCILobTrim2_nb:
   :version: 1010
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
             - oraub8 newlen
 
 # round trip: 0 or 1
-OCILobWrite2:
+OCILobWrite2_nb:
   :version: 1010
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCILobLocator *locp
@@ -378,9 +355,8 @@
 #
 
 # round trip: 1
-OCIDBStartup:
+OCIDBStartup_nb:
   :version: 1020
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCIAdmin *admhp
@@ -388,18 +364,16 @@
             - ub4 flags
 
 # round trip: 1
-OCIDBShutdown:
+OCIDBShutdown_nb:
   :version: 1020
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - OCIAdmin *admhp
             - ub4 mode
 
 # round trip: 1
-OCIPing:
+OCIPing_nb:
   :version: 1020
-  :remote:  true
   :args:    - OCISvcCtx *svchp
             - OCIError *errhp
             - ub4 mode
@@ -410,7 +384,6 @@
 
 OCIArrayDescriptorAlloc:
   :version: 1110
-  :remote:  false
   :args:    - const void *parenth
             - void **descpp
             - const ub4 type
@@ -420,6 +393,5 @@
 
 OCIArrayDescriptorFree:
   :version: 1110
-  :remote:  false
   :args:    - void **descp
             - const ub4 type

Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb	2008-03-06 14:06:04 UTC (rev 250)
@@ -35,6 +35,7 @@
 oci_actual_client_version = 800
 funcs = {}
 YAML.load(open(File.dirname(__FILE__) + '/apiwrap.yml')).each do |key, val|
+  key = key[0..-4] if key[-3..-1] == '_nb'
   funcs[val[:version]] ||= []
   funcs[val[:version]] << key
 end

Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/ext/oci8/oci8.c	2008-03-06 14:06:04 UTC (rev 250)
@@ -61,6 +61,11 @@
 static ID id_at_username;
 static ID id_set_prefetch_rows;
 
+static VALUE oci8_s_oracle_client_version(VALUE klass)
+{
+    return INT2FIX(oracle_client_version);
+}
+
 #define CONN_STR_REGEX "/^([^(\\s|\\@)]*)\\/([^(\\s|\\@)]*)(?:\\@(\\S+))?(?:\\s+as\\s+(\\S*)\\s*)?$/i"
 static void oci8_do_parse_connect_string(VALUE conn_str, VALUE *user, VALUE *pass, VALUE *dbname, VALUE *mode)
 {
@@ -529,6 +534,7 @@
     id_at_username = rb_intern("@username");
     id_set_prefetch_rows = rb_intern("prefetch_rows=");
 
+    rb_define_singleton_method(cOCI8, "oracle_client_version", oci8_s_oracle_client_version, 0);
     rb_define_private_method(cOCI8, "parse_connect_string", oci8_parse_connect_string, 1);
     rb_define_method(cOCI8, "initialize", oci8_svcctx_initialize, -1);
     rb_define_method(cOCI8, "logoff", oci8_svcctx_logoff, 0);

Modified: trunk/ruby-oci8/test/config.rb
===================================================================
--- trunk/ruby-oci8/test/config.rb	2008-03-05 14:29:35 UTC (rev 249)
+++ trunk/ruby-oci8/test/config.rb	2008-03-06 14:06:04 UTC (rev 250)
@@ -30,7 +30,7 @@
 end
 conn.logoff
 
-$oracle_client_version = OCI8::CLIENT_VERSION.to_i
+$oracle_client_version = OCI8.oracle_client_version
 if $oracle_server_version < $oracle_client_version
   $oracle_version = $oracle_server_version
 else




More information about the ruby-oci8-commit mailing list