From nobody at rubyforge.org Thu Jun 9 23:59:43 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 9 Jun 2011 23:59:43 -0400 (EDT) Subject: [ruby-oci8-commit] [425] trunk/ruby-oci8/ext/oci8: * ext/oci8/env.c, ext/oci8/oci8.h: Free OCI error handles on the Message-ID: <20110610035943.2DBAF1678329@rubyforge.org> Revision: 425 Author: kubo Date: 2011-06-09 23:59:42 -0400 (Thu, 09 Jun 2011) Log Message: ----------- * 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) See: http://rubyforge.org/forum/forum.php?thread_id=49751&forum_id=1078 Modified Paths: -------------- branches/ruby-oci8-2.0/ChangeLog branches/ruby-oci8-2.0/ext/oci8/env.c branches/ruby-oci8-2.0/ext/oci8/oci8.h trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/env.c trunk/ruby-oci8/ext/oci8/oci8.h Modified: branches/ruby-oci8-2.0/ChangeLog =================================================================== --- branches/ruby-oci8-2.0/ChangeLog 2011-02-21 11:10:57 UTC (rev 424) +++ branches/ruby-oci8-2.0/ChangeLog 2011-06-10 03:59:42 UTC (rev 425) @@ -1,8 +1,14 @@ +2011-06-10 KUBO Takehiro + * 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) + See: http://rubyforge.org/forum/forum.php?thread_id=49751&forum_id=1078 + 2011-02-21 KUBO Takehiro * ext/oci8/lob.c, ext/oci8/metadata.c, ext/oci8/oci8.c, ext/oci8/oci8.h, ext/oci8/oci8lib.c, ext/oci8/stmt.c: - fix segmentation fault when calling closed statement object's - OCI8::Cursor#[]. (reported by Hugo L. Borges) + fix segmentation fault when calling OCI8::Cursor#[] for + closed statement object's (reported by Hugo L. Borges) 2011-02-01 KUBO Takehiro * ext/oci8/ocidatetime.c, lib/oci8/datetime.rb: rename @@ -120,7 +126,7 @@ 2010-02-28 KUBO Takehiro * NEWS: add changes between 2.0.3 and 2.0.4. - * VERSION: change the version to 2.0.3. + * VERSION: change the version to 2.0.4. * ext/oci8/stmt.c: fix segmentation fault when OCI8::Cursor#fetch is called prior to OCI8::Cursor#exec. * ext/oci8/oci8.c: minor fix in rdoc comment. Modified: branches/ruby-oci8-2.0/ext/oci8/env.c =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/env.c 2011-02-21 11:10:57 UTC (rev 424) +++ branches/ruby-oci8-2.0/ext/oci8/env.c 2011-06-10 03:59:42 UTC (rev 425) @@ -2,7 +2,7 @@ /* * env.c - part of ruby-oci8 * - * Copyright (C) 2002-2009 KUBO Takehiro + * Copyright (C) 2002-2011 KUBO Takehiro */ #include "oci8.h" @@ -37,17 +37,47 @@ */ oci8_tls_key_t oci8_tls_key; /* native thread key */ -static ID id_thread_key; /* ruby's thread key */ -static void oci8_free_errhp(OCIError *errhp) +/* This function is called on the native thread termination + * if the thread local errhp is not null. + */ +static void oci8_free_errhp(void *errhp) { OCIHandleFree(errhp, OCI_HTYPE_ERROR); } +#ifdef _WIN32 +static int dllmain_is_called; + +__declspec(dllexport) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + void *errhp; + + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + dllmain_is_called = 1; + break; + case DLL_THREAD_ATTACH: + /* do nothing */ + break; + case DLL_THREAD_DETACH: + errhp = oci8_tls_get(oci8_tls_key); + if (errhp != NULL) { + oci8_free_errhp(errhp); + } + break; + case DLL_PROCESS_DETACH: + /* do nothing */ + break; + } + return TRUE; +} +#endif + OCIError *oci8_make_errhp(void) { OCIError *errhp; - VALUE obj; sword rv; /* create a new errhp. */ @@ -55,15 +85,9 @@ if (rv != OCI_SUCCESS) { oci8_env_raise(oci8_envhp, rv); } - /* create a new ruby object which contains errhp to make - * sure that the errhp is freed when it become unnecessary. + /* Set the errhp to the thread local storage. + * It is freed by oci8_free_errhp(). */ - obj = Data_Wrap_Struct(rb_cObject, NULL, oci8_free_errhp, errhp); - /* set the ruby object to ruby's thread local storage to prevent - * it from being freed while the thread is available. - */ - rb_thread_local_aset(rb_thread_current(), id_thread_key, obj); - oci8_tls_set(oci8_tls_key, (void*)errhp); return errhp; } @@ -137,8 +161,21 @@ } #ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T - id_thread_key = rb_intern("__oci8_errhp__"); - error = oci8_tls_key_init(&oci8_tls_key); +/* ruby 1.9 */ +#if defined(_WIN32) + if (!dllmain_is_called) { + /* sanity check */ + rb_raise(rb_eRuntimeError, "DllMain is not unexpectedly called. This causes resource leaks."); + } + oci8_tls_key = TlsAlloc(); + if (oci8_tls_key == 0xFFFFFFFF) { + error = GetLastError(); + } else { + error = 0; + } +#else + error = pthread_key_create(&oci8_tls_key, oci8_free_errhp); +#endif if (error != 0) { rb_raise(rb_eRuntimeError, "Cannot create thread local key (errno = %d)", error); } Modified: branches/ruby-oci8-2.0/ext/oci8/oci8.h =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/oci8.h 2011-02-21 11:10:57 UTC (rev 424) +++ branches/ruby-oci8-2.0/ext/oci8/oci8.h 2011-06-10 03:59:42 UTC (rev 425) @@ -2,7 +2,7 @@ /* * oci8.h - part of ruby-oci8 * - * Copyright (C) 2002-2009 KUBO Takehiro + * Copyright (C) 2002-2011 KUBO Takehiro */ #ifndef _RUBY_OCI_H_ #define _RUBY_OCI_H_ 1 @@ -174,10 +174,6 @@ /* macros to access thread-local storage. * - * int oci8_tls_key_init(oci8_tls_key_t *key); - * initialie a key to access thread-local storege - * This returns 0 on success or error number. - * * void *oci8_tls_get(oci8_tls_key_t key); * get a value associated with the key. * @@ -190,15 +186,11 @@ #if defined(_WIN32) #include #define oci8_tls_key_t DWORD -#define oci8_tls_key_init(key_p) \ - ((*(key_p) = TlsAlloc()), \ - (*(key_p) == 0xFFFFFFFF) ? GetLastError() : 0) #define oci8_tls_get(key) TlsGetValue(key) #define oci8_tls_set(key, val) TlsSetValue((key), (val)) #else #include #define oci8_tls_key_t pthread_key_t -#define oci8_tls_key_init(key_p) pthread_key_create((key_p), NULL) #define oci8_tls_get(key) pthread_getspecific(key) #define oci8_tls_set(key, val) pthread_setspecific((key), (val)) #endif Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2011-02-21 11:10:57 UTC (rev 424) +++ trunk/ruby-oci8/ChangeLog 2011-06-10 03:59:42 UTC (rev 425) @@ -1,8 +1,14 @@ +2011-06-10 KUBO Takehiro + * 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) + See: http://rubyforge.org/forum/forum.php?thread_id=49751&forum_id=1078 + 2011-02-21 KUBO Takehiro * ext/oci8/lob.c, ext/oci8/metadata.c, ext/oci8/oci8.c, ext/oci8/oci8.h, ext/oci8/oci8lib.c, ext/oci8/stmt.c: - fix segmentation fault when calling closed statement object's - OCI8::Cursor#[]. (reported by Hugo L. Borges) + fix segmentation fault when calling OCI8::Cursor#[] for + closed statement object's (reported by Hugo L. Borges) 2011-02-01 KUBO Takehiro * ext/oci8/ocidatetime.c, lib/oci8/datetime.rb: rename Modified: trunk/ruby-oci8/ext/oci8/env.c =================================================================== --- trunk/ruby-oci8/ext/oci8/env.c 2011-02-21 11:10:57 UTC (rev 424) +++ trunk/ruby-oci8/ext/oci8/env.c 2011-06-10 03:59:42 UTC (rev 425) @@ -2,7 +2,7 @@ /* * env.c - part of ruby-oci8 * - * Copyright (C) 2002-2009 KUBO Takehiro + * Copyright (C) 2002-2011 KUBO Takehiro */ #include "oci8.h" @@ -37,17 +37,47 @@ */ oci8_tls_key_t oci8_tls_key; /* native thread key */ -static ID id_thread_key; /* ruby's thread key */ -static void oci8_free_errhp(OCIError *errhp) +/* This function is called on the native thread termination + * if the thread local errhp is not null. + */ +static void oci8_free_errhp(void *errhp) { OCIHandleFree(errhp, OCI_HTYPE_ERROR); } +#ifdef _WIN32 +static int dllmain_is_called; + +__declspec(dllexport) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + void *errhp; + + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + dllmain_is_called = 1; + break; + case DLL_THREAD_ATTACH: + /* do nothing */ + break; + case DLL_THREAD_DETACH: + errhp = oci8_tls_get(oci8_tls_key); + if (errhp != NULL) { + oci8_free_errhp(errhp); + } + break; + case DLL_PROCESS_DETACH: + /* do nothing */ + break; + } + return TRUE; +} +#endif + OCIError *oci8_make_errhp(void) { OCIError *errhp; - VALUE obj; sword rv; /* create a new errhp. */ @@ -55,15 +85,9 @@ if (rv != OCI_SUCCESS) { oci8_env_raise(oci8_envhp, rv); } - /* create a new ruby object which contains errhp to make - * sure that the errhp is freed when it become unnecessary. + /* Set the errhp to the thread local storage. + * It is freed by oci8_free_errhp(). */ - obj = Data_Wrap_Struct(rb_cObject, NULL, oci8_free_errhp, errhp); - /* set the ruby object to ruby's thread local storage to prevent - * it from being freed while the thread is available. - */ - rb_thread_local_aset(rb_thread_current(), id_thread_key, obj); - oci8_tls_set(oci8_tls_key, (void*)errhp); return errhp; } @@ -137,8 +161,21 @@ } #ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T - id_thread_key = rb_intern("__oci8_errhp__"); - error = oci8_tls_key_init(&oci8_tls_key); +/* ruby 1.9 */ +#if defined(_WIN32) + if (!dllmain_is_called) { + /* sanity check */ + rb_raise(rb_eRuntimeError, "DllMain is not unexpectedly called. This causes resource leaks."); + } + oci8_tls_key = TlsAlloc(); + if (oci8_tls_key == 0xFFFFFFFF) { + error = GetLastError(); + } else { + error = 0; + } +#else + error = pthread_key_create(&oci8_tls_key, oci8_free_errhp); +#endif if (error != 0) { rb_raise(rb_eRuntimeError, "Cannot create thread local key (errno = %d)", error); } Modified: trunk/ruby-oci8/ext/oci8/oci8.h =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.h 2011-02-21 11:10:57 UTC (rev 424) +++ trunk/ruby-oci8/ext/oci8/oci8.h 2011-06-10 03:59:42 UTC (rev 425) @@ -2,7 +2,7 @@ /* * oci8.h - part of ruby-oci8 * - * Copyright (C) 2002-2010 KUBO Takehiro + * Copyright (C) 2002-2011 KUBO Takehiro */ #ifndef _RUBY_OCI_H_ #define _RUBY_OCI_H_ 1 @@ -177,10 +177,6 @@ /* macros to access thread-local storage. * - * int oci8_tls_key_init(oci8_tls_key_t *key); - * initialie a key to access thread-local storege - * This returns 0 on success or error number. - * * void *oci8_tls_get(oci8_tls_key_t key); * get a value associated with the key. * @@ -193,15 +189,11 @@ #if defined(_WIN32) #include #define oci8_tls_key_t DWORD -#define oci8_tls_key_init(key_p) \ - ((*(key_p) = TlsAlloc()), \ - (*(key_p) == 0xFFFFFFFF) ? GetLastError() : 0) #define oci8_tls_get(key) TlsGetValue(key) #define oci8_tls_set(key, val) TlsSetValue((key), (val)) #else #include #define oci8_tls_key_t pthread_key_t -#define oci8_tls_key_init(key_p) pthread_key_create((key_p), NULL) #define oci8_tls_get(key) pthread_getspecific(key) #define oci8_tls_set(key, val) pthread_setspecific((key), (val)) #endif From nobody at rubyforge.org Fri Jun 10 09:04:21 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Fri, 10 Jun 2011 09:04:21 -0400 (EDT) Subject: [ruby-oci8-commit] [426] branches/ruby-oci8-2.0: * ext/oci8/oci8.c: prevent GC on failed-logon connections from freeing Message-ID: <20110610130421.6627A1858376@rubyforge.org> 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 + * 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 * 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) From nobody at rubyforge.org Fri Jun 10 09:32:09 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Fri, 10 Jun 2011 09:32:09 -0400 (EDT) Subject: [ruby-oci8-commit] [427] trunk/ruby-oci8: * ext/oci8/apiwrap.yml, lib/oci8/oci8.rb: fix for Psych YAML library. Message-ID: <20110610133209.84D0D167832A@rubyforge.org> Revision: 427 Author: kubo Date: 2011-06-10 09:32:09 -0400 (Fri, 10 Jun 2011) Log Message: ----------- * ext/oci8/apiwrap.yml, lib/oci8/oci8.rb: fix for Psych YAML library. * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/ocihandle.c: fix to work with ruby 1.9.3 dev. Modified Paths: -------------- branches/ruby-oci8-2.0/ChangeLog branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml branches/ruby-oci8-2.0/ext/oci8/extconf.rb branches/ruby-oci8-2.0/ext/oci8/oci8.h branches/ruby-oci8-2.0/ext/oci8/ocihandle.c branches/ruby-oci8-2.0/lib/oci8/oci8.rb trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/apiwrap.yml trunk/ruby-oci8/ext/oci8/extconf.rb trunk/ruby-oci8/ext/oci8/oci8.h trunk/ruby-oci8/ext/oci8/ocihandle.c trunk/ruby-oci8/lib/oci8/oci8.rb Modified: branches/ruby-oci8-2.0/ChangeLog =================================================================== --- branches/ruby-oci8-2.0/ChangeLog 2011-06-10 13:04:21 UTC (rev 426) +++ branches/ruby-oci8-2.0/ChangeLog 2011-06-10 13:32:09 UTC (rev 427) @@ -1,4 +1,9 @@ 2011-06-10 KUBO Takehiro + * ext/oci8/apiwrap.yml, lib/oci8/oci8.rb: fix for Psych YAML library. + * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/ocihandle.c: fix to + work with ruby 1.9.3dev. + +2011-06-10 KUBO Takehiro * ext/oci8/oci8.c: prevent GC on failed-logon connections from freeing alive connections when the service context handle addresses are accidentally same. Modified: branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml 2011-06-10 13:04:21 UTC (rev 426) +++ branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml 2011-06-10 13:32:09 UTC (rev 427) @@ -6,7 +6,8 @@ # use thie for 0 round trip OCIAttrGet: :version: 800 - :args: - CONST dvoid *trgthndlp + :args: + - CONST dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 *sizep @@ -16,7 +17,8 @@ # use thie for 1 or 2 round trips OCIAttrGet_nb: :version: 800 - :args: - CONST dvoid *trgthndlp + :args: + - CONST dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 *sizep @@ -25,7 +27,8 @@ OCIAttrSet: :version: 800 - :args: - dvoid *trgthndlp + :args: + - dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 size @@ -35,7 +38,8 @@ # round trip: 0 OCIBindArrayOfStruct: :version: 800 - :args: - OCIBind *bindp + :args: + - OCIBind *bindp - OCIError *errhp - ub4 pvskip - ub4 indskip @@ -45,7 +49,8 @@ # round trip: 0 OCIBindByName: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIBind **bindp - OCIError *errhp - CONST text *placeholder @@ -63,7 +68,8 @@ # round trip: 0 OCIBindByPos: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIBind **bindp - OCIError *errhp - ub4 position @@ -80,7 +86,8 @@ # round trip: 0 OCIBindObject: :version: 800 - :args: - OCIBind *bindp + :args: + - OCIBind *bindp - OCIError *errhp - CONST OCIType *type - dvoid **pgvpp @@ -91,13 +98,15 @@ # round trip: 1 but don't add _nb. OCIBreak: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp # round trip: 0 OCICollAppend: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST dvoid *elem - CONST dvoid *elemind @@ -106,7 +115,8 @@ # round trip: 0 OCICollAssignElem: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - sb4 index - CONST dvoid *elem @@ -116,7 +126,8 @@ # round trip: 0 OCICollGetElem: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCIColl *coll - sb4 index @@ -127,7 +138,8 @@ # round trip: 0 OCICollSize: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCIColl *coll - sb4 *size @@ -135,7 +147,8 @@ # round trip: 0 OCICollTrim: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - sb4 trim_num - OCIColl *coll @@ -143,7 +156,8 @@ # round trip: 0 OCIDefineArrayOfStruct: :version: 800 - :args: - OCIDefine *defnp + :args: + - OCIDefine *defnp - OCIError *errhp - ub4 pvskip - ub4 indskip @@ -153,7 +167,8 @@ # round trip: 0 OCIDefineByPos: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIDefine **defnp - OCIError *errhp - ub4 position @@ -168,7 +183,8 @@ # round trip: 0 OCIDefineObject: :version: 800 - :args: - OCIDefine *defnp + :args: + - OCIDefine *defnp - OCIError *errhp - CONST OCIType *type - dvoid **pgvpp @@ -179,7 +195,8 @@ # round trip: 1 OCIDescribeAny_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - dvoid *objptr - ub4 objnm_len @@ -190,7 +207,8 @@ OCIDescriptorAlloc: :version: 800 - :args: - CONST dvoid *parenth + :args: + - CONST dvoid *parenth - dvoid **descpp - ub4 type - size_t xtramem_sz @@ -198,19 +216,22 @@ OCIDescriptorFree: :version: 800 - :args: - dvoid *descp + :args: + - dvoid *descp - ub4 type OCIEnvInit: :version: 800 - :args: - OCIEnv **envp + :args: + - OCIEnv **envp - ub4 mode - size_t xtramem_sz - dvoid **usrmempp OCIErrorGet: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - ub4 recordno - text *sqlstate - sb4 *errcodep @@ -220,7 +241,8 @@ OCIHandleAlloc: :version: 800 - :args: - CONST dvoid *parenth + :args: + - CONST dvoid *parenth - dvoid **hndlpp - ub4 type - size_t xtramem_sz @@ -228,13 +250,15 @@ OCIHandleFree: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - ub4 type # round trip: 0 OCIInitialize: :version: 800 - :args: - ub4 mode + :args: + - ub4 mode - dvoid *ctxp - dvoid *(*malocfp)(dvoid *ctxp, size_t size) - dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t newsize) @@ -243,7 +267,8 @@ # round trip: 0 OCILobAssign: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - CONST OCILobLocator *src_locp - OCILobLocator **dst_locpp @@ -251,20 +276,23 @@ # round trip: 1 OCILobFileClose_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *filep # round trip: 1 OCILobFileCloseAll_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp # round trip: 1 OCILobFileExists_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *filep - boolean *flag @@ -272,7 +300,8 @@ # round trip: 0 OCILobFileGetName: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - CONST OCILobLocator *filep - text *dir_alias @@ -283,7 +312,8 @@ # round trip: 1 OCILobFileOpen_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *filep - ub1 mode @@ -291,7 +321,8 @@ # round trip: 0 OCILobFileSetName: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - OCILobLocator **filepp - CONST text *dir_alias @@ -302,7 +333,8 @@ # round trip: 1 OCILobGetLength_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *lenp @@ -310,7 +342,8 @@ # round trip: 0 OCILobLocatorIsInit: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - CONST OCILobLocator *locp - boolean *is_initialized @@ -318,7 +351,8 @@ # round trip: 0 or 1 OCILobRead_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *amtp @@ -333,7 +367,8 @@ # round trip: 1 OCILobTrim_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 newlen @@ -341,7 +376,8 @@ # round trip: 0 or 1 OCILobWrite_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *amtp @@ -357,13 +393,15 @@ # round trip: 1 OCILogoff_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp # round trip: 1 OCILogon_nb: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - OCISvcCtx **svchp - CONST text *username @@ -376,14 +414,16 @@ # round trip: 0 OCINumberAbs: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberAdd: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -391,28 +431,32 @@ # round trip: 0 OCINumberArcCos: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcSin: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcTan: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcTan2: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -420,21 +464,24 @@ # round trip: 0 OCINumberAssign: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *from - OCINumber *to # round trip: 0 OCINumberCeil: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberCmp: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - sword *result @@ -442,14 +489,16 @@ # round trip: 0 OCINumberCos: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberDiv: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -457,21 +506,24 @@ # round trip: 0 OCINumberExp: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberFloor: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberFromInt: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST dvoid *inum - uword inum_length - uword inum_s_flag @@ -480,7 +532,8 @@ # round trip: 0 OCINumberFromReal: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST dvoid *rnum - uword rnum_length - OCINumber *number @@ -488,7 +541,8 @@ # round trip: 0 OCINumberFromText: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST text *str - ub4 str_length - CONST text *fmt @@ -500,28 +554,32 @@ # round trip: 0 OCINumberHypCos: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberHypSin: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberHypTan: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberIntPower: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *base - CONST sword exp - OCINumber *result @@ -529,21 +587,24 @@ # round trip: 0 OCINumberIsZero: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - boolean *result # round trip: 0 OCINumberLn: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberLog: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *base - CONST OCINumber *number - OCINumber *result @@ -551,7 +612,8 @@ # round trip: 0 OCINumberMod: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -559,7 +621,8 @@ # round trip: 0 OCINumberMul: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -567,14 +630,16 @@ # round trip: 0 OCINumberNeg: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberPower: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *base - CONST OCINumber *number - OCINumber *result @@ -582,7 +647,8 @@ # round trip: 0 OCINumberRound: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - sword decplace - OCINumber *result @@ -591,20 +657,23 @@ OCINumberSetZero: :version: 800 :ret: void - :args: - OCIError *err + :args: + - OCIError *err - OCINumber *num # round trip: 0 OCINumberSin: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberSub: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -612,21 +681,24 @@ # round trip: 0 OCINumberSqrt: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberTan: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberToInt: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - uword rsl_length - uword rsl_flag @@ -635,7 +707,8 @@ # round trip: 0 OCINumberToReal: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - uword rsl_length - dvoid *rsl @@ -643,7 +716,8 @@ # round trip: 0 OCINumberToText: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - CONST text *fmt - ub4 fmt_length @@ -655,7 +729,8 @@ # round trip: 0 OCINumberTrunc: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - sword decplace - OCINumber *resulty @@ -663,7 +738,8 @@ # round trip: 0 OCIObjectFree: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - dvoid *instance - ub2 flags @@ -671,7 +747,8 @@ # round trip: 0 OCIObjectGetInd: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - dvoid *instance - dvoid **null_struct @@ -679,7 +756,8 @@ # round trip: 0 OCIObjectNew: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCISvcCtx *svc - OCITypeCode typecode @@ -692,7 +770,8 @@ # round trip: 0 or 1 OCIObjectPin_nb: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - OCIRef *object_ref - OCIComplexObject *corhdl @@ -704,14 +783,16 @@ # round trip: 0 OCIObjectUnpin: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - dvoid *object # round trip: ??? OCIParamGet: :version: 800 - :args: - CONST dvoid *hndlp + :args: + - CONST dvoid *hndlp - ub4 htype - OCIError *errhp - dvoid **parmdpp @@ -720,7 +801,8 @@ # round trip: 1 OCISessionBegin_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCISession *usrhp - ub4 credt @@ -729,7 +811,8 @@ # round trip: 0 OCIRawAssignBytes: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST ub1 *rhs - ub4 rhs_len @@ -739,20 +822,23 @@ OCIRawPtr: :version: 800 :ret: ub1 * - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIRaw *raw # round trip: 0 OCIRawSize: :version: 800 :ret: ub4 - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIRaw *raw # round trip: 1 OCISessionEnd_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCISession *usrhp - ub4 mode @@ -760,7 +846,8 @@ # round trip: 1 OCIServerAttach_nb: :version: 800 - :args: - OCIServer *srvhp + :args: + - OCIServer *srvhp - OCIError *errhp - CONST text *dblink - sb4 dblink_len @@ -769,14 +856,16 @@ # round trip: 1 OCIServerDetach_nb: :version: 800 - :args: - OCIServer *srvhp + :args: + - OCIServer *srvhp - OCIError *errhp - ub4 mode # round trip: ? OCIServerVersion: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp - OraText *bufp - ub4 bufsz @@ -785,7 +874,8 @@ # round trip: 1 OCIStmtExecute_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIStmt *stmtp - OCIError *errhp - ub4 iters @@ -797,7 +887,8 @@ # round trip: 0 if a next row is in pre-fetch buffer, otherwise 1 OCIStmtFetch_nb: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIError *errhp - ub4 nrows - ub2 orientation @@ -805,7 +896,8 @@ OCIStmtGetPieceInfo: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIError *errhp - dvoid **hndlpp - ub4 *typep @@ -816,7 +908,8 @@ OCIStmtPrepare: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIError *errhp - CONST text *stmt - ub4 stmt_len @@ -825,7 +918,8 @@ OCIStmtSetPieceInfo: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - ub4 type - OCIError *errhp - CONST dvoid *bufp @@ -837,7 +931,8 @@ # round trip: 0 OCIStringAssignText: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST text *rhs - ub4 rhs_len @@ -847,27 +942,31 @@ OCIStringPtr: :version: 800 :ret: text * - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIString *vs # round trip: 0 OCIStringSize: :version: 800 :ret: ub4 - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIString *vs # round trip: 1 OCITransCommit_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - ub4 flags # round trip: 1 OCITransRollback_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - ub4 flags @@ -875,7 +974,8 @@ OCITypeTypeCode: :version: 800 :ret: OCITypeCode - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCIType *tdo @@ -887,7 +987,8 @@ # round trip: 0 OCIEnvCreate: :version: 810 - :args: - OCIEnv **envp + :args: + - OCIEnv **envp - ub4 mode - dvoid *ctxp - dvoid *(*malocfp)(dvoid *ctxp, size_t size) @@ -899,14 +1000,16 @@ # round trip: 1 OCILobClose_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp # round trip: 1 OCILobCreateTemporary_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub2 csid @@ -918,14 +1021,16 @@ # round trip: 1 OCILobFreeTemporary_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp # round trip: 1 OCILobGetChunkSize_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *chunksizep @@ -933,7 +1038,8 @@ # round trip: 0 OCILobIsTemporary: :version: 810 - :args: - OCIEnv *envp + :args: + - OCIEnv *envp - OCIError *errhp - OCILobLocator *locp - boolean *is_temporary @@ -941,7 +1047,8 @@ # round trip: 1 if either destination or source lob is a temporary, otherwise 0 OCILobLocatorAssign_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - CONST OCILobLocator *src_locp - OCILobLocator **dst_locpp @@ -949,14 +1056,16 @@ # round trip 1 OCILobOpen_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub1 mode OCIMessageOpen: :version: 810 - :args: - dvoid *envhp + :args: + - dvoid *envhp - OCIError *errhp - OCIMsg **msghp - CONST OraText *product @@ -966,7 +1075,8 @@ OCIMessageGet: :version: 810 :ret: OraText * - :args: - OCIMsg *msgh + :args: + - OCIMsg *msgh - ub4 msgno - OraText *msgbuf - size_t buflen @@ -974,7 +1084,8 @@ # round trip: 0 OCINumberIsInt: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - boolean *result :code_if_not_found: | @@ -1001,7 +1112,8 @@ # round trip: 0 OCINumberPrec: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - eword nDigs - OCINumber *result @@ -1010,7 +1122,8 @@ OCINumberSetPi: :version: 810 :ret: void - :args: - OCIError *err + :args: + - OCIError *err - OCINumber *num :code_if_not_found: | static const OCINumber pi = { @@ -1023,7 +1136,8 @@ # round trip: 0 OCINumberShift: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - CONST sword nDig - OCINumber *result @@ -1031,7 +1145,8 @@ # round trip: 0 OCINumberSign: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - sword *result :code_if_not_found: | @@ -1056,7 +1171,8 @@ # round trip: 0 OCIReset: :version: 810 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp # @@ -1066,7 +1182,8 @@ # round trip: 0 (not docmented. I guess.) OCIDateTimeConstruct: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - OCIDateTime *datetime - sb2 yr @@ -1082,7 +1199,8 @@ # round trip: 0 (not docmented. I guess.) OCIDateTimeGetDate: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - CONST OCIDateTime *date - sb2 *yr @@ -1092,7 +1210,8 @@ # round trip: 0 (not docmented. I guess.) OCIDateTimeGetTime: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - OCIDateTime *datetime - ub1 *hr @@ -1103,7 +1222,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalFromText: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - CONST OraText *inpstr - size_t str_len @@ -1112,7 +1232,8 @@ # round trip: 0 (not docmented. I guess.) OCIDateTimeGetTimeZoneOffset: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - CONST OCIDateTime *datetime - sb1 *hr @@ -1121,7 +1242,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalGetDaySecond: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 *dy - sb4 *hr @@ -1133,7 +1255,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalGetYearMonth: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 *yr - sb4 *mnth @@ -1142,7 +1265,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalSetDaySecond: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 dy - sb4 hr @@ -1154,7 +1278,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalSetYearMonth: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 yr - sb4 mnth @@ -1163,7 +1288,8 @@ # round trip: 0 (not docmented. I guess.) OCIRowidToChar: :version: 900 - :args: - OCIRowid *rowidDesc + :args: + - OCIRowid *rowidDesc - OraText *outbfp - ub2 *outbflp - OCIError *errhp @@ -1172,7 +1298,8 @@ # This is documented in Oracle 11g. OCIServerRelease: :version: 900 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp - OraText *bufp - ub4 bufsz @@ -1186,7 +1313,8 @@ # round trip: 0 (not docmented. I guess.) OCINlsCharSetIdToName: :version: 920 - :args: - dvoid *envhp + :args: + - dvoid *envhp - oratext *buf - size_t buflen - ub2 id @@ -1194,7 +1322,8 @@ OCINlsCharSetNameToId: :version: 920 :ret: ub2 - :args: - dvoid *envhp + :args: + - dvoid *envhp - const oratext *name # @@ -1204,7 +1333,8 @@ # round trip: 1 OCILobGetLength2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 *lenp @@ -1212,7 +1342,8 @@ # round trip: 0 or 1 OCILobRead2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 *byte_amtp @@ -1229,7 +1360,8 @@ # round trip: 1 OCILobTrim2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 newlen @@ -1237,7 +1369,8 @@ # round trip: 0 or 1 OCILobWrite2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 *byte_amtp @@ -1259,7 +1392,8 @@ OCIClientVersion: :version: 1020 :ret: void - :args: - sword *major_version + :args: + - sword *major_version - sword *minor_version - sword *update_num - sword *patch_num @@ -1268,7 +1402,8 @@ # round trip: 1 OCIDBStartup_nb: :version: 1020 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCIAdmin *admhp - ub4 mode @@ -1277,7 +1412,8 @@ # round trip: 1 OCIDBShutdown_nb: :version: 1020 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCIAdmin *admhp - ub4 mode @@ -1285,7 +1421,8 @@ # round trip: 1 OCIPing_nb: :version: 1020 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - ub4 mode @@ -1295,7 +1432,8 @@ OCIArrayDescriptorAlloc: :version: 1110 - :args: - const void *parenth + :args: + - const void *parenth - void **descpp - const ub4 type - ub4 array_size @@ -1304,5 +1442,6 @@ OCIArrayDescriptorFree: :version: 1110 - :args: - void **descp + :args: + - void **descp - const ub4 type Modified: branches/ruby-oci8-2.0/ext/oci8/extconf.rb =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/extconf.rb 2011-06-10 13:04:21 UTC (rev 426) +++ branches/ruby-oci8-2.0/ext/oci8/extconf.rb 2011-06-10 13:32:09 UTC (rev 427) @@ -114,6 +114,7 @@ have_type("rb_blocking_function_t", "ruby.h") have_func("rb_set_end_proc", "ruby.h") +have_func("rb_class_superclass", "ruby.h") # replace files replace = { Modified: branches/ruby-oci8-2.0/ext/oci8/oci8.h =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/oci8.h 2011-06-10 13:04:21 UTC (rev 426) +++ branches/ruby-oci8-2.0/ext/oci8/oci8.h 2011-06-10 13:32:09 UTC (rev 427) @@ -74,10 +74,10 @@ #ifndef HAVE_TYPE_ORATEXT typedef unsigned char oratext; #endif -#ifndef HAVE_TYPE_OCIDATETIME_ +#if !defined HAVE_TYPE_OCIDATETIME_ && !defined HAVE_TYPE_OCIDATETIMEP typedef struct OCIDateTime OCIDateTime; #endif -#ifndef HAVE_TYPE_OCIINTERVAL_ +#if !defined HAVE_TYPE_OCIINTERVAL_ && !defined HAVE_TYPE_OCIINTERVALP typedef struct OCIInterval OCIInterval; #endif #ifndef HAVE_TYPE_OCICALLBACKLOBREAD2 @@ -90,10 +90,10 @@ ub1 *piece, dvoid **changed_bufpp, oraub8 *changed_lenp); #endif -#ifndef HAVE_TYPE_OCIADMIN_ +#if !defined HAVE_TYPE_OCIADMIN_ && !defined HAVE_TYPE_OCIADMINP typedef struct OCIAdmin OCIAdmin; #endif -#ifndef HAVE_TYPE_OCIMSG_ +#if !defined HAVE_TYPE_OCIMSG_ && !defined HAVE_TYPE_OCIMSGP typedef struct OCIMsg OCIMsg; #endif @@ -116,9 +116,6 @@ /* new macros in ruby 1.9. * define compatible macros for ruby 1.8 or lower. */ -#ifndef RCLASS_SUPER -#define RCLASS_SUPER(c) RCLASS(c)->super -#endif #ifndef RFLOAT_VALUE #define RFLOAT_VALUE(obj) RFLOAT(obj)->value #endif @@ -149,6 +146,17 @@ #define rb_usascii_str_new_cstr(ptr) rb_str_new2(ptr) #endif +/* a new function in ruby 1.9.3. + * define a compatible macro for ruby 1.9.2 or lower. + */ +#ifndef HAVE_RB_CLASS_SUPERCLASS +#ifdef RCLASS_SUPER +#define rb_class_superclass(cls) RCLASS_SUPER(cls) +#else +#define rb_class_superclass(cls) (RCLASS(cls)->super) +#endif +#endif + /* macros depends on the compiler. * LIKELY(x) hint for the compiler that 'x' is 1(TRUE) in many cases. * UNLIKELY(x) hint for the compiler that 'x' is 0(FALSE) in many cases. Modified: branches/ruby-oci8-2.0/ext/oci8/ocihandle.c =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/ocihandle.c 2011-06-10 13:04:21 UTC (rev 426) +++ branches/ruby-oci8-2.0/ext/oci8/ocihandle.c 2011-06-10 13:32:09 UTC (rev 427) @@ -82,7 +82,7 @@ superklass = klass; while (!RTEST(rb_ivar_defined(superklass, oci8_id_oci8_class))) { - superklass = RCLASS_SUPER(superklass); + superklass = rb_class_superclass(superklass); if (superklass == rb_cObject) rb_raise(rb_eRuntimeError, "private method `new' called for %s:Class", rb_class2name(klass)); } Modified: branches/ruby-oci8-2.0/lib/oci8/oci8.rb =================================================================== --- branches/ruby-oci8-2.0/lib/oci8/oci8.rb 2011-06-10 13:04:21 UTC (rev 426) +++ branches/ruby-oci8-2.0/lib/oci8/oci8.rb 2011-06-10 13:32:09 UTC (rev 427) @@ -8,6 +8,7 @@ # require 'date' +require 'yaml' # A connection to a Oracle database server. # @@ -543,14 +544,29 @@ end class OraNumber - def yaml_initialize(type, val) # :nodoc: - initialize(val) - end - def to_yaml(opts = {}) # :nodoc: - YAML.quick_emit(object_id, opts) do |out| - out.scalar(taguri, self.to_s, :plain) + if YAML == Psych + + yaml_tag '!ruby/object:OraNumber' + def encode_with coder # :nodoc: + coder.scalar = self.to_s end + + def init_with coder # :nodoc: + initialize(coder.scalar) + end + + else + + def yaml_initialize(type, val) # :nodoc: + initialize(val) + end + + def to_yaml(opts = {}) # :nodoc: + YAML.quick_emit(object_id, opts) do |out| + out.scalar(taguri, self.to_s, :plain) + end + end end def to_json(options=nil) # :nodoc: Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2011-06-10 13:04:21 UTC (rev 426) +++ trunk/ruby-oci8/ChangeLog 2011-06-10 13:32:09 UTC (rev 427) @@ -1,4 +1,9 @@ 2011-06-10 KUBO Takehiro + * ext/oci8/apiwrap.yml, lib/oci8/oci8.rb: fix for Psych YAML library. + * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/ocihandle.c: fix to + work with ruby 1.9.3dev. + +2011-06-10 KUBO Takehiro * 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: trunk/ruby-oci8/ext/oci8/apiwrap.yml =================================================================== --- trunk/ruby-oci8/ext/oci8/apiwrap.yml 2011-06-10 13:04:21 UTC (rev 426) +++ trunk/ruby-oci8/ext/oci8/apiwrap.yml 2011-06-10 13:32:09 UTC (rev 427) @@ -6,7 +6,8 @@ # use thie for 0 round trip OCIAttrGet: :version: 800 - :args: - CONST dvoid *trgthndlp + :args: + - CONST dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 *sizep @@ -16,7 +17,8 @@ # use thie for 1 or 2 round trips OCIAttrGet_nb: :version: 800 - :args: - CONST dvoid *trgthndlp + :args: + - CONST dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 *sizep @@ -25,7 +27,8 @@ OCIAttrSet: :version: 800 - :args: - dvoid *trgthndlp + :args: + - dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 size @@ -35,7 +38,8 @@ # round trip: 0 OCIBindArrayOfStruct: :version: 800 - :args: - OCIBind *bindp + :args: + - OCIBind *bindp - OCIError *errhp - ub4 pvskip - ub4 indskip @@ -45,7 +49,8 @@ # round trip: 0 OCIBindByName: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIBind **bindp - OCIError *errhp - CONST text *placeholder @@ -63,7 +68,8 @@ # round trip: 0 OCIBindByPos: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIBind **bindp - OCIError *errhp - ub4 position @@ -80,7 +86,8 @@ # round trip: 0 OCIBindObject: :version: 800 - :args: - OCIBind *bindp + :args: + - OCIBind *bindp - OCIError *errhp - CONST OCIType *type - dvoid **pgvpp @@ -91,13 +98,15 @@ # round trip: 1 but don't add _nb. OCIBreak: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp # round trip: 0 OCICollAppend: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST dvoid *elem - CONST dvoid *elemind @@ -106,7 +115,8 @@ # round trip: 0 OCICollAssignElem: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - sb4 index - CONST dvoid *elem @@ -116,7 +126,8 @@ # round trip: 0 OCICollGetElem: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCIColl *coll - sb4 index @@ -127,7 +138,8 @@ # round trip: 0 OCICollSize: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCIColl *coll - sb4 *size @@ -135,7 +147,8 @@ # round trip: 0 OCICollTrim: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - sb4 trim_num - OCIColl *coll @@ -143,7 +156,8 @@ # round trip: 0 OCIDefineArrayOfStruct: :version: 800 - :args: - OCIDefine *defnp + :args: + - OCIDefine *defnp - OCIError *errhp - ub4 pvskip - ub4 indskip @@ -153,7 +167,8 @@ # round trip: 0 OCIDefineByPos: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIDefine **defnp - OCIError *errhp - ub4 position @@ -168,7 +183,8 @@ # round trip: 0 OCIDefineObject: :version: 800 - :args: - OCIDefine *defnp + :args: + - OCIDefine *defnp - OCIError *errhp - CONST OCIType *type - dvoid **pgvpp @@ -179,7 +195,8 @@ # round trip: 1 OCIDescribeAny_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - dvoid *objptr - ub4 objnm_len @@ -190,7 +207,8 @@ OCIDescriptorAlloc: :version: 800 - :args: - CONST dvoid *parenth + :args: + - CONST dvoid *parenth - dvoid **descpp - ub4 type - size_t xtramem_sz @@ -198,19 +216,22 @@ OCIDescriptorFree: :version: 800 - :args: - dvoid *descp + :args: + - dvoid *descp - ub4 type OCIEnvInit: :version: 800 - :args: - OCIEnv **envp + :args: + - OCIEnv **envp - ub4 mode - size_t xtramem_sz - dvoid **usrmempp OCIErrorGet: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - ub4 recordno - text *sqlstate - sb4 *errcodep @@ -220,7 +241,8 @@ OCIHandleAlloc: :version: 800 - :args: - CONST dvoid *parenth + :args: + - CONST dvoid *parenth - dvoid **hndlpp - ub4 type - size_t xtramem_sz @@ -228,13 +250,15 @@ OCIHandleFree: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - ub4 type # round trip: 0 OCIInitialize: :version: 800 - :args: - ub4 mode + :args: + - ub4 mode - dvoid *ctxp - dvoid *(*malocfp)(dvoid *ctxp, size_t size) - dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t newsize) @@ -243,7 +267,8 @@ # round trip: 0 OCILobAssign: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - CONST OCILobLocator *src_locp - OCILobLocator **dst_locpp @@ -251,20 +276,23 @@ # round trip: 1 OCILobFileClose_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *filep # round trip: 1 OCILobFileCloseAll_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp # round trip: 1 OCILobFileExists_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *filep - boolean *flag @@ -272,7 +300,8 @@ # round trip: 0 OCILobFileGetName: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - CONST OCILobLocator *filep - text *dir_alias @@ -283,7 +312,8 @@ # round trip: 1 OCILobFileOpen_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *filep - ub1 mode @@ -291,7 +321,8 @@ # round trip: 0 OCILobFileSetName: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - OCILobLocator **filepp - CONST text *dir_alias @@ -302,7 +333,8 @@ # round trip: 1 OCILobGetLength_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *lenp @@ -310,7 +342,8 @@ # round trip: 0 OCILobLocatorIsInit: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - CONST OCILobLocator *locp - boolean *is_initialized @@ -318,7 +351,8 @@ # round trip: 0 or 1 OCILobRead_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *amtp @@ -333,7 +367,8 @@ # round trip: 1 OCILobTrim_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 newlen @@ -341,7 +376,8 @@ # round trip: 0 or 1 OCILobWrite_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *amtp @@ -357,13 +393,15 @@ # round trip: 1 OCILogoff_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp # round trip: 1 OCILogon_nb: :version: 800 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - OCISvcCtx **svchp - CONST text *username @@ -376,14 +414,16 @@ # round trip: 0 OCINumberAbs: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberAdd: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -391,28 +431,32 @@ # round trip: 0 OCINumberArcCos: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcSin: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcTan: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcTan2: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -420,21 +464,24 @@ # round trip: 0 OCINumberAssign: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *from - OCINumber *to # round trip: 0 OCINumberCeil: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberCmp: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - sword *result @@ -442,14 +489,16 @@ # round trip: 0 OCINumberCos: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberDiv: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -457,21 +506,24 @@ # round trip: 0 OCINumberExp: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberFloor: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberFromInt: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST dvoid *inum - uword inum_length - uword inum_s_flag @@ -480,7 +532,8 @@ # round trip: 0 OCINumberFromReal: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST dvoid *rnum - uword rnum_length - OCINumber *number @@ -488,7 +541,8 @@ # round trip: 0 OCINumberFromText: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST text *str - ub4 str_length - CONST text *fmt @@ -500,28 +554,32 @@ # round trip: 0 OCINumberHypCos: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberHypSin: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberHypTan: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberIntPower: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *base - CONST sword exp - OCINumber *result @@ -529,21 +587,24 @@ # round trip: 0 OCINumberIsZero: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - boolean *result # round trip: 0 OCINumberLn: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberLog: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *base - CONST OCINumber *number - OCINumber *result @@ -551,7 +612,8 @@ # round trip: 0 OCINumberMod: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -559,7 +621,8 @@ # round trip: 0 OCINumberMul: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -567,14 +630,16 @@ # round trip: 0 OCINumberNeg: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberPower: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *base - CONST OCINumber *number - OCINumber *result @@ -582,7 +647,8 @@ # round trip: 0 OCINumberRound: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - sword decplace - OCINumber *result @@ -591,20 +657,23 @@ OCINumberSetZero: :version: 800 :ret: void - :args: - OCIError *err + :args: + - OCIError *err - OCINumber *num # round trip: 0 OCINumberSin: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberSub: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number1 - CONST OCINumber *number2 - OCINumber *result @@ -612,21 +681,24 @@ # round trip: 0 OCINumberSqrt: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberTan: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberToInt: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - uword rsl_length - uword rsl_flag @@ -635,7 +707,8 @@ # round trip: 0 OCINumberToReal: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - uword rsl_length - dvoid *rsl @@ -643,7 +716,8 @@ # round trip: 0 OCINumberToText: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - CONST text *fmt - ub4 fmt_length @@ -655,7 +729,8 @@ # round trip: 0 OCINumberTrunc: :version: 800 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - sword decplace - OCINumber *resulty @@ -663,7 +738,8 @@ # round trip: 0 OCIObjectFree: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - dvoid *instance - ub2 flags @@ -671,7 +747,8 @@ # round trip: 0 OCIObjectGetInd: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - dvoid *instance - dvoid **null_struct @@ -679,7 +756,8 @@ # round trip: 0 OCIObjectNew: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCISvcCtx *svc - OCITypeCode typecode @@ -692,7 +770,8 @@ # round trip: 0 or 1 OCIObjectPin_nb: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - OCIRef *object_ref - OCIComplexObject *corhdl @@ -704,14 +783,16 @@ # round trip: 0 OCIObjectUnpin: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - dvoid *object # round trip: ??? OCIParamGet: :version: 800 - :args: - CONST dvoid *hndlp + :args: + - CONST dvoid *hndlp - ub4 htype - OCIError *errhp - dvoid **parmdpp @@ -720,7 +801,8 @@ # round trip: 1 OCISessionBegin_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCISession *usrhp - ub4 credt @@ -729,7 +811,8 @@ # round trip: 0 OCIRawAssignBytes: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST ub1 *rhs - ub4 rhs_len @@ -739,20 +822,23 @@ OCIRawPtr: :version: 800 :ret: ub1 * - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIRaw *raw # round trip: 0 OCIRawSize: :version: 800 :ret: ub4 - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIRaw *raw # round trip: 1 OCISessionEnd_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCISession *usrhp - ub4 mode @@ -760,7 +846,8 @@ # round trip: 1 OCIServerAttach_nb: :version: 800 - :args: - OCIServer *srvhp + :args: + - OCIServer *srvhp - OCIError *errhp - CONST text *dblink - sb4 dblink_len @@ -769,14 +856,16 @@ # round trip: 1 OCIServerDetach_nb: :version: 800 - :args: - OCIServer *srvhp + :args: + - OCIServer *srvhp - OCIError *errhp - ub4 mode # round trip: ? OCIServerVersion: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp - OraText *bufp - ub4 bufsz @@ -785,7 +874,8 @@ # round trip: 1 OCIStmtExecute_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIStmt *stmtp - OCIError *errhp - ub4 iters @@ -797,7 +887,8 @@ # round trip: 0 if a next row is in pre-fetch buffer, otherwise 1 OCIStmtFetch_nb: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIError *errhp - ub4 nrows - ub2 orientation @@ -805,7 +896,8 @@ OCIStmtGetPieceInfo: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIError *errhp - dvoid **hndlpp - ub4 *typep @@ -816,7 +908,8 @@ OCIStmtPrepare: :version: 800 - :args: - OCIStmt *stmtp + :args: + - OCIStmt *stmtp - OCIError *errhp - CONST text *stmt - ub4 stmt_len @@ -825,7 +918,8 @@ OCIStmtSetPieceInfo: :version: 800 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - ub4 type - OCIError *errhp - CONST dvoid *bufp @@ -837,7 +931,8 @@ # round trip: 0 OCIStringAssignText: :version: 800 - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST text *rhs - ub4 rhs_len @@ -847,27 +942,31 @@ OCIStringPtr: :version: 800 :ret: text * - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIString *vs # round trip: 0 OCIStringSize: :version: 800 :ret: ub4 - :args: - OCIEnv *env + :args: + - OCIEnv *env - CONST OCIString *vs # round trip: 1 OCITransCommit_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - ub4 flags # round trip: 1 OCITransRollback_nb: :version: 800 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - ub4 flags @@ -875,7 +974,8 @@ OCITypeTypeCode: :version: 800 :ret: OCITypeCode - :args: - OCIEnv *env + :args: + - OCIEnv *env - OCIError *err - CONST OCIType *tdo @@ -887,7 +987,8 @@ # round trip: 0 OCIEnvCreate: :version: 810 - :args: - OCIEnv **envp + :args: + - OCIEnv **envp - ub4 mode - dvoid *ctxp - dvoid *(*malocfp)(dvoid *ctxp, size_t size) @@ -899,14 +1000,16 @@ # round trip: 1 OCILobClose_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp # round trip: 1 OCILobCreateTemporary_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub2 csid @@ -918,14 +1021,16 @@ # round trip: 1 OCILobFreeTemporary_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp # round trip: 1 OCILobGetChunkSize_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub4 *chunksizep @@ -933,7 +1038,8 @@ # round trip: 0 OCILobIsTemporary: :version: 810 - :args: - OCIEnv *envp + :args: + - OCIEnv *envp - OCIError *errhp - OCILobLocator *locp - boolean *is_temporary @@ -941,7 +1047,8 @@ # round trip: 1 if either destination or source lob is a temporary, otherwise 0 OCILobLocatorAssign_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - CONST OCILobLocator *src_locp - OCILobLocator **dst_locpp @@ -949,14 +1056,16 @@ # round trip 1 OCILobOpen_nb: :version: 810 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - ub1 mode OCIMessageOpen: :version: 810 - :args: - dvoid *envhp + :args: + - dvoid *envhp - OCIError *errhp - OCIMsg **msghp - CONST OraText *product @@ -966,7 +1075,8 @@ OCIMessageGet: :version: 810 :ret: OraText * - :args: - OCIMsg *msgh + :args: + - OCIMsg *msgh - ub4 msgno - OraText *msgbuf - size_t buflen @@ -974,7 +1084,8 @@ # round trip: 0 OCINumberIsInt: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - boolean *result :code_if_not_found: | @@ -1001,7 +1112,8 @@ # round trip: 0 OCINumberPrec: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - eword nDigs - OCINumber *result @@ -1010,7 +1122,8 @@ OCINumberSetPi: :version: 810 :ret: void - :args: - OCIError *err + :args: + - OCIError *err - OCINumber *num :code_if_not_found: | static const OCINumber pi = { @@ -1023,7 +1136,8 @@ # round trip: 0 OCINumberShift: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - CONST sword nDig - OCINumber *result @@ -1031,7 +1145,8 @@ # round trip: 0 OCINumberSign: :version: 810 - :args: - OCIError *err + :args: + - OCIError *err - CONST OCINumber *number - sword *result :code_if_not_found: | @@ -1056,7 +1171,8 @@ # round trip: 0 OCIReset: :version: 810 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp # @@ -1065,7 +1181,8 @@ OCIConnectionPoolCreate: :version: 900 - :args: - OCIEnv *envhp + :args: + - OCIEnv *envhp - OCIError *errhp - OCICPool *poolhp - OraText **poolName @@ -1083,14 +1200,16 @@ OCIConnectionPoolDestroy: :version: 900 - :args: - OCICPool *poolhp + :args: + - OCICPool *poolhp - OCIError *errhp - ub4 mode # round trip: 0 (not docmented. I guess.) OCIDateTimeConstruct: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - OCIDateTime *datetime - sb2 yr @@ -1106,7 +1225,8 @@ # round trip: 0 (not docmented. I guess.) OCIDateTimeGetDate: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - CONST OCIDateTime *date - sb2 *yr @@ -1116,7 +1236,8 @@ # round trip: 0 (not docmented. I guess.) OCIDateTimeGetTime: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - OCIDateTime *datetime - ub1 *hr @@ -1127,7 +1248,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalFromText: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - CONST OraText *inpstr - size_t str_len @@ -1136,7 +1258,8 @@ # round trip: 0 (not docmented. I guess.) OCIDateTimeGetTimeZoneOffset: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - CONST OCIDateTime *datetime - sb1 *hr @@ -1145,7 +1268,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalGetDaySecond: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 *dy - sb4 *hr @@ -1157,7 +1281,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalGetYearMonth: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 *yr - sb4 *mnth @@ -1166,7 +1291,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalSetDaySecond: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 dy - sb4 hr @@ -1178,7 +1304,8 @@ # round trip: 0 (not docmented. I guess.) OCIIntervalSetYearMonth: :version: 900 - :args: - dvoid *hndl + :args: + - dvoid *hndl - OCIError *err - sb4 yr - sb4 mnth @@ -1187,7 +1314,8 @@ # round trip: 0 (not docmented. I guess.) OCIRowidToChar: :version: 900 - :args: - OCIRowid *rowidDesc + :args: + - OCIRowid *rowidDesc - OraText *outbfp - ub2 *outbflp - OCIError *errhp @@ -1196,7 +1324,8 @@ # This is documented in Oracle 11g. OCIServerRelease: :version: 900 - :args: - dvoid *hndlp + :args: + - dvoid *hndlp - OCIError *errhp - OraText *bufp - ub4 bufsz @@ -1210,7 +1339,8 @@ # round trip: 0 (not docmented. I guess.) OCINlsCharSetIdToName: :version: 920 - :args: - dvoid *envhp + :args: + - dvoid *envhp - oratext *buf - size_t buflen - ub2 id @@ -1218,7 +1348,8 @@ OCINlsCharSetNameToId: :version: 920 :ret: ub2 - :args: - dvoid *envhp + :args: + - dvoid *envhp - const oratext *name # @@ -1228,7 +1359,8 @@ # round trip: 1 OCILobGetLength2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 *lenp @@ -1236,7 +1368,8 @@ # round trip: 0 or 1 OCILobRead2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 *byte_amtp @@ -1253,7 +1386,8 @@ # round trip: 1 OCILobTrim2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 newlen @@ -1261,7 +1395,8 @@ # round trip: 0 or 1 OCILobWrite2_nb: :version: 1010 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCILobLocator *locp - oraub8 *byte_amtp @@ -1283,7 +1418,8 @@ OCIClientVersion: :version: 1020 :ret: void - :args: - sword *major_version + :args: + - sword *major_version - sword *minor_version - sword *update_num - sword *patch_num @@ -1292,7 +1428,8 @@ # round trip: 1 OCIDBStartup_nb: :version: 1020 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCIAdmin *admhp - ub4 mode @@ -1301,7 +1438,8 @@ # round trip: 1 OCIDBShutdown_nb: :version: 1020 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - OCIAdmin *admhp - ub4 mode @@ -1309,7 +1447,8 @@ # round trip: 1 OCIPing_nb: :version: 1020 - :args: - OCISvcCtx *svchp + :args: + - OCISvcCtx *svchp - OCIError *errhp - ub4 mode @@ -1319,7 +1458,8 @@ OCIArrayDescriptorAlloc: :version: 1110 - :args: - const void *parenth + :args: + - const void *parenth - void **descpp - const ub4 type - ub4 array_size @@ -1328,5 +1468,6 @@ OCIArrayDescriptorFree: :version: 1110 - :args: - void **descp + :args: + - void **descp - const ub4 type Modified: trunk/ruby-oci8/ext/oci8/extconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/extconf.rb 2011-06-10 13:04:21 UTC (rev 426) +++ trunk/ruby-oci8/ext/oci8/extconf.rb 2011-06-10 13:32:09 UTC (rev 427) @@ -116,6 +116,7 @@ have_type("rb_blocking_function_t", "ruby.h") have_func("rb_set_end_proc", "ruby.h") +have_func("rb_class_superclass", "ruby.h") # replace files replace = { Modified: trunk/ruby-oci8/ext/oci8/oci8.h =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.h 2011-06-10 13:04:21 UTC (rev 426) +++ trunk/ruby-oci8/ext/oci8/oci8.h 2011-06-10 13:32:09 UTC (rev 427) @@ -74,10 +74,10 @@ #ifndef HAVE_TYPE_ORATEXT typedef unsigned char oratext; #endif -#ifndef HAVE_TYPE_OCIDATETIME_ +#if !defined HAVE_TYPE_OCIDATETIME_ && !defined HAVE_TYPE_OCIDATETIMEP typedef struct OCIDateTime OCIDateTime; #endif -#ifndef HAVE_TYPE_OCIINTERVAL_ +#if !defined HAVE_TYPE_OCIINTERVAL_ && !defined HAVE_TYPE_OCIINTERVALP typedef struct OCIInterval OCIInterval; #endif #ifndef HAVE_TYPE_OCICALLBACKLOBREAD2 @@ -90,13 +90,13 @@ ub1 *piece, dvoid **changed_bufpp, oraub8 *changed_lenp); #endif -#ifndef HAVE_TYPE_OCIADMIN_ +#if !defined HAVE_TYPE_OCIADMIN_ && !defined HAVE_TYPE_OCIADMINP typedef struct OCIAdmin OCIAdmin; #endif -#ifndef HAVE_TYPE_OCIMSG_ +#if !defined HAVE_TYPE_OCIMSG_ && !defined HAVE_TYPE_OCIMSGP typedef struct OCIMsg OCIMsg; #endif -#ifndef HAVE_TYPE_OCICPOOL_ +#if !defined HAVE_TYPE_OCICPOOL_ && !defined HAVE_TYPE_OCICPOOLP typedef struct OCICPool OCICPool; #endif @@ -119,9 +119,6 @@ /* new macros in ruby 1.9. * define compatible macros for ruby 1.8 or lower. */ -#ifndef RCLASS_SUPER -#define RCLASS_SUPER(c) RCLASS(c)->super -#endif #ifndef RFLOAT_VALUE #define RFLOAT_VALUE(obj) RFLOAT(obj)->value #endif @@ -152,6 +149,17 @@ #define rb_usascii_str_new_cstr(ptr) rb_str_new2(ptr) #endif +/* a new function in ruby 1.9.3. + * define a compatible macro for ruby 1.9.2 or lower. + */ +#ifndef HAVE_RB_CLASS_SUPERCLASS +#ifdef RCLASS_SUPER +#define rb_class_superclass(cls) RCLASS_SUPER(cls) +#else +#define rb_class_superclass(cls) (RCLASS(cls)->super) +#endif +#endif + /* macros depends on the compiler. * LIKELY(x) hint for the compiler that 'x' is 1(TRUE) in many cases. * UNLIKELY(x) hint for the compiler that 'x' is 0(FALSE) in many cases. Modified: trunk/ruby-oci8/ext/oci8/ocihandle.c =================================================================== --- trunk/ruby-oci8/ext/oci8/ocihandle.c 2011-06-10 13:04:21 UTC (rev 426) +++ trunk/ruby-oci8/ext/oci8/ocihandle.c 2011-06-10 13:32:09 UTC (rev 427) @@ -82,7 +82,7 @@ superklass = klass; while (!RTEST(rb_ivar_defined(superklass, oci8_id_oci8_class))) { - superklass = RCLASS_SUPER(superklass); + superklass = rb_class_superclass(superklass); if (superklass == rb_cObject) rb_raise(rb_eRuntimeError, "private method `new' called for %s:Class", rb_class2name(klass)); } Modified: trunk/ruby-oci8/lib/oci8/oci8.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oci8.rb 2011-06-10 13:04:21 UTC (rev 426) +++ trunk/ruby-oci8/lib/oci8/oci8.rb 2011-06-10 13:32:09 UTC (rev 427) @@ -8,6 +8,7 @@ # require 'date' +require 'yaml' # A connection to a Oracle database server. # @@ -655,14 +656,29 @@ end class OraNumber - def yaml_initialize(type, val) # :nodoc: - initialize(val) - end - def to_yaml(opts = {}) # :nodoc: - YAML.quick_emit(object_id, opts) do |out| - out.scalar(taguri, self.to_s, :plain) + if YAML == Psych + + yaml_tag '!ruby/object:OraNumber' + def encode_with coder # :nodoc: + coder.scalar = self.to_s end + + def init_with coder # :nodoc: + initialize(coder.scalar) + end + + else + + def yaml_initialize(type, val) # :nodoc: + initialize(val) + end + + def to_yaml(opts = {}) # :nodoc: + YAML.quick_emit(object_id, opts) do |out| + out.scalar(taguri, self.to_s, :plain) + end + end end def to_json(options=nil) # :nodoc: From nobody at rubyforge.org Sun Jun 12 06:21:24 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 12 Jun 2011 06:21:24 -0400 (EDT) Subject: [ruby-oci8-commit] [428] trunk/ruby-oci8: * ext/oci8/oci8lib.c: add __declspec(dllexport) to Init_oci8lib(). Message-ID: <20110612102124.8DD81185836C@rubyforge.org> Revision: 428 Author: kubo Date: 2011-06-12 06:21:23 -0400 (Sun, 12 Jun 2011) Log Message: ----------- * ext/oci8/oci8lib.c: add __declspec(dllexport) to Init_oci8lib(). The mingw32 gcc compiler doesn't export functions without it if more than one function is declared with it. * ext/oci8/oraconf.rb: work around for rubinius 1.2.3, which doesn't support Array#pack('P'). * lib/oci8/oci8.rb: fix a bug introduced by the previous commit. * ext/oci8/env.c, ext/oci8/extconf.rb, ext/oci8/oci8.c, ext/oci8/oci8.h, ext/oci8/oci8lib.c: Use HAVE_RB_THREAD_BLOCKING_REGION instead of HAVE_TYPE_RB_BLOCKING_FUNCTION_T. have_type("rb_blocking_function_t", "ruby.h") unexpectedly doesn't work on Visual Studio 2010. Modified Paths: -------------- branches/ruby-oci8-2.0/ChangeLog branches/ruby-oci8-2.0/ext/oci8/env.c branches/ruby-oci8-2.0/ext/oci8/extconf.rb branches/ruby-oci8-2.0/ext/oci8/oci8.c branches/ruby-oci8-2.0/ext/oci8/oci8.h branches/ruby-oci8-2.0/ext/oci8/oci8lib.c branches/ruby-oci8-2.0/ext/oci8/oraconf.rb branches/ruby-oci8-2.0/lib/oci8/oci8.rb trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/env.c trunk/ruby-oci8/ext/oci8/extconf.rb trunk/ruby-oci8/ext/oci8/oci8.c trunk/ruby-oci8/ext/oci8/oci8.h trunk/ruby-oci8/ext/oci8/oci8lib.c trunk/ruby-oci8/ext/oci8/oraconf.rb trunk/ruby-oci8/lib/oci8/oci8.rb Modified: branches/ruby-oci8-2.0/ChangeLog =================================================================== --- branches/ruby-oci8-2.0/ChangeLog 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/ChangeLog 2011-06-12 10:21:23 UTC (rev 428) @@ -1,3 +1,15 @@ +2011-06-12 KUBO Takehiro + * ext/oci8/oci8lib.c: add __declspec(dllexport) to Init_oci8lib(). The mingw32 + gcc compiler doesn't export functions without it if more than one function + is declared with it. + * ext/oci8/oraconf.rb: work around for rubinius 1.2.3, which doesn't support + Array#pack('P'). + * lib/oci8/oci8.rb: fix a bug introduced by the previous commit. + * ext/oci8/env.c, ext/oci8/extconf.rb, ext/oci8/oci8.c, ext/oci8/oci8.h, + ext/oci8/oci8lib.c: Use HAVE_RB_THREAD_BLOCKING_REGION instead of + HAVE_TYPE_RB_BLOCKING_FUNCTION_T. have_type("rb_blocking_function_t", "ruby.h") + unexpectedly doesn't work on Visual Studio 2010. + 2011-06-10 KUBO Takehiro * ext/oci8/apiwrap.yml, lib/oci8/oci8.rb: fix for Psych YAML library. * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/ocihandle.c: fix to Modified: branches/ruby-oci8-2.0/ext/oci8/env.c =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/env.c 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/ext/oci8/env.c 2011-06-12 10:21:23 UTC (rev 428) @@ -12,7 +12,7 @@ #include #endif -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION ub4 oci8_env_mode = OCI_OBJECT | OCI_THREADED; #else ub4 oci8_env_mode = OCI_OBJECT; @@ -31,7 +31,7 @@ return oci8_global_envhp; } -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION /* * oci8_errhp is a thread local object in ruby 1.9. */ @@ -110,11 +110,11 @@ void Init_oci8_env(void) { -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION int error; #endif -#if !defined(HAVE_TYPE_RB_BLOCKING_FUNCTION_T) && !defined(_WIN32) +#if !defined(HAVE_RB_THREAD_BLOCKING_REGION) && !defined(_WIN32) /* workaround code. * * Some instant clients set the environment variables @@ -160,7 +160,7 @@ } } -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION /* ruby 1.9 */ #if defined(_WIN32) if (!dllmain_is_called) { Modified: branches/ruby-oci8-2.0/ext/oci8/extconf.rb =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/extconf.rb 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/ext/oci8/extconf.rb 2011-06-12 10:21:23 UTC (rev 428) @@ -115,6 +115,7 @@ have_type("rb_blocking_function_t", "ruby.h") have_func("rb_set_end_proc", "ruby.h") have_func("rb_class_superclass", "ruby.h") +have_func("rb_thread_blocking_region", "ruby.h") # replace files replace = { Modified: branches/ruby-oci8-2.0/ext/oci8/oci8.c =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/oci8.c 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/ext/oci8/oci8.c 2011-06-12 10:21:23 UTC (rev 428) @@ -313,7 +313,7 @@ } svcctx->pid = getpid(); svcctx->is_autocommit = 0; -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION svcctx->non_blocking = 1; #endif svcctx->long_read_len = INT2FIX(65535); @@ -417,7 +417,7 @@ static VALUE oci8_non_blocking_p(VALUE self) { oci8_svcctx_t *svcctx = DATA_PTR(self); -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION return svcctx->non_blocking ? Qtrue : Qfalse; #else sb1 non_blocking; @@ -470,7 +470,7 @@ static VALUE oci8_set_non_blocking(VALUE self, VALUE val) { oci8_svcctx_t *svcctx = DATA_PTR(self); -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION svcctx->non_blocking = RTEST(val); #else sb1 non_blocking; @@ -560,14 +560,14 @@ static VALUE oci8_break(VALUE self) { oci8_svcctx_t *svcctx = DATA_PTR(self); -#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifndef HAVE_RB_THREAD_BLOCKING_REGION sword rv; #endif if (NIL_P(svcctx->executing_thread)) { return Qfalse; } -#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifndef HAVE_RB_THREAD_BLOCKING_REGION rv = OCIBreak(svcctx->base.hp.ptr, oci8_errhp); if (rv != OCI_SUCCESS) oci8_raise(oci8_errhp, rv, NULL); Modified: branches/ruby-oci8-2.0/ext/oci8/oci8.h =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/oci8.h 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/ext/oci8/oci8.h 2011-06-12 10:21:23 UTC (rev 428) @@ -189,7 +189,7 @@ * set a value to the key. * */ -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION /* ruby 1.9 */ #if defined(_WIN32) #include @@ -202,7 +202,7 @@ #define oci8_tls_get(key) pthread_getspecific(key) #define oci8_tls_set(key, val) pthread_setspecific((key), (val)) #endif -#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */ +#endif /* HAVE_RB_THREAD_BLOCKING_REGION */ /* utility macros */ @@ -308,7 +308,7 @@ OCIServer *srvhp; rb_pid_t pid; char is_autocommit; -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION char non_blocking; #endif VALUE long_read_len; @@ -362,7 +362,7 @@ * extern OCIError *oci8_errhp; */ #define oci8_envhp (LIKELY(oci8_global_envhp != NULL) ? oci8_global_envhp : oci8_make_envhp()) -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION #define oci8_errhp oci8_get_errhp() #else #define oci8_errhp (LIKELY(oci8_global_errhp != NULL) ? oci8_global_errhp : oci8_make_errhp()) @@ -372,7 +372,7 @@ extern ub4 oci8_env_mode; extern OCIEnv *oci8_global_envhp; OCIEnv *oci8_make_envhp(void); -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION extern oci8_tls_key_t oci8_tls_key; /* native thread key */ OCIError *oci8_make_errhp(void); Modified: branches/ruby-oci8-2.0/ext/oci8/oci8lib.c =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/oci8lib.c 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/ext/oci8/oci8lib.c 2011-06-12 10:21:23 UTC (rev 428) @@ -51,6 +51,9 @@ } #endif +#ifdef _WIN32 +__declspec(dllexport) +#endif void Init_oci8lib() { @@ -212,7 +215,7 @@ base->parent = NULL; } -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION #if 0 typedef struct { @@ -267,7 +270,7 @@ return (sword)func(data); } } -#else /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */ +#else /* HAVE_RB_THREAD_BLOCKING_REGION */ /* ruby 1.8 */ sword oci8_blocking_region(oci8_svcctx_t *svcctx, rb_blocking_function_t func, void *data) @@ -297,7 +300,7 @@ svcctx->executing_thread = Qnil; return rv; } -#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */ +#endif /* HAVE_RB_THREAD_BLOCKING_REGION */ typedef struct { oci8_svcctx_t *svcctx; Modified: branches/ruby-oci8-2.0/ext/oci8/oraconf.rb =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/oraconf.rb 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/ext/oci8/oraconf.rb 2011-06-12 10:21:23 UTC (rev 428) @@ -402,7 +402,15 @@ so_ext = 'so' nls_data_ext = nil check_proc = nil - is_32bit = [nil].pack('p').size == 4 + size_of_pointer = begin + # the size of a pointer. + [nil].pack('P').size + rescue ArgumentError + # Rubinius 1.2.3 doesn't support Array#pack('P'). + # Use Fixnum#size, which returns the size of long. + 1.size + end + is_32bit = size_of_pointer == 4 is_big_endian = "\x01\x02".unpack('s')[0] == 0x0102 case RUBY_PLATFORM when /mswin32|cygwin|mingw32|bccwin32/ Modified: branches/ruby-oci8-2.0/lib/oci8/oci8.rb =================================================================== --- branches/ruby-oci8-2.0/lib/oci8/oci8.rb 2011-06-10 13:32:09 UTC (rev 427) +++ branches/ruby-oci8-2.0/lib/oci8/oci8.rb 2011-06-12 10:21:23 UTC (rev 428) @@ -545,7 +545,7 @@ class OraNumber - if YAML == Psych + if defined? Psych and YAML == Psych yaml_tag '!ruby/object:OraNumber' def encode_with coder # :nodoc: Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/ChangeLog 2011-06-12 10:21:23 UTC (rev 428) @@ -1,3 +1,15 @@ +2011-06-12 KUBO Takehiro + * ext/oci8/oci8lib.c: add __declspec(dllexport) to Init_oci8lib(). The mingw32 + gcc compiler doesn't export functions without it if more than one function + is declared with it. + * ext/oci8/oraconf.rb: work around for rubinius 1.2.3, which doesn't support + Array#pack('P'). + * lib/oci8/oci8.rb: fix a bug introduced by the previous commit. + * ext/oci8/env.c, ext/oci8/extconf.rb, ext/oci8/oci8.c, ext/oci8/oci8.h, + ext/oci8/oci8lib.c: Use HAVE_RB_THREAD_BLOCKING_REGION instead of + HAVE_TYPE_RB_BLOCKING_FUNCTION_T. have_type("rb_blocking_function_t", "ruby.h") + unexpectedly doesn't work on Visual Studio 2010. + 2011-06-10 KUBO Takehiro * ext/oci8/apiwrap.yml, lib/oci8/oci8.rb: fix for Psych YAML library. * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/ocihandle.c: fix to Modified: trunk/ruby-oci8/ext/oci8/env.c =================================================================== --- trunk/ruby-oci8/ext/oci8/env.c 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/ext/oci8/env.c 2011-06-12 10:21:23 UTC (rev 428) @@ -12,7 +12,7 @@ #include #endif -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION ub4 oci8_env_mode = OCI_OBJECT | OCI_THREADED; #else ub4 oci8_env_mode = OCI_OBJECT; @@ -31,7 +31,7 @@ return oci8_global_envhp; } -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION /* * oci8_errhp is a thread local object in ruby 1.9. */ @@ -110,11 +110,11 @@ void Init_oci8_env(void) { -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION int error; #endif -#if !defined(HAVE_TYPE_RB_BLOCKING_FUNCTION_T) && !defined(_WIN32) +#if !defined(HAVE_RB_THREAD_BLOCKING_REGION) && !defined(_WIN32) /* workaround code. * * Some instant clients set the environment variables @@ -160,7 +160,7 @@ } } -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION /* ruby 1.9 */ #if defined(_WIN32) if (!dllmain_is_called) { Modified: trunk/ruby-oci8/ext/oci8/extconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/extconf.rb 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/ext/oci8/extconf.rb 2011-06-12 10:21:23 UTC (rev 428) @@ -117,6 +117,7 @@ have_type("rb_blocking_function_t", "ruby.h") have_func("rb_set_end_proc", "ruby.h") have_func("rb_class_superclass", "ruby.h") +have_func("rb_thread_blocking_region", "ruby.h") # replace files replace = { Modified: trunk/ruby-oci8/ext/oci8/oci8.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.c 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/ext/oci8/oci8.c 2011-06-12 10:21:23 UTC (rev 428) @@ -100,7 +100,7 @@ ((oci8_svcctx_associate_t *)svcctx->server)->svcctx = svcctx; svcctx->pid = getpid(); svcctx->is_autocommit = 0; -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION svcctx->non_blocking = 1; #endif svcctx->long_read_len = INT2FIX(65535); @@ -478,7 +478,7 @@ static VALUE oci8_non_blocking_p(VALUE self) { oci8_svcctx_t *svcctx = DATA_PTR(self); -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION return svcctx->non_blocking ? Qtrue : Qfalse; #else sb1 non_blocking; @@ -531,7 +531,7 @@ static VALUE oci8_set_non_blocking(VALUE self, VALUE val) { oci8_svcctx_t *svcctx = DATA_PTR(self); -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION svcctx->non_blocking = RTEST(val); #else sb1 non_blocking; @@ -621,14 +621,14 @@ static VALUE oci8_break(VALUE self) { oci8_svcctx_t *svcctx = DATA_PTR(self); -#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifndef HAVE_RB_THREAD_BLOCKING_REGION sword rv; #endif if (NIL_P(svcctx->executing_thread)) { return Qfalse; } -#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifndef HAVE_RB_THREAD_BLOCKING_REGION rv = OCIBreak(svcctx->base.hp.ptr, oci8_errhp); if (rv != OCI_SUCCESS) oci8_raise(oci8_errhp, rv, NULL); Modified: trunk/ruby-oci8/ext/oci8/oci8.h =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.h 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/ext/oci8/oci8.h 2011-06-12 10:21:23 UTC (rev 428) @@ -192,7 +192,7 @@ * set a value to the key. * */ -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION /* ruby 1.9 */ #if defined(_WIN32) #include @@ -205,7 +205,7 @@ #define oci8_tls_get(key) pthread_getspecific(key) #define oci8_tls_set(key, val) pthread_setspecific((key), (val)) #endif -#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */ +#endif /* HAVE_RB_THREAD_BLOCKING_REGION */ /* utility macros */ @@ -315,7 +315,7 @@ rb_pid_t pid; unsigned char state; char is_autocommit; -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION char non_blocking; #endif VALUE long_read_len; @@ -369,7 +369,7 @@ * extern OCIError *oci8_errhp; */ #define oci8_envhp (LIKELY(oci8_global_envhp != NULL) ? oci8_global_envhp : oci8_make_envhp()) -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION #define oci8_errhp oci8_get_errhp() #else #define oci8_errhp (LIKELY(oci8_global_errhp != NULL) ? oci8_global_errhp : oci8_make_errhp()) @@ -379,7 +379,7 @@ extern ub4 oci8_env_mode; extern OCIEnv *oci8_global_envhp; OCIEnv *oci8_make_envhp(void); -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION extern oci8_tls_key_t oci8_tls_key; /* native thread key */ OCIError *oci8_make_errhp(void); Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8lib.c 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/ext/oci8/oci8lib.c 2011-06-12 10:21:23 UTC (rev 428) @@ -51,6 +51,9 @@ } #endif +#ifdef _WIN32 +__declspec(dllexport) +#endif void Init_oci8lib() { @@ -216,7 +219,7 @@ base->parent = NULL; } -#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T +#ifdef HAVE_RB_THREAD_BLOCKING_REGION #if 0 typedef struct { @@ -271,7 +274,7 @@ return (sword)func(data); } } -#else /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */ +#else /* HAVE_RB_THREAD_BLOCKING_REGION */ /* ruby 1.8 */ sword oci8_blocking_region(oci8_svcctx_t *svcctx, rb_blocking_function_t func, void *data) @@ -301,7 +304,7 @@ svcctx->executing_thread = Qnil; return rv; } -#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */ +#endif /* HAVE_RB_THREAD_BLOCKING_REGION */ typedef struct { oci8_svcctx_t *svcctx; Modified: trunk/ruby-oci8/ext/oci8/oraconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/oraconf.rb 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/ext/oci8/oraconf.rb 2011-06-12 10:21:23 UTC (rev 428) @@ -402,7 +402,15 @@ so_ext = 'so' nls_data_ext = nil check_proc = nil - is_32bit = [nil].pack('p').size == 4 + size_of_pointer = begin + # the size of a pointer. + [nil].pack('P').size + rescue ArgumentError + # Rubinius 1.2.3 doesn't support Array#pack('P'). + # Use Fixnum#size, which returns the size of long. + 1.size + end + is_32bit = size_of_pointer == 4 is_big_endian = "\x01\x02".unpack('s')[0] == 0x0102 case RUBY_PLATFORM when /mswin32|cygwin|mingw32|bccwin32/ Modified: trunk/ruby-oci8/lib/oci8/oci8.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oci8.rb 2011-06-10 13:32:09 UTC (rev 427) +++ trunk/ruby-oci8/lib/oci8/oci8.rb 2011-06-12 10:21:23 UTC (rev 428) @@ -657,7 +657,7 @@ class OraNumber - if YAML == Psych + if defined? Psych and YAML == Psych yaml_tag '!ruby/object:OraNumber' def encode_with coder # :nodoc: From nobody at rubyforge.org Sun Jun 12 09:07:27 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 12 Jun 2011 09:07:27 -0400 (EDT) Subject: [ruby-oci8-commit] [429] branches/ruby-oci8-2.0: * NEWS: add changes between 2.0.4 and 2.0.5. Message-ID: <20110612130728.061D51858377@rubyforge.org> Revision: 429 Author: kubo Date: 2011-06-12 09:07:27 -0400 (Sun, 12 Jun 2011) Log Message: ----------- * NEWS: add changes between 2.0.4 and 2.0.5. * VERSION: change the version to 2.0.5. Modified Paths: -------------- branches/ruby-oci8-2.0/ChangeLog branches/ruby-oci8-2.0/NEWS branches/ruby-oci8-2.0/VERSION Modified: branches/ruby-oci8-2.0/ChangeLog =================================================================== --- branches/ruby-oci8-2.0/ChangeLog 2011-06-12 10:21:23 UTC (rev 428) +++ branches/ruby-oci8-2.0/ChangeLog 2011-06-12 13:07:27 UTC (rev 429) @@ -1,4 +1,8 @@ 2011-06-12 KUBO Takehiro + * NEWS: add changes between 2.0.4 and 2.0.5. + * VERSION: change the version to 2.0.5. + +2011-06-12 KUBO Takehiro * ext/oci8/oci8lib.c: add __declspec(dllexport) to Init_oci8lib(). The mingw32 gcc compiler doesn't export functions without it if more than one function is declared with it. Modified: branches/ruby-oci8-2.0/NEWS =================================================================== --- branches/ruby-oci8-2.0/NEWS 2011-06-12 10:21:23 UTC (rev 428) +++ branches/ruby-oci8-2.0/NEWS 2011-06-12 13:07:27 UTC (rev 429) @@ -1,3 +1,73 @@ +2.0.5: + +* New Features + + - Support Rubinius. + + - OraNumber#has_decimal_part? -> boolean + + OraNumber(10).has_decimal_part? # => false + OraNumber(10.1).has_decimal_part? # => true + + - Limitted support for OraNumber's positive and negative infinity. + + They are converted to '~' and '-~' respectively as described in + . + + - OCI8.properties is added to control ruby-oci8 behaviour. + It supports :bind_string_as_nchar only for now. + + - OCI8.properties[:bind_string_as_nchar] is added. + + You need to set "OCI8.properties[:bind_string_as_nchar] = true" + if the database character set is not UTF-8 and NCHAR/NVARCHAR2 columns + contain characters which cannot be converted to the database character set. + See: http://rubyforge.org/forum/forum.php?thread_id=48838&forum_id=1078 + +* Fixed issues + + - Fix InvalidHandle errors on Rails. + (reported by Jordan Curzon and Aaron Qian) + See: http://rubyforge.org/forum/forum.php?thread_id=49751&forum_id=1078 + + - 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." + See: http://rubyforge.org/forum/forum.php?thread_id=49102&forum_id=1078 + + - Fix unexpectedly disconnect when failed-logon connections is GC'ed + and the connection object's address is accidentally same with + an alive connection. + + - Fix segmentation fault when calling OCI8::Cursor#[] for + closed statement object's (reported by Hugo L. Borges) + + - Fix a bug that a string is bound to RAW. + Its encoding had been convertd to OCI.encoding incorrectly. + + - Fix memory leaks when temporary lobs are used. + + - Fix a problem to assign NULL bind value to object type bind variables. + (reported by Raimonds Simanovskis) + + - Support LOB datatypes in object type. + (reported by Michael Sexton) + + - Fix to compile on cygwin. The declaration of 'boolean' in Oracle + conflicts with that of latest cygwin. + (reported by Don Hill). + + - Fix to complie for the 32-bit ruby which was compiled on x86_64 linux + and configured without '--build', '--host' nor '--target'. + The RUBY_PLATFORM is 'x86_64-linux' even though the ruby is 32-bit. + (reported by Jason Renschler) + + - Fix wrong dependencies in Makefile when running 'make -jNNN (where NNN >= 2)' + (contributed by Alyano Alyanos. See bug #28129 on rubyforge.) + + - Fix to compile on HP-UX. Duplicated const qualifiers prevented HP-UX cc + from compiling. (reported by Sebastian YEPES) + 2.0.4: * New Features Modified: branches/ruby-oci8-2.0/VERSION =================================================================== --- branches/ruby-oci8-2.0/VERSION 2011-06-12 10:21:23 UTC (rev 428) +++ branches/ruby-oci8-2.0/VERSION 2011-06-12 13:07:27 UTC (rev 429) @@ -1 +1 @@ -2.0.4 +2.0.5 From nobody at rubyforge.org Sun Jun 12 09:09:42 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 12 Jun 2011 09:09:42 -0400 (EDT) Subject: [ruby-oci8-commit] [430] trunk/ruby-oci8: * NEWS: add changes between 2.0.4 and 2.0.5. Message-ID: <20110612130943.1B7481858377@rubyforge.org> Revision: 430 Author: kubo Date: 2011-06-12 09:09:42 -0400 (Sun, 12 Jun 2011) Log Message: ----------- * NEWS: add changes between 2.0.4 and 2.0.5. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/NEWS Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2011-06-12 13:07:27 UTC (rev 429) +++ trunk/ruby-oci8/ChangeLog 2011-06-12 13:09:42 UTC (rev 430) @@ -1,4 +1,7 @@ 2011-06-12 KUBO Takehiro + * NEWS: add changes between 2.0.4 and 2.0.5. + +2011-06-12 KUBO Takehiro * ext/oci8/oci8lib.c: add __declspec(dllexport) to Init_oci8lib(). The mingw32 gcc compiler doesn't export functions without it if more than one function is declared with it. Modified: trunk/ruby-oci8/NEWS =================================================================== --- trunk/ruby-oci8/NEWS 2011-06-12 13:07:27 UTC (rev 429) +++ trunk/ruby-oci8/NEWS 2011-06-12 13:09:42 UTC (rev 430) @@ -1,3 +1,73 @@ +2.0.5: + +* New Features + + - Support Rubinius. + + - OraNumber#has_decimal_part? -> boolean + + OraNumber(10).has_decimal_part? # => false + OraNumber(10.1).has_decimal_part? # => true + + - Limitted support for OraNumber's positive and negative infinity. + + They are converted to '~' and '-~' respectively as described in + . + + - OCI8.properties is added to control ruby-oci8 behaviour. + It supports :bind_string_as_nchar only for now. + + - OCI8.properties[:bind_string_as_nchar] is added. + + You need to set "OCI8.properties[:bind_string_as_nchar] = true" + if the database character set is not UTF-8 and NCHAR/NVARCHAR2 columns + contain characters which cannot be converted to the database character set. + See: http://rubyforge.org/forum/forum.php?thread_id=48838&forum_id=1078 + +* Fixed issues + + - Fix InvalidHandle errors on Rails. + (reported by Jordan Curzon and Aaron Qian) + See: http://rubyforge.org/forum/forum.php?thread_id=49751&forum_id=1078 + + - 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." + See: http://rubyforge.org/forum/forum.php?thread_id=49102&forum_id=1078 + + - Fix unexpectedly disconnect when failed-logon connections is GC'ed + and the connection object's address is accidentally same with + an alive connection. + + - Fix segmentation fault when calling OCI8::Cursor#[] for + closed statement object's (reported by Hugo L. Borges) + + - Fix a bug that a string is bound to RAW. + Its encoding had been convertd to OCI.encoding incorrectly. + + - Fix memory leaks when temporary lobs are used. + + - Fix a problem to assign NULL bind value to object type bind variables. + (reported by Raimonds Simanovskis) + + - Support LOB datatypes in object type. + (reported by Michael Sexton) + + - Fix to compile on cygwin. The declaration of 'boolean' in Oracle + conflicts with that of latest cygwin. + (reported by Don Hill). + + - Fix to complie for the 32-bit ruby which was compiled on x86_64 linux + and configured without '--build', '--host' nor '--target'. + The RUBY_PLATFORM is 'x86_64-linux' even though the ruby is 32-bit. + (reported by Jason Renschler) + + - Fix wrong dependencies in Makefile when running 'make -jNNN (where NNN >= 2)' + (contributed by Alyano Alyanos. See bug #28129 on rubyforge.) + + - Fix to compile on HP-UX. Duplicated const qualifiers prevented HP-UX cc + from compiling. (reported by Sebastian YEPES) + 2.0.4: * New Features From nobody at rubyforge.org Tue Jun 14 07:42:39 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 14 Jun 2011 07:42:39 -0400 (EDT) Subject: [ruby-oci8-commit] [432] trunk/ruby-oci8/ext/oci8: * NEWS: add changes between 2.0.5 and 2.0.6 . Message-ID: <20110614114239.56612185836C@rubyforge.org> Revision: 432 Author: kubo Date: 2011-06-14 07:42:38 -0400 (Tue, 14 Jun 2011) Log Message: ----------- * NEWS: add changes between 2.0.5 and 2.0.6. * ext/oci8/apiwrap.yml, ext/oci8/lob.c: fix SEGV when freeing a temporary LOB during GC on rubinius 1.2.3. * ext/oci8/oci8lib.c: revert the exception type from RuntimeError to OCIException when a closed OCI handle's method is called. It was chaned in 2.0.5 by mistake. Modified Paths: -------------- branches/ruby-oci8-2.0/ChangeLog branches/ruby-oci8-2.0/NEWS branches/ruby-oci8-2.0/VERSION branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml branches/ruby-oci8-2.0/ext/oci8/lob.c branches/ruby-oci8-2.0/ext/oci8/oci8lib.c trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/NEWS trunk/ruby-oci8/ext/oci8/apiwrap.yml trunk/ruby-oci8/ext/oci8/lob.c trunk/ruby-oci8/ext/oci8/oci8lib.c Modified: branches/ruby-oci8-2.0/ChangeLog =================================================================== --- branches/ruby-oci8-2.0/ChangeLog 2011-06-12 13:14:51 UTC (rev 431) +++ branches/ruby-oci8-2.0/ChangeLog 2011-06-14 11:42:38 UTC (rev 432) @@ -1,3 +1,12 @@ +2011-06-14 KUBO Takehiro + * NEWS: add changes between 2.0.5 and 2.0.6. + * VERSION: change the version to 2.0.6. + * ext/oci8/apiwrap.yml, ext/oci8/lob.c: fix SEGV when freeing a temporary + LOB during GC on rubinius 1.2.3. + * ext/oci8/oci8lib.c: revert the exception type from RuntimeError to + OCIException when a closed OCI handle's method is called. + It was chaned in 2.0.5 by mistake. + 2011-06-12 KUBO Takehiro * NEWS: add changes between 2.0.4 and 2.0.5. * VERSION: change the version to 2.0.5. Modified: branches/ruby-oci8-2.0/NEWS =================================================================== --- branches/ruby-oci8-2.0/NEWS 2011-06-12 13:14:51 UTC (rev 431) +++ branches/ruby-oci8-2.0/NEWS 2011-06-14 11:42:38 UTC (rev 432) @@ -1,3 +1,13 @@ +2.0.6: + +* Fixed issues + + - fix SEGV when freeing a temporary LOB during GC on rubinius 1.2.3. + + - revert the exception type from RuntimeError to OCIException when + a closed OCI handle's method is called. It was chaned in 2.0.5 + by mistake. + 2.0.5: * New Features Modified: branches/ruby-oci8-2.0/VERSION =================================================================== --- branches/ruby-oci8-2.0/VERSION 2011-06-12 13:14:51 UTC (rev 431) +++ branches/ruby-oci8-2.0/VERSION 2011-06-14 11:42:38 UTC (rev 432) @@ -1 +1 @@ -2.0.5 +2.0.6 Modified: branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml 2011-06-12 13:14:51 UTC (rev 431) +++ branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml 2011-06-14 11:42:38 UTC (rev 432) @@ -1019,7 +1019,7 @@ - OCIDuration duration # round trip: 1 -OCILobFreeTemporary_nb: +OCILobFreeTemporary: :version: 810 :args: - OCISvcCtx *svchp Modified: branches/ruby-oci8-2.0/ext/oci8/lob.c =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/lob.c 2011-06-12 13:14:51 UTC (rev 431) +++ branches/ruby-oci8-2.0/ext/oci8/lob.c 2011-06-14 11:42:38 UTC (rev 432) @@ -23,6 +23,7 @@ typedef struct { oci8_base_t base; VALUE svc; + OCISvcCtx *svchp; ub4 pos; int char_width; ub1 csfrm; @@ -96,28 +97,20 @@ rb_gc_mark(lob->svc); } -static VALUE free_temp_lob(oci8_lob_t *lob) -{ - oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc); - - OCILobFreeTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob); - return Qnil; -} - static void oci8_lob_free(oci8_base_t *base) { oci8_lob_t *lob = (oci8_lob_t *)base; boolean is_temporary; - if (have_OCILobIsTemporary + if (have_OCILobIsTemporary && lob->svchp != NULL && OCILobIsTemporary(oci8_envhp, oci8_errhp, lob->base.hp.lob, &is_temporary) == OCI_SUCCESS && is_temporary) { - /* Exceptions in free_temp_lob() are ignored. - * oci8_lob_free() is called in GC. It must not raise an exception. - */ - rb_rescue(free_temp_lob, (VALUE)base, NULL, 0); + + /* FIXME: This may stall the GC. */ + OCILobFreeTemporary(lob->svchp, oci8_errhp, lob->base.hp.lob); } lob->svc = Qnil; + lob->svchp = NULL; } static oci8_base_class_t oci8_lob_class = { @@ -191,6 +184,7 @@ oci8_env_raise(oci8_envhp, rv); lob->base.type = OCI_DTYPE_LOB; lob->svc = svc; + lob->svchp = NULL; lob->pos = 0; lob->char_width = 1; lob->csfrm = csfrm; @@ -202,6 +196,7 @@ oci8_svcctx_t *svcctx = oci8_get_svcctx(svc); OCI8StringValue(val); oci_lc(OCILobCreateTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, 0, csfrm, lobtype, TRUE, OCI_DURATION_SESSION)); + lob->svchp = oci8_get_oci_svcctx(svc); oci8_lob_write(self, val); } else { rb_raise(rb_eRuntimeError, "creating a temporary lob is not supported on this Oracle version"); Modified: branches/ruby-oci8-2.0/ext/oci8/oci8lib.c =================================================================== --- branches/ruby-oci8-2.0/ext/oci8/oci8lib.c 2011-06-12 13:14:51 UTC (rev 431) +++ branches/ruby-oci8-2.0/ext/oci8/oci8lib.c 2011-06-14 11:42:38 UTC (rev 432) @@ -498,7 +498,7 @@ } Data_Get_Struct(obj, oci8_base_t, hp); if (hp->type == 0) { - rb_raise(rb_eRuntimeError, "%s was already closed.", + rb_raise(eOCIException, "%s was already closed.", rb_obj_classname(obj)); } return hp; Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2011-06-12 13:14:51 UTC (rev 431) +++ trunk/ruby-oci8/ChangeLog 2011-06-14 11:42:38 UTC (rev 432) @@ -1,3 +1,11 @@ +2011-06-14 KUBO Takehiro + * NEWS: add changes between 2.0.5 and 2.0.6. + * ext/oci8/apiwrap.yml, ext/oci8/lob.c: fix SEGV when freeing a temporary + LOB during GC on rubinius 1.2.3. + * ext/oci8/oci8lib.c: revert the exception type from RuntimeError to + OCIException when a closed OCI handle's method is called. + It was chaned in 2.0.5 by mistake. + 2011-06-12 KUBO Takehiro * NEWS: add changes between 2.0.4 and 2.0.5. Modified: trunk/ruby-oci8/NEWS =================================================================== --- trunk/ruby-oci8/NEWS 2011-06-12 13:14:51 UTC (rev 431) +++ trunk/ruby-oci8/NEWS 2011-06-14 11:42:38 UTC (rev 432) @@ -1,3 +1,13 @@ +2.0.6: + +* Fixed issues + + - fix SEGV when freeing a temporary LOB during GC on rubinius 1.2.3. + + - revert the exception type from RuntimeError to OCIException when + a closed OCI handle's method is called. It was chaned in 2.0.5 + by mistake. + 2.0.5: * New Features Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml =================================================================== --- trunk/ruby-oci8/ext/oci8/apiwrap.yml 2011-06-12 13:14:51 UTC (rev 431) +++ trunk/ruby-oci8/ext/oci8/apiwrap.yml 2011-06-14 11:42:38 UTC (rev 432) @@ -1019,7 +1019,7 @@ - OCIDuration duration # round trip: 1 -OCILobFreeTemporary_nb: +OCILobFreeTemporary: :version: 810 :args: - OCISvcCtx *svchp Modified: trunk/ruby-oci8/ext/oci8/lob.c =================================================================== --- trunk/ruby-oci8/ext/oci8/lob.c 2011-06-12 13:14:51 UTC (rev 431) +++ trunk/ruby-oci8/ext/oci8/lob.c 2011-06-14 11:42:38 UTC (rev 432) @@ -23,6 +23,7 @@ typedef struct { oci8_base_t base; VALUE svc; + OCISvcCtx *svchp; ub4 pos; int char_width; ub1 csfrm; @@ -96,28 +97,20 @@ rb_gc_mark(lob->svc); } -static VALUE free_temp_lob(oci8_lob_t *lob) -{ - oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc); - - OCILobFreeTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob); - return Qnil; -} - static void oci8_lob_free(oci8_base_t *base) { oci8_lob_t *lob = (oci8_lob_t *)base; boolean is_temporary; - if (have_OCILobIsTemporary + if (have_OCILobIsTemporary && lob->svchp != NULL && OCILobIsTemporary(oci8_envhp, oci8_errhp, lob->base.hp.lob, &is_temporary) == OCI_SUCCESS && is_temporary) { - /* Exceptions in free_temp_lob() are ignored. - * oci8_lob_free() is called in GC. It must not raise an exception. - */ - rb_rescue(free_temp_lob, (VALUE)base, NULL, 0); + + /* FIXME: This may stall the GC. */ + OCILobFreeTemporary(lob->svchp, oci8_errhp, lob->base.hp.lob); } lob->svc = Qnil; + lob->svchp = NULL; } static oci8_base_class_t oci8_lob_class = { @@ -191,6 +184,7 @@ oci8_env_raise(oci8_envhp, rv); lob->base.type = OCI_DTYPE_LOB; lob->svc = svc; + lob->svchp = NULL; lob->pos = 0; lob->char_width = 1; lob->csfrm = csfrm; @@ -202,6 +196,7 @@ oci8_svcctx_t *svcctx = oci8_get_svcctx(svc); OCI8StringValue(val); oci_lc(OCILobCreateTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, 0, csfrm, lobtype, TRUE, OCI_DURATION_SESSION)); + lob->svchp = oci8_get_oci_svcctx(svc); oci8_lob_write(self, val); } else { rb_raise(rb_eRuntimeError, "creating a temporary lob is not supported on this Oracle version"); Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8lib.c 2011-06-12 13:14:51 UTC (rev 431) +++ trunk/ruby-oci8/ext/oci8/oci8lib.c 2011-06-14 11:42:38 UTC (rev 432) @@ -502,7 +502,7 @@ } Data_Get_Struct(obj, oci8_base_t, hp); if (hp->type == 0) { - rb_raise(rb_eRuntimeError, "%s was already closed.", + rb_raise(eOCIException, "%s was already closed.", rb_obj_classname(obj)); } return hp; From nobody at rubyforge.org Wed Jun 15 08:56:35 2011 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 15 Jun 2011 08:56:35 -0400 (EDT) Subject: [ruby-oci8-commit] [434] trunk/ruby-oci8: * ext/oci8/apiwrap.yml, ext/oci8/bind.c, ext/oci8/ oci8.c, ext/oci8/oci8lib.c, Message-ID: <20110615125636.2DB1D1678328@rubyforge.org> Revision: 434 Author: kubo Date: 2011-06-15 08:56:35 -0400 (Wed, 15 Jun 2011) Log Message: ----------- * ext/oci8/apiwrap.yml, ext/oci8/bind.c, ext/oci8/oci8.c, ext/oci8/oci8lib.c, lib/oci8/bindtype.rb: drop Oracle 8i support. * ext/oci8/ocidatetime.c: OCI8::BindType::OCIDate was deleted. * lib/oci8/datetime.rb, test/test_datetime.rb: OCI8::BindType::DateTimeViaOCIDate, OCI8::BindType::TimeViaOCIDate, OCI8::BindType::DateTimeViaOCITimestampTZ and OCI8::BindType::TimeViaOCITimestampTZ were deleted. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/apiwrap.yml trunk/ruby-oci8/ext/oci8/bind.c trunk/ruby-oci8/ext/oci8/oci8.c trunk/ruby-oci8/ext/oci8/oci8lib.c trunk/ruby-oci8/ext/oci8/ocidatetime.c trunk/ruby-oci8/lib/oci8/bindtype.rb trunk/ruby-oci8/lib/oci8/datetime.rb trunk/ruby-oci8/test/test_datetime.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/ChangeLog 2011-06-15 12:56:35 UTC (rev 434) @@ -1,3 +1,11 @@ +2011-06-15 KUBO Takehiro + * ext/oci8/apiwrap.yml, ext/oci8/bind.c, ext/oci8/oci8.c, ext/oci8/oci8lib.c, + lib/oci8/bindtype.rb: drop Oracle 8i support. + * ext/oci8/ocidatetime.c: OCI8::BindType::OCIDate was deleted. + * lib/oci8/datetime.rb, test/test_datetime.rb: OCI8::BindType::DateTimeViaOCIDate, + OCI8::BindType::TimeViaOCIDate, OCI8::BindType::DateTimeViaOCITimestampTZ + and OCI8::BindType::TimeViaOCITimestampTZ were deleted. + 2011-06-14 KUBO Takehiro * NEWS: add changes between 2.0.5 and 2.0.6. * ext/oci8/apiwrap.yml, ext/oci8/lob.c: fix SEGV when freeing a temporary Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml =================================================================== --- trunk/ruby-oci8/ext/oci8/apiwrap.yml 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/ext/oci8/apiwrap.yml 2011-06-15 12:56:35 UTC (rev 434) @@ -220,14 +220,6 @@ - dvoid *descp - ub4 type -OCIEnvInit: - :version: 800 - :args: - - OCIEnv **envp - - ub4 mode - - size_t xtramem_sz - - dvoid **usrmempp - OCIErrorGet: :version: 800 :args: @@ -255,16 +247,6 @@ - ub4 type # round trip: 0 -OCIInitialize: - :version: 800 - :args: - - ub4 mode - - dvoid *ctxp - - dvoid *(*malocfp)(dvoid *ctxp, size_t size) - - dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t newsize) - - void (*mfreefp)(dvoid *ctxp, dvoid *memptr) - -# round trip: 0 OCILobAssign: :version: 800 :args: Modified: trunk/ruby-oci8/ext/oci8/bind.c =================================================================== --- trunk/ruby-oci8/ext/oci8/bind.c 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/ext/oci8/bind.c 2011-06-15 12:56:35 UTC (rev 434) @@ -93,7 +93,7 @@ { oci8_bind_string_t *obs = (oci8_bind_string_t *)obind; - if (oracle_client_version >= ORAVER_9_0 && obs->charlen != 0) { + if (obs->charlen != 0) { oci_lc(OCIAttrSet(obind->base.hp.ptr, obind->base.type, (void*)&obs->charlen, 0, OCI_ATTR_MAXCHAR_SIZE, oci8_errhp)); } oci_lc(OCIAttrSet(obind->base.hp.ptr, obind->base.type, (void*)&obs->csfrm, 0, OCI_ATTR_CHARSET_FORM, oci8_errhp)); Modified: trunk/ruby-oci8/ext/oci8/oci8.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.c 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/ext/oci8/oci8.c 2011-06-15 12:56:35 UTC (rev 434) @@ -756,7 +756,6 @@ { char *ptr; ub4 size; - int use_attr_set = 1; if (!NIL_P(val)) { OCI8SafeStringValue(val); @@ -767,20 +766,14 @@ size = 0; } - if (oracle_client_version < ORAVER_9_0) { - use_attr_set = 0; - } else if (oracle_client_version < ORAVERNUM(9, 2, 0, 3, 0) && size == 0) { - /* Workaround for Bug 2449486 */ - use_attr_set = 0; - } - - if (use_attr_set) { + if (oracle_client_version >= ORAVERNUM(9, 2, 0, 3, 0) || size >= 0) { if (size > 0 && ptr[0] == ':') { rb_raise(rb_eArgError, "client identifier should not start with ':'."); } oci_lc(OCIAttrSet(oci8_get_oci_session(self), OCI_HTYPE_SESSION, ptr, size, OCI_ATTR_CLIENT_IDENTIFIER, oci8_errhp)); } else { + /* Workaround for Bug 2449486 */ oci8_exec_sql_var_t bind_vars[1]; /* :client_id */ Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8lib.c 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/ext/oci8/oci8lib.c 2011-06-15 12:56:35 UTC (rev 434) @@ -64,6 +64,10 @@ #ifdef RUNTIME_API_CHECK Init_oci8_apiwrap(); + if (oracle_client_version < ORAVER_9_0) { + rb_raise(rb_eLoadError, "Oracle 8 (8.0) and Oracle 8i (8.1) is not supported anymore!"); + } + if (have_OCIClientVersion) { sword major, minor, update, patch, port_update; OCIClientVersion(&major, &minor, &update, &patch, &port_update); @@ -115,32 +119,16 @@ Init_oci8_lob(cOCI8); /* allocate a temporary errhp to pass Init_oci_number() */ - if (have_OCIEnvCreate) { - rv = OCIEnvCreate(&envhp, oci8_env_mode, NULL, NULL, NULL, NULL, 0, NULL); - if (rv != OCI_SUCCESS) { - oci8_raise_init_error(); - } - } else { - rv = OCIInitialize(oci8_env_mode, NULL, NULL, NULL, NULL); - if (rv != OCI_SUCCESS) { - oci8_raise_init_error(); - } - rv = OCIEnvInit(&envhp, OCI_DEFAULT, 0, NULL); - if (rv != OCI_SUCCESS) { - oci8_raise_init_error(); - } + rv = OCIEnvCreate(&envhp, oci8_env_mode, NULL, NULL, NULL, NULL, 0, NULL); + if (rv != OCI_SUCCESS) { + oci8_raise_init_error(); } rv = OCIHandleAlloc(envhp, (dvoid *)&errhp, OCI_HTYPE_ERROR, 0, NULL); if (rv != OCI_SUCCESS) oci8_env_raise(envhp, rv); Init_oci_number(cOCI8, errhp); OCIHandleFree(errhp, OCI_HTYPE_ERROR); - if (have_OCIEnvCreate) { - OCIHandleFree(envhp, OCI_HTYPE_ENV); - } else { - /* Delayed OCIEnv initialization cannot be used on Oracle 8.0. */ - oci8_global_envhp = envhp; - } + OCIHandleFree(envhp, OCI_HTYPE_ENV); Init_ora_date(); Init_oci_datetime(); @@ -154,10 +142,6 @@ #ifdef DEBUG_CORE_FILE signal(SIGSEGV, SIG_DFL); #endif - - if (have_OCIEnvCreate && oci8_global_envhp != NULL) { - rb_raise(rb_eRuntimeError, "Internal Error: OCIEnv should not be initialized here."); - } } VALUE oci8_define_class(const char *name, oci8_base_class_t *base_class) Modified: trunk/ruby-oci8/ext/oci8/ocidatetime.c =================================================================== --- trunk/ruby-oci8/ext/oci8/ocidatetime.c 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/ext/oci8/ocidatetime.c 2011-06-15 12:56:35 UTC (rev 434) @@ -68,40 +68,6 @@ return od; } -static VALUE bind_ocidate_get(oci8_bind_t *obind, void *data, void *null_struct) -{ - return oci8_make_ocidate((OCIDate *)data); -} - -static void bind_ocidate_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val) -{ - oci8_set_ocidate((OCIDate *)data, val); -} - -static void bind_ocidate_init(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE length) -{ - obind->value_sz = sizeof(OCIDate); - obind->alloc_sz = sizeof(OCIDate); -} - -static const oci8_bind_class_t bind_ocidate_class = { - { - NULL, - oci8_bind_free, - sizeof(oci8_bind_t) - }, - bind_ocidate_get, - bind_ocidate_set, - bind_ocidate_init, - NULL, - NULL, - NULL, - NULL, - SQLT_ODT, -}; - -#if defined RUNTIME_API_CHECK || ORACLE_CLIENT_VERSION >= ORAVER_9_0 - static void bind_init_elem_common(oci8_bind_t *obind, VALUE svc, ub4 type) { ub4 idx = 0; @@ -491,18 +457,9 @@ SQLT_INTERVAL_DS }; -#endif /* defined RUNTIME_API_CHECK || ORACLE_CLIENT_VERSION >= ORAVER_9_0 */ - void Init_oci_datetime(void) { - oci8_define_bind_class("OCIDate", &bind_ocidate_class); - -#if defined RUNTIME_API_CHECK || ORACLE_CLIENT_VERSION >= ORAVER_9_0 - if (oracle_client_version >= ORAVER_9_0) { - oci8_define_bind_class("OCITimestampTZ", &bind_ocitimestamp_tz_class); - oci8_define_bind_class("OCIIntervalYM", &bind_ociinterval_ym_class); - oci8_define_bind_class("OCIIntervalDS", &bind_ociinterval_ds_class); - } -#endif - + oci8_define_bind_class("OCITimestampTZ", &bind_ocitimestamp_tz_class); + oci8_define_bind_class("OCIIntervalYM", &bind_ociinterval_ym_class); + oci8_define_bind_class("OCIIntervalDS", &bind_ociinterval_ds_class); } Modified: trunk/ruby-oci8/lib/oci8/bindtype.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/bindtype.rb 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/lib/oci8/bindtype.rb 2011-06-15 12:56:35 UTC (rev 434) @@ -277,13 +277,11 @@ # DATE SQLT_DAT 7 0 0 OCI8::BindType::Mapping[:date] = OCI8::BindType::Time -if OCI8.oracle_client_version >= OCI8::ORAVER_9_0 - OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::Time - OCI8::BindType::Mapping[:timestamp_tz] = OCI8::BindType::Time - OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::Time - OCI8::BindType::Mapping[:interval_ym] = OCI8::BindType::IntervalYM - OCI8::BindType::Mapping[:interval_ds] = OCI8::BindType::IntervalDS -end +OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::Time +OCI8::BindType::Mapping[:timestamp_tz] = OCI8::BindType::Time +OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::Time +OCI8::BindType::Mapping[:interval_ym] = OCI8::BindType::IntervalYM +OCI8::BindType::Mapping[:interval_ds] = OCI8::BindType::IntervalDS # datatype type size prec scale # ------------------------------------------------- Modified: trunk/ruby-oci8/lib/oci8/datetime.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/datetime.rb 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/lib/oci8/datetime.rb 2011-06-15 12:56:35 UTC (rev 434) @@ -164,120 +164,67 @@ ocidate_to_datetime(ary) end - if OCI8.oracle_client_version >= ORAVER_9_0 + def ocitimestamp_to_datetime(ary) + return nil if ary.nil? - def ocitimestamp_to_datetime(ary) - return nil if ary.nil? - - year, month, day, hour, minute, sec, fsec, tz_hour, tz_min = ary - if @@datetime_has_fractional_second_bug and sec >= 59 and fsec != 0 - # convert to a DateTime via a String as a workaround - if tz_hour >= 0 && tz_min >= 0 - sign = ?+ - else - sign = ?- - tz_hour = - tz_hour - tz_min = - tz_min - end - time_str = format("%04d-%02d-%02dT%02d:%02d:%02d.%09d%c%02d:%02d", - year, month, day, hour, minute, sec, fsec, sign, tz_hour, tz_min) - ::DateTime.parse(time_str) + year, month, day, hour, minute, sec, fsec, tz_hour, tz_min = ary + if @@datetime_has_fractional_second_bug and sec >= 59 and fsec != 0 + # convert to a DateTime via a String as a workaround + if tz_hour >= 0 && tz_min >= 0 + sign = ?+ else - sec += fsec.to_r / 1000000000 - offset = tz_hour.to_r / 24 + tz_min.to_r / 1440 - ::DateTime.civil(year, month, day, hour, minute, sec, offset) + sign = ?- + tz_hour = - tz_hour + tz_min = - tz_min end + time_str = format("%04d-%02d-%02dT%02d:%02d:%02d.%09d%c%02d:%02d", + year, month, day, hour, minute, sec, fsec, sign, tz_hour, tz_min) + ::DateTime.parse(time_str) + else + sec += fsec.to_r / 1000000000 + offset = tz_hour.to_r / 24 + tz_min.to_r / 1440 + ::DateTime.civil(year, month, day, hour, minute, sec, offset) end + end - if @@time_new_accepts_timezone + if @@time_new_accepts_timezone - # after ruby 1.9.2 - def ocitimestamp_to_time(ary) - return nil if ary.nil? + # after ruby 1.9.2 + def ocitimestamp_to_time(ary) + return nil if ary.nil? - year, month, day, hour, minute, sec, fsec, tz_hour, tz_min = ary + year, month, day, hour, minute, sec, fsec, tz_hour, tz_min = ary - sec += fsec / Rational(1000000000) - utc_offset = tz_hour * 3600 + tz_min * 60 - return ::Time.new(year, month, day, hour, minute, sec, utc_offset) - end + sec += fsec / Rational(1000000000) + utc_offset = tz_hour * 3600 + tz_min * 60 + return ::Time.new(year, month, day, hour, minute, sec, utc_offset) + end - else + else - # prior to ruby 1.9.2 - def ocitimestamp_to_time(ary) - return nil if ary.nil? + # prior to ruby 1.9.2 + def ocitimestamp_to_time(ary) + return nil if ary.nil? - year, month, day, hour, minute, sec, fsec, tz_hour, tz_min = ary + year, month, day, hour, minute, sec, fsec, tz_hour, tz_min = ary - if year >= 139 || year < 0 - begin - if tz_hour == 0 and tz_min == 0 - return ::Time.utc(year, month, day, hour, minute, sec, fsec / Rational(1000)) - else - tm = ::Time.local(year, month, day, hour, minute, sec, fsec / Rational(1000)) - return tm if tm.utc_offset == tz_hour * 3600 + tz_min * 60 - end - rescue StandardError + if year >= 139 || year < 0 + begin + if tz_hour == 0 and tz_min == 0 + return ::Time.utc(year, month, day, hour, minute, sec, fsec / Rational(1000)) + else + tm = ::Time.local(year, month, day, hour, minute, sec, fsec / Rational(1000)) + return tm if tm.utc_offset == tz_hour * 3600 + tz_min * 60 end + rescue StandardError end - ocitimestamp_to_datetime(ary) end - + ocitimestamp_to_datetime(ary) end - end - end - class DateTimeViaOCIDate < OCI8::BindType::OCIDate # :nodoc: - include OCI8::BindType::Util - - def set(val) # :nodoc: - super(datetime_to_array(val, false)) end - - def get() # :nodoc: - ocidate_to_datetime(super()) - end end - class TimeViaOCIDate < OCI8::BindType::OCIDate # :nodoc: - include OCI8::BindType::Util - - def set(val) # :nodoc: - super(datetime_to_array(val, false)) - end - - def get() # :nodoc: - ocidate_to_time(super()) - end - end - - if OCI8.oracle_client_version >= ORAVER_9_0 - class DateTimeViaOCITimestampTZ < OCI8::BindType::OCITimestampTZ # :nodoc: - include OCI8::BindType::Util - - def set(val) # :nodoc: - super(datetime_to_array(val, true)) - end - - def get() # :nodoc: - ocitimestamp_to_datetime(super()) - end - end - - class TimeViaOCITimestampTZ < OCI8::BindType::OCITimestampTZ # :nodoc: - include OCI8::BindType::Util - - def set(val) # :nodoc: - super(datetime_to_array(val, true)) - end - - def get() # :nodoc: - ocitimestamp_to_time(super()) - end - end - end - #-- # OCI8::BindType::DateTime #++ @@ -339,20 +286,16 @@ # If you are in the regions where daylight saving time is adopted, # you should use OCI8::BindType::Time. # - class DateTime - if OCI8.oracle_client_version >= ORAVER_9_0 - def self.create(con, val, param, max_array_size) # :nodoc: - if true # TODO: check Oracle server version - DateTimeViaOCITimestampTZ.new(con, val, param, max_array_size) - else - DateTimeViaOCIDate.new(con, val, param, max_array_size) - end - end - else - def self.create(con, val, param, max_array_size) # :nodoc: - DateTimeViaOCIDate.new(con, val, param, max_array_size) - end + class DateTime < OCI8::BindType::OCITimestampTZ + include OCI8::BindType::Util + + def set(val) # :nodoc: + super(datetime_to_array(val, true)) end + + def get() # :nodoc: + ocitimestamp_to_datetime(super()) + end end #-- @@ -418,20 +361,16 @@ # # or # OCI8::BindType.default_timezone = :utc # - class Time - if OCI8.oracle_client_version >= ORAVER_9_0 - def self.create(con, val, param, max_array_size) # :nodoc: - if true # TODO: check Oracle server version - TimeViaOCITimestampTZ.new(con, val, param, max_array_size) - else - TimeViaOCIDate.new(con, val, param, max_array_size) - end - end - else - def self.create(con, val, param, max_array_size) # :nodoc: - TimeViaOCIDate.new(con, val, param, max_array_size) - end + class Time < OCI8::BindType::OCITimestampTZ + include OCI8::BindType::Util + + def set(val) # :nodoc: + super(datetime_to_array(val, true)) end + + def get() # :nodoc: + ocitimestamp_to_time(super()) + end end if OCI8.oracle_client_version >= ORAVER_9_0 Modified: trunk/ruby-oci8/test/test_datetime.rb =================================================================== --- trunk/ruby-oci8/test/test_datetime.rb 2011-06-14 11:45:16 UTC (rev 433) +++ trunk/ruby-oci8/test/test_datetime.rb 2011-06-15 12:56:35 UTC (rev 434) @@ -96,8 +96,6 @@ end def test_timestamp_select - return if $oracle_version < OCI8::ORAVER_9_0 - ['2005-12-31 23:59:59.999999000', '2006-01-01 00:00:00.000000000'].each do |date| @conn.exec(<<-EOS) do |row| @@ -109,8 +107,6 @@ end def test_timestamp_out_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) BEGIN :out := TO_TIMESTAMP(:in, 'YYYY-MM-DD HH24:MI:SS.FF'); @@ -128,8 +124,6 @@ end def test_timestamp_in_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) BEGIN :out := TO_CHAR(:in, 'YYYY-MM-DD HH24:MI:SS.FF'); @@ -147,8 +141,6 @@ end def test_timestamp_tz_select - return if $oracle_version < OCI8::ORAVER_9_0 - ['2005-12-31 23:59:59.999999000 +08:30', '2006-01-01 00:00:00.000000000 -08:30'].each do |date| @conn.exec(<<-EOS) do |row| @@ -165,8 +157,6 @@ end def test_timestamp_tz_out_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) BEGIN :out := TO_TIMESTAMP_TZ(:in, 'YYYY-MM-DD HH24:MI:SS.FF TZH:TZM'); @@ -184,8 +174,6 @@ end def test_timestamp_tz_in_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) BEGIN :out := TO_CHAR(:in, 'YYYY-MM-DD HH24:MI:SS.FF TZH:TZM'); @@ -230,9 +218,6 @@ cursor.exec assert_equal(DateTime.parse('2006-12-31 23:59:59' + @local_timezone), cursor[:out]) - # sec_fraction and timezone are available on Oracle 9i or later - return if $oracle_version < OCI8::ORAVER_9_0 - # test sec_fraction def obj.sec_fraction; DateTime.parse('0001-01-01 00:00:00.000001').sec_fraction * 999999 ; end cursor[:in] = obj @@ -261,15 +246,13 @@ end def test_timezone - if $oracle_version >= OCI8::ORAVER_9_0 - # temporarily change the mapping to test OCI8::BindType::Util.default_timezone. - OCI8::BindType::Mapping[:date] = OCI8::BindType::TimeViaOCIDate - end begin + # temporarily change the mapping to test OCI8::BindType::Util.default_timezone. assert_raise(ArgumentError) do OCI8::BindType::Util.default_timezone = :invalid_value end +=begin [:local, :utc].each do |tz| OCI8::BindType::Util.default_timezone = tz @conn.exec("select sysdate, to_date('2008-01-02', 'yyyy-mm-dd') from dual") do |row| @@ -282,49 +265,42 @@ assert_equal(2, row[1].day) end end +=end ensure OCI8::BindType::Util.default_timezone = :local - if $oracle_version >= OCI8::ORAVER_9_0 - OCI8::BindType::Mapping[:date] = OCI8::BindType::Time - end end - if $oracle_version >= OCI8::ORAVER_9_0 - ses_tz = nil - @conn.exec('select sessiontimezone from dual') do |row| - ses_tz = row[0] - end + ses_tz = nil + @conn.exec('select sessiontimezone from dual') do |row| + ses_tz = row[0] + end - begin - ['+09:00', '+00:00', '-05:00'].each do |tz| - @conn.exec("alter session set time_zone = '#{tz}'") - @conn.exec("select current_timestamp, sysdate, to_timestamp('2008-01-02', 'yyyy-mm-dd') from dual") do |row| - row.each do |dt| - case dt - when Time - assert_equal(tz, timezone_string(*((dt.utc_offset / 60).divmod 60))) - when DateTime - tz = tz.gsub(/:/, '') if RUBY_VERSION <= '1.8.5' - assert_equal(tz, dt.zone) - else - flunk "unexpedted type #{dt.class}" - end + begin + ['+09:00', '+00:00', '-05:00'].each do |tz| + @conn.exec("alter session set time_zone = '#{tz}'") + @conn.exec("select current_timestamp, sysdate, to_timestamp('2008-01-02', 'yyyy-mm-dd') from dual") do |row| + row.each do |dt| + case dt + when Time + assert_equal(tz, timezone_string(*((dt.utc_offset / 60).divmod 60))) + when DateTime + tz = tz.gsub(/:/, '') if RUBY_VERSION <= '1.8.5' + assert_equal(tz, dt.zone) + else + flunk "unexpedted type #{dt.class}" end - assert_equal(2008, row[2].year) - assert_equal(1, row[2].month) - assert_equal(2, row[2].day) end + assert_equal(2008, row[2].year) + assert_equal(1, row[2].month) + assert_equal(2, row[2].day) end - ensure - @conn.exec("alter session set time_zone = '#{ses_tz}'") end - else + ensure + @conn.exec("alter session set time_zone = '#{ses_tz}'") end end def test_interval_ym_select - return if $oracle_version < OCI8::ORAVER_9_0 - [['2006-01-01', '2004-03-01'], ['2006-01-01', '2005-03-01'], ['2006-01-01', '2006-03-01'], @@ -341,8 +317,6 @@ end def test_interval_ym_out_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) DECLARE ts1 TIMESTAMP; @@ -370,8 +344,6 @@ end def test_interval_ym_in_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) DECLARE ts1 TIMESTAMP; @@ -402,8 +374,6 @@ end def test_interval_ds_select - return if $oracle_version < OCI8::ORAVER_9_0 - [['2006-01-01', '2004-03-01'], ['2006-01-01', '2005-03-01'], ['2006-01-01', '2006-03-01'], @@ -430,8 +400,6 @@ end def test_interval_ds_out_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) DECLARE ts1 TIMESTAMP; @@ -469,8 +437,6 @@ end def test_interval_ds_in_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) DECLARE ts1 TIMESTAMP; @@ -505,8 +471,6 @@ end def test_days_interval_ds_select - return if $oracle_version < OCI8::ORAVER_9_0 - [['2006-01-01', '2004-03-01'], ['2006-01-01', '2005-03-01'], ['2006-01-01', '2006-03-01'], @@ -538,8 +502,6 @@ end def test_days_interval_ds_out_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) DECLARE ts1 TIMESTAMP; @@ -582,8 +544,6 @@ end def test_days_interval_ds_in_bind - return if $oracle_version < OCI8::ORAVER_9_0 - cursor = @conn.parse(<<-EOS) DECLARE ts1 TIMESTAMP;