ruby-oci8 2.1.5-x86-mingw32 → 2.1.7-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,126 @@
1
+ 2014-02-02 Kubo Takehiro <kubo@jiubao.org>
2
+ * NEWS: add changes between 2.1.7 and 2.1.6.
3
+ * VERSION: change the version to 2.1.7.
4
+
5
+ 2014-01-25 Kubo Takehiro <kubo@jiubao.org>
6
+ * ext/oci8/extconf.rb, lib/oci8.rb.in: Follow ABI versioning after ruby 2.1.0.
7
+
8
+ 2014-01-19 Kubo Takehiro <kubo@jiubao.org>
9
+ * docs/install-full-client.md, docs/install-instant-client.md: Change down
10
+ load URL and filenames in examples.
11
+
12
+ 2014-01-06 Kubo Takehiro <kubo@jiubao.org>
13
+ * README.md, docs/install-full-client.md, docs/install-instant-client.md,
14
+ docs/report-installation-issue.md, ext/oci8/oraconf.rb, ruby-oci8.gemspec:
15
+ Move the project page and download URL to github.
16
+
17
+ 2014-01-05 KUBO Takehiro <kubo@jiubao.org>
18
+ * ext/oci8/metadata.c, ext/oci8/oci8.h, lib/oci8/metadata.rb:
19
+ Fix OCI8#describe_table to follow synonyms in a remote database.
20
+ Add OCI8::Metadata::Base#obj_link.
21
+
22
+ 2013-12-29 KUBO Takehiro <kubo@jiubao.org>
23
+ * NEWS: add changes between 2.1.6 and 2.1.5.
24
+ * VERSION: change the version to 2.1.6.
25
+
26
+ 2013-12-28 KUBO Takehiro <kubo@jiubao.org>
27
+ * ext/oci8/oraconf.rb: fix for Windows x64. OCI.lib for MSVC doesn't
28
+ work with mingw64 compilers. fix URL in the error message.
29
+
30
+ 2013-12-14 KUBO Takehiro <kubo@jiubao.org>
31
+ * lib/oci8/metadata.rb, test/test_metadata.rb: fix
32
+ OCI8::Metadata::Synonym#schema_name and #translated_name
33
+ for synonyms with a database link and without schema_name.
34
+
35
+ 2013-12-14 KUBO Takehiro <kubo@jiubao.org>
36
+ * test/*.rb: suppress warnings "MiniTest::Unit::TestCase is now Minitest::Test"
37
+ when minitest gem is installed.
38
+
39
+ 2013-12-14 KUBO Takehiro <kubo@jiubao.org>
40
+ * test/test_metadata.rb: fix tests in an environment where
41
+ the data size of "CAST('1' AS CHAR(1 char))" is wrong.
42
+
43
+ 2013-11-18 KUBO Takehiro <kubo@jiubao.org>
44
+ * ext/oci8/oraconf.rb: support cygwin x86_64.
45
+
46
+ 2013-11-10 KUBO Takehiro <kubo@jiubao.org>
47
+ * ext/oci8/error.c, ext/oci8/lob.c, ext/oci8/object.c, ext/oci8/oci8.h,
48
+ ext/oci8/oci8lib.c, ext/oci8/ocihandle.c, ext/oci8/stmt.c:
49
+ use rb_class_new_instance() instead of rb_funcall() with rb_intern("new").
50
+
51
+ 2013-11-09 KUBO Takehiro <kubo@jiubao.org>
52
+ * ext/oci8/error.c, ext/oci8/extconf.rb, ext/oci8/oci8.h:
53
+ append the full path of the Oracle client library when OCIEnvCreate
54
+ is failed such as "OCI Library Initialization Error - /path/to/libclntsh.so.12.1".
55
+
56
+ 2013-11-09 KUBO Takehiro <kubo@jiubao.org>
57
+ * ext/oci8/extconf.rb, lib/oci8.rb.in: support rubinius 2.x whose
58
+ RUBY_VERSION is 2.1.0.
59
+ * ext/oci8/oraconf.rb: reduce the size of libOCI.a created for cygwin.
60
+
61
+ 2013-11-09 KUBO Takehiro <kubo@jiubao.org>
62
+ * ext/oci8/extconf.rb, lib/oci8.rb.in: support ruby 2.1.0-preview1.
63
+ (requested by Yasuo Honda)
64
+
65
+ 2013-08-24 KUBO Takehiro <kubo@jiubao.org>
66
+ * ext/oci8/oraconf.rb: Use Dir.glob to find the Oracle instant client
67
+ NLS data file. Its name depends on the Oracle major version on
68
+ Windows.
69
+
70
+ 2013-08-03 KUBO Takehiro <kubo@jiubao.org>
71
+ * lib/oci8/metadata.rb: fix undefined method 'char_used?' when
72
+ OCI8::Metadata::Argument#inspect is called.
73
+ * test/test_metadata.rb: refactor and add tests for #inspect methods.
74
+ * test/test_package_type.rb: add some test data.
75
+
76
+ 2013-07-30 KUBO Takehiro <kubo@jiubao.org>
77
+ * ext/oci8/metadata.c, ext/oci8/ocihandle.c, test/test_metadata.rb:
78
+ Fix segmentation fault when metadata are accessed after the
79
+ session is disconnected.
80
+
81
+ 2013-07-24 KUBO Takehiro <kubo@jiubao.org>
82
+ * lib/oci8/metadata.rb, test/test_package_type.rb:
83
+ Add OCI8::Metadata::Type#package_name and
84
+ OCI8::Metadata::ArgBase#has_default?.
85
+
86
+ 2013-07-22 KUBO Takehiro <kubo@jiubao.org>
87
+ * ext/oci8/oci8lib.c, lib/oci8.rb.in, lib/oci8/metadata.rb: Add
88
+ OCI8::Metadata::Package:types to support package type
89
+ description. It is a new feature of Oracle 12c.
90
+ * test/setup_test_package.sql, test/test_all.rb,
91
+ test/test_package_type.rb: Add tests for package type description.
92
+
93
+ 2013-07-15 KUBO Takehiro <kubo@jiubao.org>
94
+ * test/*.rb: Use MiniTest instead of Test::Unit.
95
+
96
+ 2013-06-23 KUBO Takehiro <kubo@jiubao.org>
97
+ * lib/oci8/cursor.rb, lib/oci8/object.rb: fix to bind object types by
98
+ name as OCI8::Cursor#bind_param(pos, val, :named_type, typename).
99
+ * test/test_object.rb: fix to test OCI8::Cursor#bind_param(pos, val,
100
+ :named_type, typename).
101
+
102
+ 2013-06-23 KUBO Takehiro <kubo@jiubao.org>
103
+ * lib/oci8/metadata.rb: OCI8#describe_synonym and OCI8#describe_any
104
+ accept 'PUBLIC.XXX' as a public synonym name.
105
+ * test/test_metadata.rb: add tests for OCI8#describe_synonym.
106
+
107
+ 2013-06-11 KUBO Takehiro <kubo@jiubao.org>
108
+ * ruby-oci8.gemspec: fix ruby version checking in binary gem.
109
+ Gem::ruby_version of ruby 2.0.0p195 is 2.0.0.195, which
110
+ doesn't match '= 2.0.0'.
111
+ (github issue #36 reported by sodonnel)
112
+
113
+ 2013-03-30 KUBO Takehiro <kubo@jiubao.org>
114
+ * ext/oci8/oci8lib.c: fix potential SEGV when one connection
115
+ is used by more than two threads and temporary lobs are
116
+ freed by GC.
117
+
118
+ 2013-03-16 KUBO Takehiro <kubo@jiubao.org>
119
+ * ext/oci8/apiwrap.yml, ext/oci8/stmt.c: call OCIStmtPrepare2()
120
+ without GVL to prevent OCI8#parse from blocking ruby itself
121
+ while the connection is used by another thread even though
122
+ non-blocking mode is set.
123
+
1
124
  2013-03-09 KUBO Takehiro <kubo@jiubao.org>
2
125
  * ruby-oci8.gemspec: revert the previous commit because old
3
126
  rubygems doesn't support:
data/NEWS CHANGED
@@ -1,5 +1,59 @@
1
1
  # @markup markdown
2
2
 
3
+ 2.1.7
4
+ =====
5
+
6
+ New Features
7
+ ------------
8
+
9
+ ### Add OCI8::Metadata::Base#obj_link.
10
+
11
+ Fixed Issues
12
+ ------------
13
+
14
+ - Fix OCI8#describe_table to follow synonyms in a remote database.
15
+
16
+ 2.1.6
17
+ =====
18
+
19
+ New Features
20
+ ------------
21
+
22
+ ### Support ruby 2.1.0
23
+
24
+ ### Support cygwin x86_64
25
+
26
+ ### OCI8#describe_synonym and OCI8#describe_any accept 'PUBLIC.XXX' as a public synonym name.
27
+
28
+ Fixed Issues
29
+ ------------
30
+
31
+ - fix wrong return valus of OCI8::Metadata::Synonym#schema_name
32
+ and #translated_name for synonyms with a database link but
33
+ without schema_name.
34
+
35
+ - fix ruby version checking in binary gem. Gem::ruby_version of
36
+ ruby 2.0.0p195 is 2.0.0.195, which doesn't match '= 2.0.0'.
37
+
38
+ (github issue #36 reported by sodonnel)
39
+
40
+ - fix SEGV when metadata are accessed after the session is disconnected.
41
+
42
+ - fix undefined method 'char_used?' when OCI8::Metadata::Argument#inspect is called.
43
+
44
+ - fix tests in an environment where the data size of "CAST('1' AS CHAR(1 char))"
45
+ is wrong.
46
+
47
+ - suppress warnings "MiniTest::Unit::TestCase is now Minitest::Test"
48
+ when minitest gem is installed.
49
+
50
+ - fix SEGV when oci8lib.so is compiled by mingw64 without runtime-check option.
51
+ Note that binary gems are compiled with runtime-check to check available Oracle
52
+ client features at runtime.
53
+
54
+ - fix SEGV when one connection is used by more than two threads and temporary
55
+ lobs are freed by GC.
56
+
3
57
  2.1.5
4
58
  =====
5
59
 
data/README.md CHANGED
@@ -21,20 +21,23 @@ Connect to scott/tiger, select `emp` and print as CSV format.
21
21
 
22
22
  If you install a ruby-oci8 gem package, you may need to add `-rubygems` before `-r oci8`.
23
23
 
24
- Documantation
24
+ API Reference
25
25
  =============
26
26
 
27
- * [Reference Manual](http://ruby-oci8.rubyforge.org/en/)
28
- * {file:docs/install-full-client.md}
29
- * {file:docs/install-instant-client.md}
30
- * {file:docs/install-binary-package.md}
27
+ * http://rubydoc.info/gems/ruby-oci8/frames/file/README.md
28
+
29
+ Installation
30
+ ============
31
+
32
+ * {file:docs/install-full-client.md Install for Oracle Full Client}
33
+ * {file:docs/install-instant-client.md Install for Oracle Instant Client}
34
+ * {file:docs/install-binary-package.md Install Binary Package}
31
35
 
32
36
  Report issues
33
37
  =============
34
38
 
35
39
  * {file:docs/report-installation-issue.md}
36
40
  * [The issues page on github](https://github.com/kubo/ruby-oci8/issues)
37
- * [The ruby-oci8 help forum on rubyforge](http://rubyforge.org/forum/forum.php?forum_id=1078)
38
41
 
39
42
  License
40
43
  =======
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.5
1
+ 2.1.7
@@ -90,8 +90,7 @@ tar.gz package
90
90
 
91
91
  ### Download the source code
92
92
 
93
- Download the latest tar.gz package such as ruby-oci8 2.1.0.tar.gz,
94
- which is the latest version at the time of writing, from [rubyforge][].
93
+ Download the latest tar.gz package from [download page][].
95
94
 
96
95
  ### Run make and install
97
96
 
@@ -107,10 +106,9 @@ note: If you use '`sudo`', use it only when running '`make install`'.
107
106
 
108
107
  #### Windows(mswin32)
109
108
 
110
-
111
109
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
112
110
  cd ruby-oci8-VERSION
113
111
  nmake
114
112
  nmake install
115
113
 
116
- [rubyforge]: http://rubyforge.org/frs/?group_id=256
114
+ [download page]: https://bintray.com/kubo/generic/ruby-oci8
@@ -34,11 +34,11 @@ Unzip the packages as follows:
34
34
  unzip path/to/instantclient-sdk-OS-VERSION.zip
35
35
  unzip path/to/instantclient-sqlplus-OS-VERSION.zip
36
36
 
37
- If /opt/oracle/instantclient10_1/libclntsh.so is not found, make
37
+ If /opt/oracle/instantclient12_1/libclntsh.so is not found, make
38
38
  a symbolic link to link the library.
39
39
 
40
- cd /opt/oracle/instantclient10_1
41
- ln -s libclntsh.so.10.1 libclntsh.so
40
+ cd /opt/oracle/instantclient12_1
41
+ ln -s libclntsh.so.12.1 libclntsh.so
42
42
 
43
43
  Note:
44
44
 
@@ -66,9 +66,15 @@ the installed directory.
66
66
  </table>
67
67
 
68
68
  For example:
69
- $ LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2
69
+
70
+ $ LD_LIBRARY_PATH=/opt/oracle/instantclient_12_1
70
71
  $ export LD_LIBRARY_PATH
71
72
 
73
+ Though many instant client pages indicate that the environment varialbe
74
+ `ORACLE_HOME` should be set, it isn't necessary unless Oracle Net
75
+ configuration files such as `tnsnames.ora` and `sqlnet.ora` are in
76
+ `$ORACLE_HOME/network/admin/`.
77
+
72
78
  Linux rpm packages
73
79
  ------------------
74
80
 
@@ -81,7 +87,8 @@ Install the downloaded packages as follows:
81
87
  Set LD_LIBRARY_PATH to point to the directory where libclntsh.so is installed.
82
88
 
83
89
  For example:
84
- $ LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client/lib
90
+
91
+ $ LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client/lib
85
92
  $ export LD_LIBRARY_PATH
86
93
 
87
94
  Windows
@@ -138,8 +145,7 @@ tar.gz package
138
145
 
139
146
  ### Download the source code
140
147
 
141
- Download the latest tar.gz package such as ruby-oci8 2.1.0.tar.gz,
142
- which is the latest version at the time of writing, from [rubyforge][].
148
+ Download the latest tar.gz package from [download page][].
143
149
 
144
150
  Note: if you are using Windows and you have no special need to compile
145
151
  it by yourself, look at {file:docs/install-binary-packge.md}.
@@ -158,10 +164,9 @@ note: If you use '`sudo`', use it only when running '`make install`'.
158
164
 
159
165
  #### Windows(mswin32)
160
166
 
161
-
162
167
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
163
168
  cd ruby-oci8-VERSION
164
169
  nmake
165
170
  nmake install
166
171
 
167
- [rubyforge]: http://rubyforge.org/frs/?group_id=256
172
+ [download page]: https://bintray.com/kubo/generic/ruby-oci8
@@ -4,7 +4,7 @@ Look at {file:docs/platform-specific-issues.md},
4
4
  [the issues page on github][github] and [the ruby-oci8 help forum on rubyforge][rubyforge]
5
5
  to check whether your issue is fixed or not.
6
6
 
7
- If it is a new one, post the following information to [github][] or [rubyforge][].
7
+ If it is a new one, post the following information to [github][].
8
8
 
9
9
  [github]: https://github.com/kubo/ruby-oci8/issues
10
10
  [rubyforge]: http://rubyforge.org/forum/forum.php?forum_id=1078
@@ -43,15 +43,14 @@ when 'ruby'
43
43
  # 1.9.3 | 1.9.1
44
44
  # --------------+--------------
45
45
  # 2.0.0 | 2.0.0
46
- # 2.0.1 | 2.0.1 (See: [ruby-core:49578])
46
+ # --------------+--------------
47
+ # 2.1.0 | 2.1.0
47
48
  # ... | ...
48
49
  #
49
- # Note: The ruby ABI version is same with RbConfig::CONFIG['ruby_version']
50
- # if it wasn't explicitly changed by the configure option --with-ruby-version.
50
+ # The ABI version of ruby 2.1.1 will be 2.1.0.
51
+ # See "ABI Compatibility" in <URL:http://www.ruby-lang.org/en/news/2013/12/21/semantic-versioning-after-2-1-0/>.
51
52
  #
52
53
  case RUBY_VERSION
53
- when /^2\.0/
54
- so_basename += RUBY_VERSION.gsub(/\W/, '')
55
54
  when /^1\.9\.0/
56
55
  raise 'unsupported ruby version: 1.9.0'
57
56
  when /^1\.9/
@@ -59,20 +58,10 @@ when 'ruby'
59
58
  when /^1\.8/
60
59
  so_basename += '18'
61
60
  else
62
- raise 'unsupported ruby version: ' + RUBY_VERSION
61
+ so_basename += RUBY_VERSION.gsub(/(\d+)\.(\d+).(.*)/, '\1\20')
63
62
  end
64
63
  when 'rbx'
65
- # "rbx -X18" and "rbx -X19" use different C header files.
66
- case RUBY_VERSION
67
- when /^2\.0/
68
- so_basename += 'rbx20'
69
- when /^1\.9/
70
- so_basename += 'rbx19'
71
- when /^1\.8/
72
- so_basename += 'rbx18'
73
- else
74
- raise 'unsupported language mode: ' + RUBY_VERSION
75
- end
64
+ so_basename += 'rbx'
76
65
  when 'jruby'
77
66
  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."
78
67
  else
@@ -80,10 +69,10 @@ else
80
69
  end
81
70
  require so_basename
82
71
 
83
- if OCI8::VERSION != '2.1.5'
72
+ if OCI8::VERSION != '2.1.7'
84
73
  require 'rbconfig'
85
74
  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."
75
+ raise "VERSION MISMATCH! #{so_name} version is #{OCI8::VERSION}, but oci8.rb version is 2.1.7."
87
76
  end
88
77
 
89
78
  require 'oci8/encoding-init.rb'
@@ -104,6 +93,8 @@ class OCI8
104
93
  ORAVER_10_2 = OCI8::OracleVersion.new(10, 2)
105
94
  # @private
106
95
  ORAVER_11_1 = OCI8::OracleVersion.new(11, 1)
96
+ # @private
97
+ ORAVER_12_1 = OCI8::OracleVersion.new(12, 1)
107
98
 
108
99
  # @private
109
100
  @@oracle_client_version = OCI8::OracleVersion.new(self.oracle_client_vernum)
@@ -43,15 +43,14 @@ when 'ruby'
43
43
  # 1.9.3 | 1.9.1
44
44
  # --------------+--------------
45
45
  # 2.0.0 | 2.0.0
46
- # 2.0.1 | 2.0.1 (See: [ruby-core:49578])
46
+ # --------------+--------------
47
+ # 2.1.0 | 2.1.0
47
48
  # ... | ...
48
49
  #
49
- # Note: The ruby ABI version is same with RbConfig::CONFIG['ruby_version']
50
- # if it wasn't explicitly changed by the configure option --with-ruby-version.
50
+ # The ABI version of ruby 2.1.1 will be 2.1.0.
51
+ # See "ABI Compatibility" in <URL:http://www.ruby-lang.org/en/news/2013/12/21/semantic-versioning-after-2-1-0/>.
51
52
  #
52
53
  case RUBY_VERSION
53
- when /^2\.0/
54
- so_basename += RUBY_VERSION.gsub(/\W/, '')
55
54
  when /^1\.9\.0/
56
55
  raise 'unsupported ruby version: 1.9.0'
57
56
  when /^1\.9/
@@ -59,20 +58,10 @@ when 'ruby'
59
58
  when /^1\.8/
60
59
  so_basename += '18'
61
60
  else
62
- raise 'unsupported ruby version: ' + RUBY_VERSION
61
+ so_basename += RUBY_VERSION.gsub(/(\d+)\.(\d+).(.*)/, '\1\20')
63
62
  end
64
63
  when 'rbx'
65
- # "rbx -X18" and "rbx -X19" use different C header files.
66
- case RUBY_VERSION
67
- when /^2\.0/
68
- so_basename += 'rbx20'
69
- when /^1\.9/
70
- so_basename += 'rbx19'
71
- when /^1\.8/
72
- so_basename += 'rbx18'
73
- else
74
- raise 'unsupported language mode: ' + RUBY_VERSION
75
- end
64
+ so_basename += 'rbx'
76
65
  when 'jruby'
77
66
  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."
78
67
  else
@@ -104,6 +93,8 @@ class OCI8
104
93
  ORAVER_10_2 = OCI8::OracleVersion.new(10, 2)
105
94
  # @private
106
95
  ORAVER_11_1 = OCI8::OracleVersion.new(11, 1)
96
+ # @private
97
+ ORAVER_12_1 = OCI8::OracleVersion.new(12, 1)
107
98
 
108
99
  # @private
109
100
  @@oracle_client_version = OCI8::OracleVersion.new(self.oracle_client_vernum)
@@ -478,6 +478,8 @@ class OCI8
478
478
  elsif key.class == Class && key < OCI8::Object::Base
479
479
  param = @con.get_tdo_by_class(key)
480
480
  key = :named_type
481
+ elsif key == :named_type
482
+ param = @con.get_tdo_by_typename(param[:length])
481
483
  end
482
484
  when OCI8::Metadata::Base
483
485
  key = param.data_type
@@ -89,6 +89,15 @@ class OCI8
89
89
  # attr_get_oradate(OCI_ATTR_TIMESTAMP)
90
90
  #end
91
91
 
92
+ # Returns the database link name if the object is at the remote host.
93
+ # Note that this is available only when the object is returned by OCI8#describe_* methods.
94
+ #
95
+ # @return [String or nil] database link name
96
+ # @since 2.1.7
97
+ def obj_link
98
+ @obj_link
99
+ end
100
+
92
101
  # @private
93
102
  def inspect
94
103
  "#<#{self.class.name}:(#{obj_id}) #{obj_schema}.#{obj_name}>"
@@ -110,7 +119,7 @@ class OCI8
110
119
  Proc.new do |p|
111
120
  if p.charset_form == :nchar
112
121
  "NVARCHAR2(#{p.char_size})"
113
- elsif p.char_used?
122
+ elsif p.respond_to?(:char_used?) && p.char_used?
114
123
  "VARCHAR2(#{p.char_size} CHAR)"
115
124
  else
116
125
  "VARCHAR2(#{p.data_size})"
@@ -248,6 +257,12 @@ class OCI8
248
257
  "TIMESTAMP(#{fsprecision}) WITH LOCAL TIME ZONE"
249
258
  end
250
259
  end]
260
+ DATA_TYPE_MAP[245] = [:record,
261
+ Proc.new do |p|
262
+ "#{p.schema_name}.#{p.type_name}"
263
+ end]
264
+ DATA_TYPE_MAP[252] = [:boolean, "BOOLEAN"]
265
+ DATA_TYPE_MAP[266] = [:pls_integer, "PLS_INTEGER"]
251
266
 
252
267
  def __data_type # :nodoc:
253
268
  return @data_type if defined? @data_type
@@ -337,6 +352,9 @@ class OCI8
337
352
  #when 228; :sysfirst # OCI_TYPECODE_SYSFIRST
338
353
  #when 235; :syslast # OCI_TYPECODE_SYSLAST
339
354
  when 266; :pls_integer # OCI_TYPECODE_PLS_INTEGER
355
+ when 250; :record # OCI_TYPECODE_RECORD
356
+ when 251; :itable # OCI_TYPECODE_ITABLE
357
+ when 252; :boolean # OCI_TYPECODE_BOOLEAN
340
358
  end
341
359
  end
342
360
  end
@@ -632,6 +650,12 @@ class OCI8
632
650
  end
633
651
  private :list_subprograms
634
652
 
653
+ # package type list
654
+ def list_types # :nodoc:
655
+ __param(137) # OCI_ATTR_LIST_PKG_TYPES
656
+ end
657
+ private :list_types
658
+
635
659
  # Returns +true+ if the package subprograms have
636
660
  # {invoker's rights}[http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/subprograms.htm#i18574].
637
661
  # Otherwise, +false+.
@@ -647,6 +671,22 @@ class OCI8
647
671
  prog.instance_variable_set(:@is_standalone, false)
648
672
  end
649
673
  end
674
+
675
+ if OCI8.oracle_client_version < ORAVER_12_1
676
+ def types
677
+ raise "This version of the Oracle client does not support PL/SQL package type descriptions."
678
+ end
679
+ else
680
+ # Returns an array of types defined within the Package.
681
+ #
682
+ # @return [array of OCI8::Metadata::Type]
683
+ # @since 2.1.6
684
+ def types
685
+ @types ||= list_types.to_a.each do |type|
686
+ type.instance_variable_set(:@is_standalone, false)
687
+ end
688
+ end
689
+ end
650
690
  end
651
691
 
652
692
  # Information about types
@@ -851,6 +891,15 @@ class OCI8
851
891
  attr_get_string(OCI_ATTR_SUPERTYPE_NAME) if is_subtype?
852
892
  end
853
893
 
894
+ # Returns the package name if the type is a package type.
895
+ # Otherwise, +nil+.
896
+ #
897
+ # @return [String or nil]
898
+ # @since 2.1.6
899
+ def package_name
900
+ attr_get_string(12, false) # OCI_ATTR_PACKAGE_NAME
901
+ end
902
+
854
903
  # Returns attribute information of the type.
855
904
  #
856
905
  # @return [array of OCI8::Metadata::TypeAttr]
@@ -1199,6 +1248,7 @@ class OCI8
1199
1248
  # schema name of the synonym translation
1200
1249
  def schema_name
1201
1250
  @schema_name ||= attr_get_string(OCI_ATTR_SCHEMA_NAME)
1251
+ @schema_name.size == 0 ? nil : @schema_name
1202
1252
  end
1203
1253
 
1204
1254
  # object name of the synonym translation
@@ -1214,11 +1264,7 @@ class OCI8
1214
1264
 
1215
1265
  # full-qualified synonym translation name with schema, object and database link name.
1216
1266
  def translated_name
1217
- if link.nil?
1218
- schema_name + '.' + name
1219
- else
1220
- schema_name + '.' + name + '@' + link
1221
- end
1267
+ (schema_name ? schema_name + '.' : '') + name + (link ? '@' + link : '')
1222
1268
  end
1223
1269
 
1224
1270
  def inspect # :nodoc:
@@ -1487,10 +1533,21 @@ class OCI8
1487
1533
  end
1488
1534
 
1489
1535
  # Indicates whether an argument has a default
1536
+ #
1537
+ # @return [1 or 0]
1538
+ # @deprecated
1490
1539
  def has_default
1491
1540
  attr_get_ub1(OCI_ATTR_HAS_DEFAULT)
1492
1541
  end
1493
1542
 
1543
+ # Indicates whether an argument has a default
1544
+ #
1545
+ # @return [true or false]
1546
+ # @since 2.1.6
1547
+ def has_default?
1548
+ __boolean(OCI_ATTR_HAS_DEFAULT)
1549
+ end
1550
+
1494
1551
  # The list of arguments at the next level (when the argument is
1495
1552
  # of a record or table type).
1496
1553
  def list_arguments
@@ -1648,8 +1705,9 @@ class OCI8
1648
1705
  #when OCI_LTYPE_TABLE_ALIAS; offset = ?
1649
1706
  #when OCI_LTYPE_VARIABLE_TYPE; offset = ?
1650
1707
  #when OCI_LTYPE_NAME_VALUE; offset = ?
1708
+ when 15; offset = 0 # OCI_LTYPE_PACKAGE_TYPE
1651
1709
  else
1652
- raise NotImplementedError, "unsupported list type #{list.ltype}"
1710
+ raise NotImplementedError, "unsupported list type #{ltype}"
1653
1711
  end
1654
1712
  ary = []
1655
1713
  0.upto(num_params - 1) do |i|
@@ -1994,7 +2052,13 @@ class OCI8
1994
2052
  # @param [String] object_name
1995
2053
  # @return [a subclass of OCI8::Metadata::Base]
1996
2054
  def describe_any(object_name)
1997
- __describe(object_name, OCI8::Metadata::Unknown, true)
2055
+ if /^PUBLIC\.(.*)/i =~ object_name
2056
+ md = __describe($1, OCI8::Metadata::Unknown, true)
2057
+ raise OCIError.new(4043, object_name) if md.obj_schema != 'PUBLIC'
2058
+ md
2059
+ else
2060
+ __describe(object_name, OCI8::Metadata::Unknown, true)
2061
+ end
1998
2062
  end
1999
2063
  # Returns table or view information. If the name is a current schema's synonym
2000
2064
  # name or a public synonym name, it returns table or view information which
@@ -2011,6 +2075,9 @@ class OCI8
2011
2075
  __describe(table_name, OCI8::Metadata::Table, false)
2012
2076
  else
2013
2077
  # check tables, views, synonyms and public synonyms.
2078
+
2079
+ # follow synonyms up to 20 times to prevent infinite loop
2080
+ # caused by recursive synonyms.
2014
2081
  recursive_level = 20
2015
2082
  recursive_level.times do
2016
2083
  metadata = __describe(table_name, OCI8::Metadata::Unknown, true)
@@ -2019,6 +2086,11 @@ class OCI8
2019
2086
  return metadata
2020
2087
  when OCI8::Metadata::Synonym
2021
2088
  table_name = metadata.translated_name
2089
+ if metadata.obj_link and metadata.link.nil?
2090
+ # table_name is a synonym in a remote database for an object in the
2091
+ # remote database itself.
2092
+ table_name = "#{table_name}@#{metadata.obj_link}"
2093
+ end
2022
2094
  else
2023
2095
  raise OCIError.new(4043, table_name) # ORA-04043: object %s does not exist
2024
2096
  end
@@ -2066,7 +2138,13 @@ class OCI8
2066
2138
  # @param [String] synonym_name
2067
2139
  # @return [OCI8::Metadata::Synonym]
2068
2140
  def describe_synonym(synonym_name, check_public_also = true)
2069
- __describe(synonym_name, OCI8::Metadata::Synonym, check_public_also)
2141
+ if /^PUBLIC\.(.*)/i =~ synonym_name
2142
+ md = __describe($1, OCI8::Metadata::Synonym, true)
2143
+ raise OCIError.new(4043, synonym_name) if md.obj_schema != 'PUBLIC'
2144
+ md
2145
+ else
2146
+ __describe(synonym_name, OCI8::Metadata::Synonym, check_public_also)
2147
+ end
2070
2148
  end
2071
2149
  # Returns sequence information
2072
2150
  #