From nobody at rubyforge.org Thu Jan 3 01:39:00 2013 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 3 Jan 2013 01:39:00 +0000 (UTC) Subject: [ruby-oci8-commit] [548] trunk/ruby-oci8: delete an internal method OCI8.nls_ratio= when the ruby is 1.9 or greater. Message-ID: <20130103013900.745B02E083@rubyforge.org> Revision: 548 Author: kubo Date: 2013-01-03 01:38:58 +0000 (Thu, 03 Jan 2013) Log Message: ----------- delete an internal method OCI8.nls_ratio= when the ruby is 1.9 or greater. nls_ratio is set by OCI8.encoding=. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/encoding.c trunk/ruby-oci8/lib/oci8/encoding-init.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2012-12-23 11:47:16 UTC (rev 547) +++ trunk/ruby-oci8/ChangeLog 2013-01-03 01:38:58 UTC (rev 548) @@ -1,3 +1,8 @@ +2013-01-03 KUBO Takehiro + * ext/oci8/encoding.c, lib/oci8/encoding-init.rb: delete an internal method + OCI8.nls_ratio= when the ruby is 1.9 or greater. nls_ratio is set by + OCI8.encoding=. + 2012-12-23 KUBO Takehiro * ext/oci8/lob.c, ext/oci8/oci8.h, ext/oci8/oci8lib.c, test/test_clob.rb: fix SEGV when a temporary LOB is freed when OCILobRead returns OCI_NEED_DATA. Modified: trunk/ruby-oci8/ext/oci8/encoding.c =================================================================== --- trunk/ruby-oci8/ext/oci8/encoding.c 2012-12-23 11:47:16 UTC (rev 547) +++ trunk/ruby-oci8/ext/oci8/encoding.c 2013-01-03 01:38:58 UTC (rev 548) @@ -185,12 +185,14 @@ * * @return [Fixnum] NLS ratio * @since 2.1.0 + * @private */ static VALUE oci8_get_nls_ratio(VALUE klass) { return INT2NUM(oci8_nls_ratio); } +#ifndef HAVE_TYPE_RB_ENCODING /* * call-seq: * OCI8.nls_ratio = integer @@ -201,6 +203,8 @@ * * @param [Fixnum] integer NLS ratio * @since 2.1.0 + * @private + * @note ruby 1.8 only */ static VALUE oci8_set_nls_ratio(VALUE klass, VALUE val) { @@ -211,6 +215,7 @@ oci8_nls_ratio = v; return val; } +#endif #ifdef HAVE_TYPE_RB_ENCODING @@ -243,6 +248,7 @@ * * @return [Encoding] * @since 2.0.0 and ruby 1.9 + * @private */ static VALUE oci8_get_encoding(VALUE klass) { @@ -259,13 +265,16 @@ * * @param [Encoding] enc * @since 2.0.0 and ruby 1.9 + * @private */ static VALUE oci8_set_encoding(VALUE klass, VALUE encoding) { if (NIL_P(encoding)) { oci8_encoding = NULL; + oci8_nls_ratio = 1; } else { oci8_encoding = rb_to_encoding(encoding); + oci8_nls_ratio = rb_enc_mbmaxlen(oci8_encoding); } return encoding; } @@ -287,7 +296,9 @@ rb_define_method(cOCI8, "charset_name2id", oci8_charset_name2id, 1); rb_define_method(cOCI8, "charset_id2name", oci8_charset_id2name, 1); rb_define_singleton_method(cOCI8, "nls_ratio", oci8_get_nls_ratio, 0); +#ifndef HAVE_TYPE_RB_ENCODING rb_define_singleton_method(cOCI8, "nls_ratio=", oci8_set_nls_ratio, 1); +#endif #ifdef HAVE_TYPE_RB_ENCODING rb_define_singleton_method(cOCI8, "encoding", oci8_get_encoding, 0); rb_define_singleton_method(cOCI8, "encoding=", oci8_set_encoding, 1); Modified: trunk/ruby-oci8/lib/oci8/encoding-init.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/encoding-init.rb 2012-12-23 11:47:16 UTC (rev 547) +++ trunk/ruby-oci8/lib/oci8/encoding-init.rb 2013-01-03 01:38:58 UTC (rev 548) @@ -39,26 +39,6 @@ @@client_charset_name = 'US7ASCII' end - # NLS ratio, maximum number of bytes per one chracter - case @@client_charset_name - when 'UTF8' - OCI8.nls_ratio = 3 - when 'AL16UTF16' - OCI8.nls_ratio = 4 - when /^[[:alpha:]]+(\d+)/ - # convert maximum number of bits per one chracter to NLS ratio. - # charset name max bits max bytes - # ------------ -------- --------- - # US7ASCII 7 1 - # WE8ISO8859P1 8 1 - # JA16SJIS 16 2 - # AL32UTF8 32 4 - # ... - OCI8.nls_ratio = (($1.to_i + 7) >> 3) - else - raise "Unknown NLS character set name format: #{@@client_charset_name}" - end - # Ruby encoding name for ruby 1.9. if OCI8.respond_to? :encoding if defined? DEFAULT_OCI8_ENCODING @@ -75,5 +55,25 @@ end end OCI8.encoding = enc + else + # NLS ratio, maximum number of bytes per one chracter + case @@client_charset_name + when 'UTF8' + OCI8.nls_ratio = 3 + when 'AL16UTF16' + OCI8.nls_ratio = 4 + when /^[[:alpha:]]+(\d+)/ + # convert maximum number of bits per one chracter to NLS ratio. + # charset name max bits max bytes + # ------------ -------- --------- + # US7ASCII 7 1 + # WE8ISO8859P1 8 1 + # JA16SJIS 16 2 + # AL32UTF8 32 4 + # ... + OCI8.nls_ratio = (($1.to_i + 7) >> 3) + else + raise "Unknown NLS character set name format: #{@@client_charset_name}" + end end end From nobody at rubyforge.org Thu Jan 3 02:13:26 2013 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 3 Jan 2013 02:13:26 +0000 (UTC) Subject: [ruby-oci8-commit] [549] trunk/ruby-oci8: add languange mode to the extension library name when ths ruby engine is rubinius Message-ID: <20130103021326.539932E083@rubyforge.org> Revision: 549 Author: kubo Date: 2013-01-03 02:13:25 +0000 (Thu, 03 Jan 2013) Log Message: ----------- add languange mode to the extension library name when ths ruby engine is rubinius and explicitly claim that jruby is not supported when it is jruby. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/extconf.rb trunk/ruby-oci8/lib/oci8.rb.in Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2013-01-03 01:38:58 UTC (rev 548) +++ trunk/ruby-oci8/ChangeLog 2013-01-03 02:13:25 UTC (rev 549) @@ -1,4 +1,9 @@ 2013-01-03 KUBO Takehiro + * ext/oci8/extconf.rb, lib/oci8.rb.in: add languange mode to the extension + library name when ths ruby engine is rubinius and explicitly claim that + jruby is not supported when it is jruby. + +2013-01-03 KUBO Takehiro * ext/oci8/encoding.c, lib/oci8/encoding-init.rb: delete an internal method OCI8.nls_ratio= when the ruby is 1.9 or greater. nls_ratio is set by OCI8.encoding=. Modified: trunk/ruby-oci8/ext/oci8/extconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/extconf.rb 2013-01-03 01:38:58 UTC (rev 548) +++ trunk/ruby-oci8/ext/oci8/extconf.rb 2013-01-03 02:13:25 UTC (rev 549) @@ -134,7 +134,8 @@ ruby_engine = (defined? RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' so_basename = 'oci8lib_' -if ruby_engine == 'ruby' +case ruby_engine +when 'ruby' # The extension library name includes the ruby ABI (application binary interface) # version. It is for binary gems which contain more than one extension library # and use correct one depending on the ABI version. @@ -168,8 +169,22 @@ else raise 'unsupported ruby version: ' + RUBY_VERSION end +when 'rbx' + # "rbx -X18" and "rbx -X19" use different C header files. + case RUBY_VERSION + when /^2\.0/ + so_basename += 'rbx20' + when /^1\.9/ + so_basename += 'rbx19' + when /^1\.8/ + so_basename += 'rbx18' + else + raise 'unsupported language mode: ' + RUBY_VERSION + end +when 'jruby' + raise "Ruby-oci8 doesn't support jruby because its C extension support is in development in jruby 1.6 and deprecated in jruby 1.7." else - so_basename += ruby_engine + raise 'unsupported ruby engine: ' + RUBY_ENGINE end $defs << "-DInit_oci8lib=Init_#{so_basename}" Modified: trunk/ruby-oci8/lib/oci8.rb.in =================================================================== --- trunk/ruby-oci8/lib/oci8.rb.in 2013-01-03 01:38:58 UTC (rev 548) +++ trunk/ruby-oci8/lib/oci8.rb.in 2013-01-03 02:13:25 UTC (rev 549) @@ -26,7 +26,8 @@ ruby_engine = (defined? RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' so_basename = 'oci8lib_' -if ruby_engine == 'ruby' +case ruby_engine +when 'ruby' # The extension library name includes the ruby ABI (application binary interface) # version. It is for binary gems which contain more than one extension library # and use correct one depending on the ABI version. @@ -60,8 +61,22 @@ else raise 'unsupported ruby version: ' + RUBY_VERSION end +when 'rbx' + # "rbx -X18" and "rbx -X19" use different C header files. + case RUBY_VERSION + when /^2\.0/ + so_basename += 'rbx20' + when /^1\.9/ + so_basename += 'rbx19' + when /^1\.8/ + so_basename += 'rbx18' + else + raise 'unsupported language mode: ' + RUBY_VERSION + end +when 'jruby' + raise "Ruby-oci8 doesn't support jruby because its C extension support is in development in jruby 1.6 and deprecated in jruby 1.7." else - so_basename += ruby_engine + raise 'unsupported ruby engine: ' + RUBY_ENGINE end require so_basename From nobody at rubyforge.org Thu Jan 3 08:08:23 2013 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 3 Jan 2013 08:08:23 +0000 (UTC) Subject: [ruby-oci8-commit] [550] trunk/ruby-oci8: Add OCI8.properties[:events_mode] to support Fast Application Notification (FAN). Message-ID: <20130103080823.6AEFE2E083@rubyforge.org> Revision: 550 Author: kubo Date: 2013-01-03 08:08:21 +0000 (Thu, 03 Jan 2013) Log Message: ----------- Add OCI8.properties[:events_mode] to support Fast Application Notification (FAN). Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/oci8.c trunk/ruby-oci8/lib/oci8/properties.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2013-01-03 02:13:25 UTC (rev 549) +++ trunk/ruby-oci8/ChangeLog 2013-01-03 08:08:21 UTC (rev 550) @@ -1,4 +1,8 @@ 2013-01-03 KUBO Takehiro + * ext/oci8/oci8.c, lib/oci8/properties.rb: add OCI8.properties[:events_mode] + to support Fast Application Notification (FAN). + +2013-01-03 KUBO Takehiro * ext/oci8/extconf.rb, lib/oci8.rb.in: add languange mode to the extension library name when ths ruby engine is rubinius and explicitly claim that jruby is not supported when it is jruby. Modified: trunk/ruby-oci8/ext/oci8/oci8.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.c 2013-01-03 02:13:25 UTC (rev 549) +++ trunk/ruby-oci8/ext/oci8/oci8.c 2013-01-03 08:08:21 UTC (rev 550) @@ -2,7 +2,7 @@ /* * oci8.c - part of ruby-oci8 * - * Copyright (C) 2002-2011 KUBO Takehiro + * Copyright (C) 2002-2013 KUBO Takehiro * */ #include "oci8.h" @@ -171,25 +171,56 @@ return oracle_client_vernum; } -static VALUE oci8_s_set_property(VALUE klass, VALUE name, VALUE val) +/* + * call-seq: + * OCI8.__get_prop(key) + * + * @param [Fixnum] key 1 or 2 + * + * @private + */ +static VALUE oci8_s_get_prop(VALUE klass, VALUE key) { - const char *name_str; + switch (NUM2INT(key)) { + case 1: + return oci8_float_conversion_type_is_ruby ? Qtrue : Qfalse; + case 2: + return UINT2NUM(oci8_env_mode); + default: + rb_raise(rb_eArgError, "Unknown prop %d", NUM2INT(key)); + } +} - Check_Type(name, T_SYMBOL); - name_str = rb_id2name(SYM2ID(name)); - if (strcmp(name_str, "float_conversion_type") == 0) { - const char *val_str; - Check_Type(val, T_SYMBOL); - val_str = rb_id2name(SYM2ID(val)); - if (strcmp(val_str, "ruby") == 0) { - oci8_float_conversion_type_is_ruby = 1; - } else if (strcmp(val_str, "oracle") == 0) { - oci8_float_conversion_type_is_ruby = 0; - } else { - rb_raise(rb_eArgError, "float_conversion_type's value should be either :ruby or :oracle."); + +/* + * call-seq: + * OCI8.__set_prop(key, value) + * + * @param [Fixnum] key 1 or 2 + * @param [Object] value depends on +key+. + * + * @private + */ +static VALUE oci8_s_set_prop(VALUE klass, VALUE key, VALUE val) +{ + switch (NUM2INT(key)) { + case 1: + oci8_float_conversion_type_is_ruby = RTEST(val) ? 1 : 0; + break; + case 2: + /* + * Changes the OCI environment mode which will be passed to the second + * argument of the OCI function OCIEnvCreate. + */ + if (oci8_global_envhp != NULL) { + rb_raise(rb_eRuntimeError, "The OCI Environment has been alreadly initialized. It cannot be changed after even one OCI function is called."); } + oci8_env_mode = NUM2UINT(val); + break; + default: + rb_raise(rb_eArgError, "Unknown prop %d", NUM2INT(key)); } - return Qnil; + return klass; } /* @@ -1121,7 +1152,8 @@ rb_define_const(cOCI8, "VERSION", rb_obj_freeze(rb_usascii_str_new_cstr(OCI8LIB_VERSION))); rb_define_singleton_method_nodoc(cOCI8, "oracle_client_vernum", oci8_s_oracle_client_vernum, 0); - rb_define_singleton_method_nodoc(cOCI8, "__set_property", oci8_s_set_property, 2); + rb_define_singleton_method(cOCI8, "__get_prop", oci8_s_get_prop, 1); + rb_define_singleton_method(cOCI8, "__set_prop", oci8_s_set_prop, 2); rb_define_singleton_method(cOCI8, "error_message", oci8_s_error_message, 1); rb_define_private_method(cOCI8, "parse_connect_string", oci8_parse_connect_string, 1); rb_define_private_method(cOCI8, "logon2", oci8_logon2, 4); Modified: trunk/ruby-oci8/lib/oci8/properties.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/properties.rb 2013-01-03 02:13:25 UTC (rev 549) +++ trunk/ruby-oci8/lib/oci8/properties.rb 2013-01-03 08:08:21 UTC (rev 550) @@ -1,6 +1,6 @@ # properties.rb -- implements OCI8.properties # -# Copyright (C) 2010-2012 KUBO Takehiro +# Copyright (C) 2010-2013 KUBO Takehiro # class OCI8 @@ -8,8 +8,9 @@ @@properties = { :length_semantics => :byte, :bind_string_as_nchar => false, - :float_conversion_type => :ruby, + :float_conversion_type => OCI8.__get_prop(1) ? :ruby : :oracle, :statement_cache_size => 0, + :events_mode => ((OCI8.__get_prop(2) & 4) != 0) # 4 <- OCI_EVENTS in oci.h } if OCI8.oracle_client_version < OCI8::ORAVER_9_2 @@ -31,23 +32,31 @@ when :bind_string_as_nchar val = val ? true : false when :float_conversion_type - # handled by native code in oci8lib_xx.so. - OCI8.__set_property(name, val) + case val + when :ruby + OCI8.__set_prop(1, true) + when :oracle + OCI8.__set_prop(1, false) + else + raise ArgumentError, "float_conversion_type's value should be either :ruby or :oracle." + end when :statement_cache_size if OCI8.oracle_client_version < OCI8::ORAVER_9_2 raise RuntimeError, ":statement_cache_size is disabled on Oracle 9iR1 client." end val = val.to_i raise ArgumentError, "The property value for :statement_cache_size must not be negative." if val < 0 + when :events_mode + val = val ? true : false + if val + OCI8.__set_prop(2, OCI8.__get_prop(2) | 4) # set OCI_EVENTS + else + OCI8.__set_prop(2, OCI8.__get_prop(2) & ~4) # unset OCI_EVENTS + end end super(name, val) end - # call-seq: - # OCI8.properties -> a customized Hash - # - # (new in 2.0.5) - # # Returns a Hash which ruby-oci8 global settings. # The hash's setter and getter methods are customized to check # property names and values. @@ -63,19 +72,20 @@ # Supported properties are listed below: # # [:length_semantics] - # (new in 2.1.0) # # +:char+ when Oracle character length is counted by the number of characters. # +:byte+ when it is counted by the number of bytes. # The default setting is +:byte+ because +:char+ causes unexpected behaviour on # Oracle 9i. + # + # *Since:* 2.1.0 # # [:bind_string_as_nchar] + # # +true+ when string bind variables are bound as NCHAR, # otherwise +false+. The default value is +false+. # # [:float_conversion_type] - # (new in 2.1.0) # # +:ruby+ when Oracle decimal numbers are converted to ruby Float values # same as Float#to_s does. (default) @@ -85,15 +95,36 @@ # the Oracle function OCINumberToReal() makes a string representation # 15.700000000000001 by Float#to_s. # See: http://rubyforge.org/forum/forum.php?thread_id=50030&forum_id=1078 + # + # *Since:* 2.1.0 # # [:statement_cache_size] - # (new in 2.1.1) # # The statement cache size per each session. The default size is 0, which # means no statement cache, since 2.1.2. It was 20 in 2.1.1. # This feature is available on Oracle 9iR2 or later. # See: http://docs.oracle.com/cd/E11882_01/appdev.112/e10646/oci09adv.htm#i471377 + # + # *Since:* 2.1.1 # + # [:events_mode] + # + # +true+ when Fast Application Notification (FAN) Support is enabled. + # +false+ when it is disabled. The default value is +false+. + # This corresponds to {http://php.net/manual/en/oci8.configuration.php#ini.oci8.events +oci8.events+ in PHP}. + # + # This parameter can be changed only when no OCI methods are called. + # + # require 'oci8' + # OCI8.properties[:events_mode] = true # works fine. + # ... call some OCI methods ... + # OCI8.properties[:events_mode] = true # raises a runtime error. + # + # *Since:* 2.1.4 + # + # @return [a customized Hash] + # @since 2.0.5 + # def self.properties @@properties end From nobody at rubyforge.org Sun Jan 6 12:39:47 2013 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 6 Jan 2013 12:39:47 +0000 (UTC) Subject: [ruby-oci8-commit] [551] trunk/ruby-oci8: Fix comments for yard and update the version to 2.1. 4. Message-ID: <20130106123947.C6AF22E076@rubyforge.org> Revision: 551 Author: kubo Date: 2013-01-06 12:39:46 +0000 (Sun, 06 Jan 2013) Log Message: ----------- Fix comments for yard and update the version to 2.1.4. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/NEWS trunk/ruby-oci8/VERSION trunk/ruby-oci8/docs/platform-specific-issues.md trunk/ruby-oci8/ext/oci8/connection_pool.c trunk/ruby-oci8/ext/oci8/encoding.c trunk/ruby-oci8/ext/oci8/metadata.c trunk/ruby-oci8/ext/oci8/oci8.c trunk/ruby-oci8/lib/oci8/metadata.rb trunk/ruby-oci8/lib/oci8/oci8.rb trunk/ruby-oci8/lib/oci8/oracle_version.rb trunk/ruby-oci8/lib/oci8/properties.rb trunk/ruby-oci8/lib/oci8.rb.in trunk/ruby-oci8/test/test_clob.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/ChangeLog 2013-01-06 12:39:46 UTC (rev 551) @@ -1,3 +1,13 @@ +2013-01-06 KUBO Takehiro + * NEWS: add changes between 2.1.4 and 2.1.3 + * VERSION: change the version to 2.1.4. + * docs/platform-specific-issues.md: update solaris-specific document. + * ext/oci8/connection_pool.c, ext/oci8/encoding.c, ext/oci8/metadata.c, + ext/oci8/oci8.c,lib/oci8.rb.in, lib/oci8/metadata.rb, lib/oci8/oci8.rb, + lib/oci8/oracle_version.rb, lib/oci8/properties.rb: update comments for yard. + * test/test_clob.rb: change a lob size when ORA-24817 is raised to + pass tests on Windows. + 2013-01-03 KUBO Takehiro * ext/oci8/oci8.c, lib/oci8/properties.rb: add OCI8.properties[:events_mode] to support Fast Application Notification (FAN). Modified: trunk/ruby-oci8/NEWS =================================================================== --- trunk/ruby-oci8/NEWS 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/NEWS 2013-01-06 12:39:46 UTC (rev 551) @@ -1,5 +1,46 @@ # @markup markdown +2.1.4 +===== + +New Features +------------ + +### Fast Application Notification (FAN) support + +Look at {http://php.net/manual/en/oci8.connection.php} to know what is FAN. +[oci8.events](http://php.net/manual/en/oci8.configuration.php#ini.oci8.events) in PHP +corresponds to {OCI8.properties OCI8.properties[:events_mode]} in ruby-oci8. + +Note: You need to set `OCI8.properties[:events_mode]` after `"require 'oci8'"` and before +any methods which call Oracle OCI functions. + +Fixed Issues +------------ + +- fix SEGV when a temporary LOB is freed when `OCILobRead` returns `OCI_NEED_DATA`. + See: [github issue #20](https://github.com/kubo/ruby-oci8/issues/20) + + (reported by Edgars Beigarts) + +- use `RUBY_VERSION` instead of `RbConfig::CONFIG['ruby_version']` to know the + ruby ABI version. The latter may be changed by the configure option + --with-ruby-version. + See: [github issue #24](https://github.com/kubo/ruby-oci8/issues/24) + + (reported by suhrawardi) + +- add a script encoding magic comment for ruby 2.0.0 preview2. + See: [github issue #25](https://github.com/kubo/ruby-oci8/issues/25) + + (reported by aboltart) + +- fix {OCI8#describe_table} not to follow synonyms until stack overflow. + Now the recursive level is limited to 20. + See: [github issue #26](https://github.com/kubo/ruby-oci8/issues/26) + + (reported by Brian Henderson) + 2.1.3 ===== Modified: trunk/ruby-oci8/VERSION =================================================================== --- trunk/ruby-oci8/VERSION 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/VERSION 2013-01-06 12:39:46 UTC (rev 551) @@ -1 +1 @@ -2.1.3 +2.1.4 Modified: trunk/ruby-oci8/docs/platform-specific-issues.md =================================================================== --- trunk/ruby-oci8/docs/platform-specific-issues.md 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/docs/platform-specific-issues.md 2013-01-06 12:39:46 UTC (rev 551) @@ -71,16 +71,24 @@ ======= You need a same compiler which is used to make ruby itself. +For example, if the ruby is compiled by gcc, you need gcc. If it is compiled by Oracle Solaris Studio +(formerly called as Sun Studio), you need Oracle Solaris Studio. -There are two ruby packages. +If ruby is compiled by gcc and "require 'oci8'" raises "OCI Library Initialization Error", +you may need to recompile ruby as follows: -* [Sunfreeware.com](http://www.sunfreeware.com/) -* [Blastwave.org](http://www.blastwave.org/) + $ bzip2 -dc ruby-1.9.3-pxxx.tar.bz2 | tar xvf - + $ cd ruby-1.9.3-pxxx + $ vi main.c # <- Add RUBY_FUNC_EXPORTED just before "int main(..)" as follows: + ------------- + RUBY_FUNC_EXPORTED /* Add this line */ + int + main(int argc, char **argv) + ------------- + $ ./configure + $ make + $ make install -The former is compiled by gcc. The latter is compiled by -[Sun Studio](http://developers.sun.com/sunstudio/). -The both compilers are freely available. - If you use Blastwave.org's ruby and want not to install Sun Studio, you can edit rbconfig.rb by your self. [(look at here)](http://forum.textdrive.com/viewtopic.php?id=12630) @@ -91,8 +99,8 @@ prints "yes", you may need to edit rbconfig.rb distributed with the ruby as follows: - from: CONFIG["LDFLAGS"] = "-L. -Wl,-E" - to: CONFIG["LDFLAGS"] = "-L. " + from: CONFIG["LDFLAGS"] = "-L. -Wl,-E" + to: CONFIG["LDFLAGS"] = "-L. " FreeBSD ======= Modified: trunk/ruby-oci8/ext/oci8/connection_pool.c =================================================================== --- trunk/ruby-oci8/ext/oci8/connection_pool.c 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/ext/oci8/connection_pool.c 2013-01-06 12:39:46 UTC (rev 551) @@ -174,9 +174,9 @@ * call-seq: * pool_name -> string * - * internal use only + * Retruns the pool name. * - * Retruns the pool name. + * @private */ static VALUE oci8_cpool_pool_name(VALUE self) { Modified: trunk/ruby-oci8/ext/oci8/encoding.c =================================================================== --- trunk/ruby-oci8/ext/oci8/encoding.c 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/ext/oci8/encoding.c 2013-01-06 12:39:46 UTC (rev 551) @@ -229,6 +229,7 @@ * are passed to Oracle, they are converted to +OCI8.encoding+ * in advance. * + * @example * # When OCI8.encoding is ISO-8859-1, * conn.exec('insert into country_code values(:1, :2, :3)', * 'AT', 'Austria', "\u00d6sterreichs") @@ -249,6 +250,7 @@ * @return [Encoding] * @since 2.0.0 and ruby 1.9 * @private + * @see OCI8.client_charset_name */ static VALUE oci8_get_encoding(VALUE klass) { Modified: trunk/ruby-oci8/ext/oci8/metadata.c =================================================================== --- trunk/ruby-oci8/ext/oci8/metadata.c 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/ext/oci8/metadata.c 2013-01-06 12:39:46 UTC (rev 551) @@ -159,6 +159,19 @@ return oci8_metadata_create(parmhp, self, obj); } +/* + * call-seq: + * __describe(name, klass, check_public) + * + * @param [String] name object name + * @param [subclass of OCI8::Metadata::Base] klass + * @param [Boolean] check_public +true+ to look up the object as a public synonym when + * the object does not exist in the current schema and + * the name includes no dots. + * @return [subclass of OCI8::Metadata::Base] + * + * @private + */ static VALUE oci8_describe(VALUE self, VALUE name, VALUE klass, VALUE check_public) { OCI8SafeStringValue(name); Modified: trunk/ruby-oci8/ext/oci8/oci8.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.c 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/ext/oci8/oci8.c 2013-01-06 12:39:46 UTC (rev 551) @@ -285,6 +285,7 @@ * "scott/tiger at oradb.example.com" -> ["scott", "tiger", "oradb.example.com", nil] * "sys/change_on_install as sysdba" -> ["sys", "change_on_install", nil, :SYSDBA] * + * @private */ static VALUE oci8_parse_connect_string(VALUE self, VALUE conn_str) { @@ -396,9 +397,9 @@ * call-seq: * logon2(username, password, dbname, mode) -> connection * - * internal use only + * Creates a simple logon session by the OCI function OCILogon2(). * - * Creates a simple logon session by the OCI function OCILogon2(). + * @private */ static VALUE oci8_logon2(VALUE self, VALUE username, VALUE password, VALUE dbname, VALUE mode) { @@ -448,10 +449,10 @@ * call-seq: * allocate_handles() * - * internal use only - * * Allocates a service context handle, a session handle and a * server handle to use explicit attach and begin-session calls. + * + * @private */ static VALUE oci8_allocate_handles(VALUE self) { @@ -488,9 +489,9 @@ * call-seq: * server_attach(dbname, mode) * - * internal use only + * Attachs to the server by the OCI function OCIServerAttach(). * - * Attachs to the server by the OCI function OCIServerAttach(). + * @private */ static VALUE oci8_server_attach(VALUE self, VALUE dbname, VALUE attach_mode) { @@ -530,9 +531,9 @@ * call-seq: * session_begin(cred, mode) * - * internal use only + * Begins the session by the OCI function OCISessionBegin(). * - * Begins the session by the OCI function OCISessionBegin(). + * @private */ static VALUE oci8_session_begin(VALUE self, VALUE cred, VALUE mode) { @@ -798,9 +799,9 @@ * * Returns a numerical format of the Oracle server version. * - * See also: #oracle_server_version - * + * @see OCI8#oracle_server_version * @since 2.0.1 + * @private */ static VALUE oci8_oracle_server_vernum(VALUE self) { @@ -1177,7 +1178,6 @@ rb_define_method(cOCI8, "module=", oci8_set_module, 1); rb_define_method(cOCI8, "action=", oci8_set_action, 1); rb_define_method(cOCI8, "client_info=", oci8_set_client_info, 1); - rb_define_attr(cOCI8, "last_error", 1, 1); *out = cOCI8; } Modified: trunk/ruby-oci8/lib/oci8/metadata.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/metadata.rb 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/lib/oci8/metadata.rb 2013-01-06 12:39:46 UTC (rev 551) @@ -1985,22 +1985,34 @@ =end end # OCI8::Metadata - # return a subclass of OCI8::Metadata::Base - # which has information about _object_name_. - # OCI8::Metadata::Table, OCI8::Metadata::View, - # OCI8::Metadata::Procedure, OCI8::Metadata::Function, - # OCI8::Metadata::Package, OCI8::Metadata::Type, - # OCI8::Metadata::Synonym or OCI8::Metadata::Sequence + # Returns object information. + # + # The return type is depends on the object type. + # + # Oracle type:: Ruby type + # Table:: {OCI8::Metadata::Table} + # View:: {OCI8::Metadata::View} + # Procedure:: {OCI8::Metadata::Procedure} + # Function:: {OCI8::Metadata::Function} + # Package:: {OCI8::Metadata::Package} + # Type:: {OCI8::Metadata::Type} + # Synonym:: {OCI8::Metadata::Synonym} + # Sequence:: {OCI8::Metadata::Sequence} + # + # @param [String] object_name + # @return [a subclass of OCI8::Metadata::Base] def describe_any(object_name) __describe(object_name, OCI8::Metadata::Unknown, true) end - # returns a OCI8::Metadata::Table or a OCI8::Metadata::View. If the - # name is a current schema's synonym name or a public synonym name, - # it returns a OCI8::Metadata::Table or a OCI8::Metadata::View which + # Returns table or view information. If the name is a current schema's synonym + # name or a public synonym name, it returns table or view information which # the synonym refers. # - # If the second argument is true, this returns a - # OCI8::Metadata::Table in the current schema. + # If +table_only+ is true, it checks tables in the current schema. + # + # @param [String] table_name + # @param [Boolean] table_only (default: false) + # @return [OCI8::Metadata::Table or OCI8::Metadata::View] def describe_table(table_name, table_only = false) if table_only # check my own tables only. @@ -2022,39 +2034,66 @@ raise OCIError.new(36, recursive_level) # ORA-00036: maximum number of recursive SQL levels (%s) exceeded end end - # returns a OCI8::Metadata::View in the current schema. + # Returns view information + # + # @param [String] view_name + # @return [OCI8::Metadata::View] def describe_view(view_name) __describe(view_name, OCI8::Metadata::View, false) end - # returns a OCI8::Metadata::Procedure in the current schema. + # Returns procedure information + # + # @param [String] procedure_name + # @return [OCI8::Metadata::Procedure] def describe_procedure(procedure_name) __describe(procedure_name, OCI8::Metadata::Procedure, false) end - # returns a OCI8::Metadata::Function in the current schema. + # Returns function information + # + # @param [String] function_name + # @return [OCI8::Metadata::Function] def describe_function(function_name) __describe(function_name, OCI8::Metadata::Function, false) end - # returns a OCI8::Metadata::Package in the current schema. + # Returns package information + # + # @param [String] package_name + # @return [OCI8::Metadata::Package] def describe_package(package_name) __describe(package_name, OCI8::Metadata::Package, false) end - # returns a OCI8::Metadata::Type in the current schema. + # Returns type information + # + # @param [String] type_name + # @return [OCI8::Metadata::Type] def describe_type(type_name) __describe(type_name, OCI8::Metadata::Type, false) end - # returns a OCI8::Metadata::Synonym in the current schema. + # Returns synonym information + # + # @param [String] synonym_name + # @return [OCI8::Metadata::Synonym] def describe_synonym(synonym_name, check_public_also = true) __describe(synonym_name, OCI8::Metadata::Synonym, check_public_also) end - # returns a OCI8::Metadata::Sequence in the current schema. + # Returns sequence information + # + # @param [String] sequence_name + # @return [OCI8::Metadata::Sequence] def describe_sequence(sequence_name) __describe(sequence_name, OCI8::Metadata::Sequence, false) end - # returns a OCI8::Metadata::Schema in the database. + # Returns schema information + # + # @param [String] schema_name + # @return [OCI8::Metadata::Schema] def describe_schema(schema_name) __describe(schema_name, OCI8::Metadata::Schema, false) end - # returns a OCI8::Metadata::Database. + # Returns database information + # + # @param [String] database_name + # @return [OCI8::Metadata::Database] def describe_database(database_name) __describe(database_name, OCI8::Metadata::Database, false) end Modified: trunk/ruby-oci8/lib/oci8/oci8.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oci8.rb 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/lib/oci8/oci8.rb 2013-01-06 12:39:46 UTC (rev 551) @@ -26,8 +26,10 @@ # value_for_the_second_parameter) class OCI8 - # call-seq: - # new(username, password, dbname = nil, privilege = nil) + # @return [OCIError] + attr_accessor :last_error + + # @overload initialize(username, password, dbname = nil, privilege = nil) # # Connects to an Oracle database server by +username+ and +password+ # at +dbname+ as +privilege+. @@ -337,14 +339,14 @@ end end + # @private def inspect "#" end - # Returns an OCI8::OracleVersion of the Oracle server version. + # Returns the Oracle server version. # - # See also: OCI8.oracle_client_version - # + # @see OCI8.oracle_client_version # @return [OCI8::OracleVersion] def oracle_server_version unless defined? @oracle_server_version @@ -365,7 +367,7 @@ @oracle_server_version end - # Returns the Oracle database character set name. + # Returns the Oracle database character set name such as AL32UTF8. # # @since 2.1.0 # @return [String] Oracle database character set name @@ -373,10 +375,12 @@ charset_id2name(@server_handle.send(:attr_get_ub2, OCI_ATTR_CHARSET_ID)) end - # Returns the client-side Oracle character set name. + # Returns the client-side Oracle character set name such as AL32UTF8. # # @since 2.1.0 # @return [String] client-side character set name + # @private + # @see OCI8.encoding def self.client_charset_name @@client_charset_name end Modified: trunk/ruby-oci8/lib/oci8/oracle_version.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oracle_version.rb 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/lib/oci8/oracle_version.rb 2013-01-06 12:39:46 UTC (rev 551) @@ -122,7 +122,7 @@ # oraver = OCI8::OracleVersion.new('11.2.0.3') # oraver.to_s # => '11.2.0.3.0' # - # @return [Integer] + # @return [String] def to_s format('%d.%d.%d.%d.%d', @major, @minor, @update, @patch, @port_update) end Modified: trunk/ruby-oci8/lib/oci8/properties.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/properties.rb 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/lib/oci8/properties.rb 2013-01-06 12:39:46 UTC (rev 551) @@ -5,6 +5,7 @@ # class OCI8 + # @private @@properties = { :length_semantics => :byte, :bind_string_as_nchar => false, @@ -17,11 +18,13 @@ @@properties[:statement_cache_size] = nil end + # @private def @@properties.[](name) raise IndexError, "No such property name: #{name}" unless @@properties.has_key?(name) super(name) end + # @private def @@properties.[]=(name, val) raise IndexError, "No such property name: #{name}" unless @@properties.has_key?(name) case name Modified: trunk/ruby-oci8/lib/oci8.rb.in =================================================================== --- trunk/ruby-oci8/lib/oci8.rb.in 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/lib/oci8.rb.in 2013-01-06 12:39:46 UTC (rev 551) @@ -123,6 +123,7 @@ # OCIClientVersion(). # # @return [OCI8::OracleVersion] Oracle client version + # @see OCI8#oracle_server_version def self.oracle_client_version @@oracle_client_version end Modified: trunk/ruby-oci8/test/test_clob.rb =================================================================== --- trunk/ruby-oci8/test/test_clob.rb 2013-01-03 08:08:21 UTC (rev 550) +++ trunk/ruby-oci8/test/test_clob.rb 2013-01-06 12:39:46 UTC (rev 551) @@ -78,8 +78,15 @@ # https://github.com/kubo/ruby-oci8/issues/20 def test_github_issue_20 lob1 = OCI8::CLOB.new(@conn, ' ' * (1024 * 1024)) - lob2 = OCI8::CLOB.new(@conn, ' ' * (128 * 1024 * 1024)) - + begin + lob2 = OCI8::CLOB.new(@conn, ' ' * (128 * 1024 * 1024)) + rescue OCIError + raise if $!.code != 24817 + # ORA-24817: Unable to allocate the given chunk for current lob operation + GC.start + # allocate smaller size + lob2 = OCI8::CLOB.new(@conn, ' ' * (16 * 1024 * 1024)) + end lob1 = nil # lob1's value will be freed in GC. lob2.read # GC must run here to reproduce the issue. end From nobody at rubyforge.org Sat Jan 12 07:52:22 2013 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sat, 12 Jan 2013 07:52:22 +0000 (UTC) Subject: [ruby-oci8-commit] [552] trunk/ruby-oci8: Exports a main function for Solaris x86 (32-bit). Message-ID: <20130112075222.9E7412E097@rubyforge.org> Revision: 552 Author: kubo Date: 2013-01-12 07:52:21 +0000 (Sat, 12 Jan 2013) Log Message: ----------- Exports a main function for Solaris x86 (32-bit). Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/docs/platform-specific-issues.md trunk/ruby-oci8/ext/oci8/oci8lib.c Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2013-01-06 12:39:46 UTC (rev 551) +++ trunk/ruby-oci8/ChangeLog 2013-01-12 07:52:21 UTC (rev 552) @@ -1,3 +1,11 @@ +2013-01-12 KUBO Takehiro + * ext/oci8/oci8lib.c: export a main function for Solaris x86 (32-bit). + When a main function is invisible from Oracle instant client + 11.2.0.3 for Solaris x86 (32-bit), OCIEnvCreate() fails by + unknown reasons. + * docs/platform-specific-issues.md: change the workaround for + Solaris x86 (32-bit) instant client. + 2013-01-06 KUBO Takehiro * NEWS: add changes between 2.1.4 and 2.1.3 * VERSION: change the version to 2.1.4. Modified: trunk/ruby-oci8/docs/platform-specific-issues.md =================================================================== --- trunk/ruby-oci8/docs/platform-specific-issues.md 2013-01-06 12:39:46 UTC (rev 551) +++ trunk/ruby-oci8/docs/platform-specific-issues.md 2013-01-12 07:52:21 UTC (rev 552) @@ -74,20 +74,11 @@ For example, if the ruby is compiled by gcc, you need gcc. If it is compiled by Oracle Solaris Studio (formerly called as Sun Studio), you need Oracle Solaris Studio. -If ruby is compiled by gcc and "require 'oci8'" raises "OCI Library Initialization Error", -you may need to recompile ruby as follows: +If "require 'oci8'" raises "OCI Library Initialization Error", ruby-oci8 version is 2.1.4 or lower, +ruby version is 1.9.3 or upper, and ruby is compiled as an x86 32-bit executable by gcc, you may need +to add the following code to ext/oci8/oci8lib.c to export a symbol `main`. - $ bzip2 -dc ruby-1.9.3-pxxx.tar.bz2 | tar xvf - - $ cd ruby-1.9.3-pxxx - $ vi main.c # <- Add RUBY_FUNC_EXPORTED just before "int main(..)" as follows: - ------------- - RUBY_FUNC_EXPORTED /* Add this line */ - int - main(int argc, char **argv) - ------------- - $ ./configure - $ make - $ make install + int main() { return 0; } If you use Blastwave.org's ruby and want not to install Sun Studio, you can edit rbconfig.rb by your self. [(look at here)](http://forum.textdrive.com/viewtopic.php?id=12630) Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8lib.c 2013-01-06 12:39:46 UTC (rev 551) +++ trunk/ruby-oci8/ext/oci8/oci8lib.c 2013-01-12 07:52:21 UTC (rev 552) @@ -22,6 +22,14 @@ int oci8_in_finalizer = 0; VALUE oci8_cOCIHandle; +#if defined __sun && defined __i386 && defined __GNUC__ +/* When a main function is invisible from Oracle instant + * client 11.2.0.3 for Solaris x86 (32-bit), OCIEnvCreate() + * fails by unknown reasons. We export it from ruby-oci8 instead + * of ruby itself. + */ +int main() { return 0; } +#endif static VALUE mOCI8BindType; static VALUE cOCI8BindTypeBase;