ruby-oci8 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/ChangeLog +67 -0
- data/NEWS +21 -0
- data/VERSION +1 -1
- data/docs/platform-specific-issues.md +4 -24
- data/ext/oci8/extconf.rb +2 -1
- data/ext/oci8/lob.c +39 -26
- data/ext/oci8/object.c +25 -1
- data/ext/oci8/oci8.c +12 -42
- data/ext/oci8/oci8.h +1 -3
- data/ext/oci8/oci8lib.c +8 -0
- data/ext/oci8/ocihandle.c +167 -188
- data/ext/oci8/oraconf.rb +3 -2
- data/lib/oci8.rb.in +1 -1
- data/lib/oci8/metadata.rb +59 -67
- data/lib/oci8/object.rb +0 -1
- data/lib/oci8/oci8.rb +35 -35
- data/lib/oci8/oracle_version.rb +7 -14
- data/ruby-oci8.gemspec +31 -26
- data/test/test_bind_time.rb +2 -2
- data/test/test_connection_pool.rb +2 -2
- data/test/test_metadata.rb +0 -2
- data/test/test_object.rb +0 -1
- data/test/test_oci8.rb +10 -2
- metadata +4 -4
data/ext/oci8/oraconf.rb
CHANGED
@@ -394,6 +394,7 @@ EOS
|
|
394
394
|
nls_data_basename = ['oraociei11', 'oraociicus11', 'oraociei10', 'oraociicus10']
|
395
395
|
@@ld_envs = %w[PATH]
|
396
396
|
so_ext = 'dll'
|
397
|
+
check_proc = make_proc_to_check_cpu(is_32bit ? :i386 : :x86_64)
|
397
398
|
when /i.86-linux/
|
398
399
|
check_proc = make_proc_to_check_cpu(:i386)
|
399
400
|
when /ia64-linux/
|
@@ -847,7 +848,7 @@ EOS
|
|
847
848
|
unless File.exist?("#{@oracle_home}/OCI/INCLUDE/OCI.H")
|
848
849
|
raise "'#{@oracle_home}/OCI/INCLUDE/OCI.H' does not exists. Please install 'Oracle Call Interface'."
|
849
850
|
end
|
850
|
-
if RUBY_PLATFORM =~ /cygwin/
|
851
|
+
if RUBY_PLATFORM =~ /cygwin|mingw32/
|
851
852
|
" \"-I#{@oracle_home}/OCI/INCLUDE\" -D_int64=\"long long\""
|
852
853
|
else
|
853
854
|
" \"-I#{@oracle_home}/OCI/INCLUDE\""
|
@@ -971,7 +972,7 @@ EOS
|
|
971
972
|
raise 'failed'
|
972
973
|
end
|
973
974
|
@cflags = " \"-I#{inc_dir}\""
|
974
|
-
@cflags += " -D_int64=\"long long\"" if RUBY_PLATFORM =~ /cygwin/
|
975
|
+
@cflags += " -D_int64=\"long long\"" if RUBY_PLATFORM =~ /cygwin|mingw32/
|
975
976
|
@libs = get_libs("#{ic_dir}/sdk/lib")
|
976
977
|
ld_path = nil
|
977
978
|
else
|
data/lib/oci8.rb.in
CHANGED
@@ -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 + "." +
|
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
|
|
data/lib/oci8/metadata.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# oci8.rb -- implements OCI8::Metadata.
|
2
2
|
#
|
3
|
-
# Copyright (C) 2006-
|
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
|
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
|
63
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
-
|
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
|
107
|
-
|
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
|
569
|
-
# {overloaded packaged subprogram}[http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/subprograms.htm#i12352]
|
570
|
-
#
|
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
|
-
|
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
|
|
data/lib/oci8/object.rb
CHANGED
data/lib/oci8/oci8.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# oci8.rb -- OCI8
|
2
2
|
#
|
3
|
-
# Copyright (C) 2002-
|
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
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
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
|
-
|
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
|
-
|
165
|
-
|
166
|
-
|
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}>"
|
data/lib/oci8/oracle_version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# oracle_version.rb implements OCI8::OracleVersion.
|
2
2
|
#
|
3
|
-
# Copyright (C) 2009
|
3
|
+
# Copyright (C) 2009-2013 Kubo Takehiro <kubo@jiubao.org>
|
4
4
|
|
5
5
|
#
|
6
6
|
class OCI8
|
@@ -21,9 +21,9 @@ class OCI8
|
|
21
21
|
attr_reader :minor
|
22
22
|
# The third part of the Oracle version.
|
23
23
|
attr_reader :update
|
24
|
-
# The fifth part of the Oracle version.
|
25
|
-
attr_reader :patch
|
26
24
|
# The fourth part of the Oracle version.
|
25
|
+
attr_reader :patch
|
26
|
+
# The fifth part of the Oracle version.
|
27
27
|
attr_reader :port_update
|
28
28
|
|
29
29
|
# Creates an OCI8::OracleVersion object.
|
@@ -80,6 +80,7 @@ class OCI8
|
|
80
80
|
@update = update || 0
|
81
81
|
@patch = patch || 0
|
82
82
|
@port_update = port_update || 0
|
83
|
+
@vernum = (@major << 24) | (@minor << 20) | (@update << 12) | (@patch << 8) | @port_update
|
83
84
|
end
|
84
85
|
|
85
86
|
# Compares +self+ and +other+.
|
@@ -89,15 +90,7 @@ class OCI8
|
|
89
90
|
#
|
90
91
|
# @return [-1, 0, +1]
|
91
92
|
def <=>(other)
|
92
|
-
|
93
|
-
return cmp if cmp != 0
|
94
|
-
cmp = @minor <=> other.minor
|
95
|
-
return cmp if cmp != 0
|
96
|
-
cmp = @update <=> other.update
|
97
|
-
return cmp if cmp != 0
|
98
|
-
cmp = @patch <=> other.patch
|
99
|
-
return cmp if cmp != 0
|
100
|
-
@port_update <=> other.port_update
|
93
|
+
@vernum <=> other.to_i
|
101
94
|
end
|
102
95
|
|
103
96
|
# Returns an integer number contains 5-digit Oracle version.
|
@@ -113,7 +106,7 @@ class OCI8
|
|
113
106
|
#
|
114
107
|
# @return [Integer]
|
115
108
|
def to_i
|
116
|
-
|
109
|
+
@vernum
|
117
110
|
end
|
118
111
|
|
119
112
|
# Returns a dotted version string of the Oracle version.
|
@@ -139,7 +132,7 @@ class OCI8
|
|
139
132
|
#
|
140
133
|
# @return [Integer]
|
141
134
|
def hash
|
142
|
-
|
135
|
+
@vernum
|
143
136
|
end
|
144
137
|
|
145
138
|
# @private
|
data/ruby-oci8.gemspec
CHANGED
@@ -8,15 +8,8 @@
|
|
8
8
|
#
|
9
9
|
require 'fileutils'
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
else
|
14
|
-
# for old rubygems
|
15
|
-
ARGV.include?("--") ? ARGV[(ARGV.index("--") + 1)...ARGV.size] : []
|
16
|
-
end
|
17
|
-
|
18
|
-
if build_args.size > 0
|
19
|
-
gem_platform = build_args[0]
|
11
|
+
if ARGV.include?("--") and ARGV[(ARGV.index("--") + 1)] == 'current'
|
12
|
+
gem_platform = 'current'
|
20
13
|
else
|
21
14
|
gem_platform = Gem::Platform::RUBY
|
22
15
|
end
|
@@ -29,10 +22,10 @@ spec = Gem::Specification.new do |s|
|
|
29
22
|
s.homepage = 'http://ruby-oci8.rubyforge.org'
|
30
23
|
s.rubyforge_project = 'ruby-oci8'
|
31
24
|
s.description = <<EOS
|
32
|
-
ruby-oci8 is a ruby interface for Oracle using OCI8 API. It is available with
|
25
|
+
ruby-oci8 is a ruby interface for Oracle using OCI8 API. It is available with Oracle8i, Oracle9i, Oracle10g, Oracle11g and Oracle Instant Client.
|
33
26
|
EOS
|
34
27
|
s.has_rdoc = 'yard'
|
35
|
-
s.authors = ['
|
28
|
+
s.authors = ['Kubo Takehiro']
|
36
29
|
s.platform = gem_platform
|
37
30
|
s.license = '2-clause BSD-style license'
|
38
31
|
files = File.read('dist-files').split("\n")
|
@@ -41,23 +34,35 @@ EOS
|
|
41
34
|
s.required_ruby_version = '>= 1.8.0'
|
42
35
|
else
|
43
36
|
so_files = Dir.glob('ext/oci8/oci8lib_*.so')
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
37
|
+
so_vers = so_files.collect do |file|
|
38
|
+
$1 if /ext\/oci8\/oci8lib_(\S+).so/ =~ file
|
39
|
+
end.sort
|
40
|
+
|
41
|
+
# add map files to analyze a core (minidump) file.
|
42
|
+
so_vers.each do |ver|
|
43
|
+
map_file = 'ext/oci8/oci8lib_#{ver}.map'
|
44
|
+
so_files << map_file if File.exists? map_file
|
45
|
+
end
|
46
|
+
|
47
|
+
# least version in so_vers
|
48
|
+
so_vermin = so_vers.collect do |ver|
|
49
|
+
"#$1.#$2.#{$3||'0'}" if /^(?:rbx)?(\d)(\d)(\d)?/ =~ ver
|
50
|
+
end.sort.first
|
51
|
+
|
52
|
+
case so_vers.length
|
53
|
+
when 0
|
56
54
|
raise "No compiled binary are found. Run make in advance."
|
55
|
+
when 1
|
56
|
+
puts "Binary gem for ruby #{so_vers.first}"
|
57
|
+
if so_vers[0] < '2.0.0'
|
58
|
+
s.required_ruby_version = "~> #{so_vermin}"
|
59
|
+
else
|
60
|
+
s.required_ruby_version = "= #{so_vermin}"
|
61
|
+
end
|
62
|
+
else
|
63
|
+
puts "Binary gem for ruby #{so_vers.join(', ')}"
|
64
|
+
s.required_ruby_version = ">= #{so_vermin}"
|
57
65
|
end
|
58
|
-
# add map files to analyze a core (minidump) file.
|
59
|
-
so_files << 'ext/oci8/oci8lib_18.map' if has_1_8 and File.exists? 'ext/oci8/oci8lib_18.map'
|
60
|
-
so_files << 'ext/oci8/oci8lib_191.map' if has_1_9_1 and File.exists? 'ext/oci8/oci8lib_191.map'
|
61
66
|
|
62
67
|
FileUtils.copy so_files, 'lib', :preserve => true
|
63
68
|
files.reject! do |fname|
|