ruby-oci8 2.1.4-x86-mingw32 → 2.1.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/.yardopts CHANGED
@@ -5,6 +5,7 @@
5
5
  --exclude lib/oci8/compat.rb
6
6
  --exclude lib/dbd
7
7
  --hide-void-return
8
+ --charset UTF-8
8
9
  -
9
10
  NEWS
10
11
  COPYING
data/ChangeLog CHANGED
@@ -1,3 +1,70 @@
1
+ 2013-03-09 KUBO Takehiro <kubo@jiubao.org>
2
+ * ruby-oci8.gemspec: revert the previous commit because old
3
+ rubygems doesn't support:
4
+ required_ruby_version = ['>= 1.8.0', '<= 2.0.0']
5
+
6
+ 2013-03-09 KUBO Takehiro <kubo@jiubao.org>
7
+ * NEWS: add changes between 2.1.5 and 2.1.4
8
+ * VERSION: change the version to 2.1.5.
9
+ * docs/platform-specific-issues.md: remove obsolete description.
10
+ * ext/oci8/extconf.rb, ext/oci8/oraconf.rb: fix to compile for
11
+ Windows x64 client.
12
+ * ruby-oci8.gemspec: change required_ruby_version range
13
+ when a binary gem includes more than one compiled object.
14
+ * test/test_connection_pool.rb: fix to pass tests on slow
15
+ machines.
16
+
17
+ 2013-03-05 KUBO Takehiro <kubo@jiubao.org>
18
+ * ext/oci8/oci8.c, lib/oci8/oci8.rb, lib/oci8/oracle_version.rb:
19
+ refactoring.
20
+
21
+ 2013-03-03 KUBO Takehiro <kubo@jiubao.org>
22
+ * lib/oci8/oci8.rb, test/test_oci8.rb: set 'rubyoci8' as
23
+ the driver name, which is displayed in
24
+ V$SESSION_CONNECT_INFO.CLIENT_DRIVER.
25
+ (require Oracle 11g or upper)
26
+
27
+ 2013-03-03 KUBO Takehiro <kubo@jiubao.org>
28
+ * lib/oci8.rb.in: use RbConfig::CONFIG instead of obsolete
29
+ constant Config::CONFIG.
30
+ * lib/oci8/object.rb, test/test_bind_time.rb, test/test_metadata.rb
31
+ test/test_object.rb, test/test_oci8.rb:
32
+ suppress warning: assigned but unused variable
33
+
34
+ 2013-03-03 KUBO Takehiro <kubo@jiubao.org>
35
+ * ext/oci8/lob.c, ext/oci8/oci8.c, ext/oci8/oci8.h:
36
+ refactor oci8_lob_t.
37
+
38
+ 2013-03-03 KUBO Takehiro <kubo@jiubao.org>
39
+ * ext/oci8/oci8.c: fix segmentation fault when the process
40
+ exits on rubinius.
41
+
42
+ 2013-03-02 KUBO Takehiro <kubo@jiubao.org>
43
+ * .yardopts, ext/oci8/object.c, lib/oci8/metadata.rb,
44
+ lib/oci8/oracle_version.rb: update comments for rdoc/yard.
45
+
46
+ 2013-03-02 KUBO Takehiro <kubo@jiubao.org>
47
+ * ext/oci8/ocihandle.c: change arguments of internal methods
48
+ OCIHandle#attr_get_*() to ignore "ORA-24328: illegal
49
+ attribute value".
50
+ * lib/oci8/metadata.rb: change OCI8::Metadata::Base#obj_id,
51
+ #obj_name and #obj_schema not to raise "ORA-24328:
52
+ illegal attribute value".
53
+
54
+ 2013-03-02 KUBO Takehiro <kubo@jiubao.org>
55
+ * ruby-oci8.gemspec: fix for ruby 2.0.0 to make binary gems.
56
+
57
+ 2013-03-02 KUBO Takehiro <kubo@jiubao.org>
58
+ * ext/oci8/oraconf.rb: fix for compilation on Windows x64 by mingw64.
59
+
60
+ 2013-01-12 KUBO Takehiro <kubo@jiubao.org>
61
+ * ext/oci8/oci8lib.c: export a main function for Solaris x86 (32-bit).
62
+ When a main function is invisible from Oracle instant client
63
+ 11.2.0.3 for Solaris x86 (32-bit), OCIEnvCreate() fails by
64
+ unknown reasons.
65
+ * docs/platform-specific-issues.md: change the workaround for
66
+ Solaris x86 (32-bit) instant client.
67
+
1
68
  2013-01-06 KUBO Takehiro <kubo@jiubao.org>
2
69
  * NEWS: add changes between 2.1.4 and 2.1.3
3
70
  * VERSION: change the version to 2.1.4.
data/NEWS CHANGED
@@ -1,5 +1,26 @@
1
1
  # @markup markdown
2
2
 
3
+ 2.1.5
4
+ =====
5
+
6
+ New Features
7
+ ------------
8
+
9
+ ### V$SESSION_CONNECT_INFO.CLIENT_DRIVER.
10
+
11
+ 'rubyoci8' is set as the driver name, which is displayed in
12
+ V$SESSION_CONNECT_INFO.CLIENT_DRIVER when both the client and
13
+ the server are Oracle 11g or upper.
14
+
15
+ Fixed Issues
16
+ ------------
17
+
18
+ - fix segmentation fault when the process exits on rubinius.
19
+
20
+ - fix "OCI Library Initialization Error" only when the Oracle
21
+ instant client is 11.2.0.3 for Solaris x86 32-bit, the ruby
22
+ version is 1.9.3 or upper and the ruby is compiled by gcc.
23
+
3
24
  2.1.4
4
25
  =====
5
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.1.5
@@ -34,15 +34,10 @@ Note: "`" is a back quote.
34
34
  Mac OS X
35
35
  ========
36
36
 
37
- OS X 10.7 Lion
38
- --------------
39
-
40
- 64-bit instant client doesn't work. Use 32-bit ruby and instant client or jruby.
37
+ OS X 10.7+
38
+ ----------
41
39
 
42
- See:
43
-
44
- * {http://rubyforge.org/forum/forum.php?thread\_id=49548&forum\_id=1078}
45
- * {https://forums.oracle.com/forums/thread.jspa?threadID=2187558}
40
+ Use the latest 64-bit instant client. The older 64-bit (10.2.0.4) instant client [doesn't work](https://forums.oracle.com/forums/thread.jspa?threadID=2187558). The older 32-bit instant client will work but only with 32-bit ruby or jruby (using JDBC).
46
41
 
47
42
  Intel Mac (64-bit)
48
43
  ------------------
@@ -59,7 +54,7 @@ The Intel Instant client is for Mac OS X 10.5 Leopard. If you are using 10.4 Tig
59
54
  use one of the following workarounds.
60
55
 
61
56
  * compile ruby as ppc. (look at [How to setup Ruby and Oracle client on Intel Mac](http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/))
62
- * use [ruby-odbc|http://www.ch-werner.de/rubyodbc/] and a third party ODBC driver ([Actual Technologies](http://www.actualtechnologies.com) or [OpenLink Software](http://uda.openlinksw.com/)).
57
+ * use [ruby-odbc](http://www.ch-werner.de/rubyodbc/) and a third party ODBC driver ([Actual Technologies](http://www.actualtechnologies.com) or [OpenLink Software](http://uda.openlinksw.com/)).
63
58
  * use JRuby and Oracle JDBC driver.
64
59
 
65
60
  PowerPC Mac
@@ -74,21 +69,6 @@ You need a same compiler which is used to make ruby itself.
74
69
  For example, if the ruby is compiled by gcc, you need gcc. If it is compiled by Oracle Solaris Studio
75
70
  (formerly called as Sun Studio), you need Oracle Solaris Studio.
76
71
 
77
- If ruby is compiled by gcc and "require 'oci8'" raises "OCI Library Initialization Error",
78
- you may need to recompile ruby as follows:
79
-
80
- $ bzip2 -dc ruby-1.9.3-pxxx.tar.bz2 | tar xvf -
81
- $ cd ruby-1.9.3-pxxx
82
- $ vi main.c # <- Add RUBY_FUNC_EXPORTED just before "int main(..)" as follows:
83
- -------------
84
- RUBY_FUNC_EXPORTED /* Add this line */
85
- int
86
- main(int argc, char **argv)
87
- -------------
88
- $ ./configure
89
- $ make
90
- $ make install
91
-
92
72
  If you use Blastwave.org's ruby and want not to install Sun Studio,
93
73
  you can edit rbconfig.rb by your self. [(look at here)](http://forum.textdrive.com/viewtopic.php?id=12630)
94
74
 
@@ -80,10 +80,10 @@ else
80
80
  end
81
81
  require so_basename
82
82
 
83
- if OCI8::VERSION != '2.1.4'
83
+ if OCI8::VERSION != '2.1.5'
84
84
  require 'rbconfig'
85
- so_name = so_basename + "." + Config::CONFIG['DLEXT']
86
- raise "VERSION MISMATCH! #{so_name} version is #{OCI8::VERSION}, but oci8.rb version is 2.1.4."
85
+ so_name = so_basename + "." + RbConfig::CONFIG['DLEXT']
86
+ raise "VERSION MISMATCH! #{so_name} version is #{OCI8::VERSION}, but oci8.rb version is 2.1.5."
87
87
  end
88
88
 
89
89
  require 'oci8/encoding-init.rb'
@@ -82,7 +82,7 @@ require so_basename
82
82
 
83
83
  if OCI8::VERSION != '@@OCI8_MODULE_VERSION@@'
84
84
  require 'rbconfig'
85
- so_name = so_basename + "." + Config::CONFIG['DLEXT']
85
+ so_name = so_basename + "." + RbConfig::CONFIG['DLEXT']
86
86
  raise "VERSION MISMATCH! #{so_name} version is #{OCI8::VERSION}, but oci8.rb version is @@OCI8_MODULE_VERSION@@."
87
87
  end
88
88
 
@@ -1,6 +1,6 @@
1
1
  # oci8.rb -- implements OCI8::Metadata.
2
2
  #
3
- # Copyright (C) 2006-2010 KUBO Takehiro <kubo@jiubao.org>
3
+ # Copyright (C) 2006-2013 Kubo Takehiro <kubo@jiubao.org>
4
4
  #
5
5
  # See {'Describing Schema Metadata' in Oracle Call Interface Programmer's Guide}
6
6
  # [http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14250/oci06des.htm]
@@ -14,33 +14,33 @@ class OCI8
14
14
  # OCI8::Metadata::Base's subclass.
15
15
  #
16
16
  # List of methods which return OCI8::Metadata::Base.
17
- # * OCI8#describe_any(object_name)
18
- # * OCI8#describe_table(table_name, table_only = false)
19
- # * OCI8#describe_view(view_name)
20
- # * OCI8#describe_procedure(procedure_name)
21
- # * OCI8#describe_function(function_name)
22
- # * OCI8#describe_package(package_name)
23
- # * OCI8#describe_type(type_name)
24
- # * OCI8#describe_synonym(synonym_name, check_public_also = true)
25
- # * OCI8#describe_sequence(sequence_name)
26
- # * OCI8#describe_schema(schema_name)
27
- # * OCI8#describe_database(database_name)
28
- # * OCI8::Metadata::Type#map_method
29
- # * OCI8::Metadata::Type#order_method
30
- # * OCI8::Metadata::Type#collection_element
17
+ # * {OCI8#describe_any OCI8#describe_any(object_name)}
18
+ # * {OCI8#describe_table OCI8#describe_table(table_name, table_only = false)}
19
+ # * {OCI8#describe_view OCI8#describe_view(view_name)}
20
+ # * {OCI8#describe_procedure OCI8#describe_procedure(procedure_name)}
21
+ # * {OCI8#describe_function OCI8#describe_function(function_name)}
22
+ # * {OCI8#describe_package OCI8#describe_package(package_name)}
23
+ # * {OCI8#describe_type OCI8#describe_type(type_name)}
24
+ # * {OCI8#describe_synonym OCI8#describe_synonym(synonym_name, check_public_also = true)}
25
+ # * {OCI8#describe_sequence OCI8#describe_sequence(sequence_name)}
26
+ # * {OCI8#describe_schema OCI8#describe_schema(schema_name)}
27
+ # * {OCI8#describe_database OCI8#describe_database(database_name)}
28
+ # * {OCI8::Metadata::Type#map_method OCI8::Metadata::Type#map_method}
29
+ # * {OCI8::Metadata::Type#order_method OCI8::Metadata::Type#order_method}
30
+ # * {OCI8::Metadata::Type#collection_element OCI8::Metadata::Type#collection_element}
31
31
  #
32
32
  # List of methods which return an array of OCI8::Metadata::Base.
33
- # * OCI8::Cursor#column_metadata
34
- # * OCI8::Metadata::Database#schemas
35
- # * OCI8::Metadata::Schema#all_objects
36
- # * OCI8::Metadata::Schema#objects
37
- # * OCI8::Metadata::Table#columns
38
- # * OCI8::Metadata::Package#subprograms
39
- # * OCI8::Metadata::Procedure#arguments
40
- # * OCI8::Metadata::Function#arguments
41
- # * OCI8::Metadata::Type#type_attrs
42
- # * OCI8::Metadata::Type#type_methods
43
- # * OCI8::Metadata::TypeMethod#arguments
33
+ # * {OCI8::Cursor#column_metadata OCI8::Cursor#column_metadata}
34
+ # * {OCI8::Metadata::Database#schemas OCI8::Metadata::Database#schemas}
35
+ # * {OCI8::Metadata::Schema#all_objects OCI8::Metadata::Schema#all_objects}
36
+ # * {OCI8::Metadata::Schema#objects OCI8::Metadata::Schema#objects}
37
+ # * {OCI8::Metadata::Table#columns OCI8::Metadata::Table#columns}
38
+ # * {OCI8::Metadata::Package#subprograms OCI8::Metadata::Package#subprograms}
39
+ # * {OCI8::Metadata::Subprogram#arguments OCI8::Metadata::Procedure#arguments}
40
+ # * {OCI8::Metadata::Subprogram#arguments OCI8::Metadata::Function#arguments}
41
+ # * {OCI8::Metadata::Type#type_attrs OCI8::Metadata::Type#type_attrs}
42
+ # * {OCI8::Metadata::Type#type_methods OCI8::Metadata::Type#type_methods}
43
+ # * {OCI8::Metadata::TypeMethod#arguments OCI8::Metadata::TypeMethod#arguments}
44
44
  #
45
45
  # Example:
46
46
  # conn = OCI8.new('username/passord')
@@ -54,34 +54,31 @@ class OCI8
54
54
  # Table 6-1 Attributes Belonging to All Parameters
55
55
 
56
56
  # Returns the number of parameters.
57
- def num_params # :nodoc:
57
+ def num_params
58
58
  attr_get_ub2(OCI_ATTR_NUM_PARAMS)
59
59
  end
60
60
  private :num_params
61
61
 
62
- # Returns the object ID, which is the same as the value of the
63
- # OBJECT_ID column from ALL_OBJECTS. It returns +nil+
64
- # if the database object doesn't have ID.
62
+ # Returns the object ID which corresponds to the data dictionary
63
+ # view column ALL_OBJECTS.OBJECT_ID.
65
64
  #
66
65
  # @return [Integer or nil]
67
66
  def obj_id
68
- attr_get_ub4(OCI_ATTR_OBJ_ID)
67
+ attr_get_ub4(OCI_ATTR_OBJ_ID, false)
69
68
  end
70
69
 
71
- # Retruns the object name such as table name, view name,
72
- # procedure name, and so on.
70
+ # Returns the object name which corresponds to the data dictionary view column ALL_OBJECTS.OBJECT_NAME.
73
71
  #
74
- # @return [String]
72
+ # @return [String or nil] object name
75
73
  def obj_name
76
- attr_get_string(OCI_ATTR_OBJ_NAME)
74
+ attr_get_string(OCI_ATTR_OBJ_NAME, false)
77
75
  end
78
76
 
79
- # Retruns the schema name. It returns +nil+
80
- # if the database object is not defined just under a schema.
77
+ # Returns the schema name which corresponds to the data dictionary view column ALL_OBJECTS.OWNER.
81
78
  #
82
- # @return [String]
79
+ # @return [String or nil] schema name
83
80
  def obj_schema
84
- attr_get_string(OCI_ATTR_OBJ_SCHEMA)
81
+ attr_get_string(OCI_ATTR_OBJ_SCHEMA, false)
85
82
  end
86
83
 
87
84
  # The timestamp of the object
@@ -92,7 +89,8 @@ class OCI8
92
89
  # attr_get_oradate(OCI_ATTR_TIMESTAMP)
93
90
  #end
94
91
 
95
- def inspect # :nodoc:
92
+ # @private
93
+ def inspect
96
94
  "#<#{self.class.name}:(#{obj_id}) #{obj_schema}.#{obj_name}>"
97
95
  end
98
96
  private
@@ -103,8 +101,9 @@ class OCI8
103
101
  alias __word attr_get_sb4
104
102
  def __anydata(idx); raise NotImplementedError; end
105
103
 
106
- # SQLT values to name
107
- DATA_TYPE_MAP = {} # :nodoc:
104
+ # Mapping from SQLT values to names
105
+ # @private
106
+ DATA_TYPE_MAP = {}
108
107
 
109
108
  # SQLT_CHR
110
109
  DATA_TYPE_MAP[1] = [:varchar2,
@@ -346,7 +345,7 @@ class OCI8
346
345
  # into other metadata classes.
347
346
  #
348
347
  # An instance of this class is returned by:
349
- # * OCI8::Metadata::Schema#all_objects
348
+ # * {OCI8::Metadata::Schema#all_objects OCI8::Metadata::Schema#all_objects}
350
349
  class Unknown < Base
351
350
  register_ptype OCI_PTYPE_UNK
352
351
  end
@@ -354,14 +353,10 @@ class OCI8
354
353
  # Information about tables
355
354
  #
356
355
  # An instance of this class is returned by:
357
- # * OCI8#describe_any(name)
358
- # * OCI8#describe_table(name)
359
- # * OCI8::Metadata::Schema#all_objects
360
- # * OCI8::Metadata::Schema#objects
361
- #
362
- # See also:
363
- # * OCI8::Metadata::Base#obj_name
364
- # * OCI8::Metadata::Base#obj_schema
356
+ # * {OCI8#describe_any OCI8#describe_any(name)}
357
+ # * {OCI8#describe_table OCI8#describe_table(name)}
358
+ # * {OCI8::Metadata::Schema#all_objects OCI8::Metadata::Schema#all_objects}
359
+ # * {OCI8::Metadata::Schema#objects OCI8::Metadata::Schema#objects}
365
360
  class Table < Base
366
361
  register_ptype OCI_PTYPE_TABLE
367
362
 
@@ -464,15 +459,11 @@ class OCI8
464
459
  # Information about views
465
460
  #
466
461
  # An instance of this class is returned by:
467
- # * OCI8#describe_any(name)
468
- # * OCI8#describe_table(name, false)
469
- # * OCI8#describe_view(name)
470
- # * OCI8::Metadata::Schema#all_objects
471
- # * OCI8::Metadata::Schema#objects
472
- #
473
- # See also:
474
- # * OCI8::Metadata::Base#obj_name
475
- # * OCI8::Metadata::Base#obj_schema
462
+ # * {OCI8#describe_any OCI8#describe_any(name)}
463
+ # * {OCI8#describe_table OCI8#describe_table(name, false)}
464
+ # * {OCI8#describe_view OCI8#describe_view(name)}
465
+ # * {OCI8::Metadata::Schema#all_objects OCI8::Metadata::Schema#all_objects}
466
+ # * {OCI8::Metadata::Schema#objects OCI8::Metadata::Schema#objects}
476
467
  class View < Base
477
468
  register_ptype OCI_PTYPE_VIEW
478
469
 
@@ -525,8 +516,8 @@ class OCI8
525
516
  # with a set of parameters. A subprogram can be either a procedure
526
517
  # or a function.
527
518
  #
528
- # This is the abstract base class of OCI8::Metadata::Procedure and
529
- # OCI8::Metadata::Function.
519
+ # This is the abstract base class of {OCI8::Metadata::Procedure OCI8::Metadata::Procedure} and
520
+ # {OCI8::Metadata::Function OCI8::Metadata::Function}.
530
521
  class Subprogram < Base
531
522
  ## Table 6-4 Attribute Belonging to Procedures or Functions
532
523
 
@@ -565,9 +556,9 @@ class OCI8
565
556
  alias name obj_name # :nodoc: for backward compatibility
566
557
 
567
558
  # Returns +nil+ for a standalone stored subprogram,
568
- # positive integer for a
569
- # {overloaded packaged subprogram}[http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/subprograms.htm#i12352].
570
- # , otherwise zero.
559
+ # positive integer for an
560
+ # {overloaded packaged subprogram}[http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/subprograms.htm#i12352],
561
+ # otherwise zero.
571
562
  #
572
563
  # @return [Integer or nil]
573
564
  def overload_id
@@ -589,7 +580,8 @@ class OCI8
589
580
  @is_standalone
590
581
  end
591
582
 
592
- def inspect # :nodoc:
583
+ # @private
584
+ def inspect
593
585
  "#<#{self.class.name}: #{name}>"
594
586
  end
595
587
  end
@@ -1230,7 +1222,7 @@ class OCI8
1230
1222
  end
1231
1223
 
1232
1224
  def inspect # :nodoc:
1233
- "#<#{self.class.name}:(#{obj_id}) #{obj_schema}.#{obj_name}>"
1225
+ "#<#{self.class.name}:(#{obj_id}) #{obj_schema}.#{obj_name} FOR #{translated_name}>"
1234
1226
  end
1235
1227
  end
1236
1228
 
@@ -394,7 +394,6 @@ EOS
394
394
  @instance_methods = {}
395
395
  metadata.type_methods.each_with_index do |type_method, i|
396
396
  next if type_method.is_constructor? or type_method.is_destructor?
397
- args = type_method.arguments
398
397
 
399
398
  result_type = nil
400
399
  if type_method.has_result?
@@ -1,6 +1,6 @@
1
1
  # oci8.rb -- OCI8
2
2
  #
3
- # Copyright (C) 2002-2012 KUBO Takehiro <kubo@jiubao.org>
3
+ # Copyright (C) 2002-2013 Kubo Takehiro <kubo@jiubao.org>
4
4
  #
5
5
  # Original Copyright is:
6
6
  # Oracle module for Ruby
@@ -123,48 +123,38 @@ class OCI8
123
123
  stmt_cache_size = OCI8.properties[:statement_cache_size]
124
124
  stmt_cache_size = nil if stmt_cache_size == 0
125
125
 
126
- if mode.nil? and cred.nil?
127
- # logon by the OCI function OCILogon2().
128
- logon2_mode = 0
129
- if dbname.is_a? OCI8::ConnectionPool
130
- @pool = dbname # to prevent GC from freeing the connection pool.
131
- dbname = dbname.send(:pool_name)
132
- logon2_mode |= 0x0200 # OCI_LOGON2_CPOOL
133
- end
134
- if stmt_cache_size
135
- # enable statement caching
136
- logon2_mode |= 0x0004 # OCI_LOGON2_STMTCACHE
137
- end
138
-
139
- logon2(username, password, dbname, logon2_mode)
126
+ attach_mode = 0
127
+ if dbname.is_a? OCI8::ConnectionPool
128
+ @pool = dbname # to prevent GC from freeing the connection pool.
129
+ dbname = dbname.send(:pool_name)
130
+ attach_mode |= 0x0200 # OCI_CPOOL and OCI_LOGON2_CPOOL
131
+ end
132
+ if stmt_cache_size
133
+ # enable statement caching
134
+ attach_mode |= 0x0004 # OCI_STMT_CACHE and OCI_LOGON2_STMTCACHE
135
+ end
140
136
 
141
- if stmt_cache_size
142
- # set statement cache size
143
- attr_set_ub4(176, stmt_cache_size) # 176: OCI_ATTR_STMTCACHESIZE
144
- end
145
- else
137
+ if true
146
138
  # logon by the OCI function OCISessionBegin().
147
- attach_mode = 0
148
- if dbname.is_a? OCI8::ConnectionPool
149
- @pool = dbname # to prevent GC from freeing the connection pool.
150
- dbname = dbname.send(:pool_name)
151
- attach_mode |= 0x0200 # OCI_CPOOL
152
- end
153
- if stmt_cache_size
154
- # enable statement caching
155
- attach_mode |= 0x0004 # OCI_STMT_CACHE
156
- end
157
-
158
139
  allocate_handles()
159
140
  @session_handle.send(:attr_set_string, OCI_ATTR_USERNAME, username) if username
160
141
  @session_handle.send(:attr_set_string, OCI_ATTR_PASSWORD, password) if password
142
+ if @@oracle_client_version >= ORAVER_11_1
143
+ # 'rubyoci8' is displayed in V$SESSION_CONNECT_INFO.CLIENT_DRIVER
144
+ # if both the client and the server are Oracle 11g or upper.
145
+ # 424: OCI_ATTR_DRIVER_NAME
146
+ @session_handle.send(:attr_set_string, 424, 'rubyoci8')
147
+ end
161
148
  server_attach(dbname, attach_mode)
162
149
  session_begin(cred ? cred : OCI_CRED_RDBMS, mode ? mode : OCI_DEFAULT)
150
+ else
151
+ # logon by the OCI function OCILogon2().
152
+ logon2(username, password, dbname, attach_mode)
153
+ end
163
154
 
164
- if stmt_cache_size
165
- # set statement cache size
166
- attr_set_ub4(176, stmt_cache_size) # 176: OCI_ATTR_STMTCACHESIZE
167
- end
155
+ if stmt_cache_size
156
+ # set statement cache size
157
+ attr_set_ub4(176, stmt_cache_size) # 176: OCI_ATTR_STMTCACHESIZE
168
158
  end
169
159
 
170
160
  @prefetch_rows = nil
@@ -339,6 +329,16 @@ class OCI8
339
329
  end
340
330
  end
341
331
 
332
+ # Sets the prefetch rows size. The default value is one.
333
+ # When a select statement is executed, the OCI library allocate
334
+ # prefetch buffer to reduce the number of network round trips by
335
+ # retrieving specified number of rows in one round trip.
336
+ #
337
+ # Note: Active record adaptors set 100 by default.
338
+ def prefetch_rows=(num)
339
+ @prefetch_rows = num
340
+ end
341
+
342
342
  # @private
343
343
  def inspect
344
344
  "#<OCI8:#{username}>"