ruby-oci8 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,24 @@
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
+
1
22
  2013-12-29 KUBO Takehiro <kubo@jiubao.org>
2
23
  * NEWS: add changes between 2.1.6 and 2.1.5.
3
24
  * VERSION: change the version to 2.1.6.
data/NEWS CHANGED
@@ -1,5 +1,18 @@
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
+
3
16
  2.1.6
4
17
  =====
5
18
 
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.6
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
@@ -156,11 +156,12 @@ when 'ruby'
156
156
  # 1.9.3 | 1.9.1
157
157
  # --------------+--------------
158
158
  # 2.0.0 | 2.0.0
159
- # 2.0.1 | 2.0.1 (See: [ruby-core:49578])
159
+ # --------------+--------------
160
+ # 2.1.0 | 2.1.0
160
161
  # ... | ...
161
162
  #
162
- # Note: The ruby ABI version is same with RbConfig::CONFIG['ruby_version']
163
- # if it wasn't explicitly changed by the configure option --with-ruby-version.
163
+ # The ABI version of ruby 2.1.1 will be 2.1.0.
164
+ # See "ABI Compatibility" in <URL:http://www.ruby-lang.org/en/news/2013/12/21/semantic-versioning-after-2-1-0/>.
164
165
  #
165
166
  case RUBY_VERSION
166
167
  when /^1\.9\.0/
@@ -170,7 +171,7 @@ when 'ruby'
170
171
  when /^1\.8/
171
172
  so_basename += '18'
172
173
  else
173
- so_basename += RUBY_VERSION.gsub(/\W/, '')
174
+ so_basename += RUBY_VERSION.gsub(/(\d+)\.(\d+).(.*)/, '\1\20')
174
175
  end
175
176
  when 'rbx'
176
177
  so_basename += 'rbx'
@@ -14,6 +14,7 @@ static VALUE mOCI8Metadata;
14
14
  VALUE cOCI8MetadataBase;
15
15
  static VALUE ptype_to_class;
16
16
  static VALUE class_to_ptype;
17
+ static ID id_at_obj_link;
17
18
 
18
19
  typedef struct {
19
20
  oci8_base_t base;
@@ -175,11 +176,26 @@ static VALUE oci8_do_describe(VALUE self, void *objptr, ub4 objlen, ub1 objtype,
175
176
  */
176
177
  static VALUE oci8_describe(VALUE self, VALUE name, VALUE klass, VALUE check_public)
177
178
  {
179
+ char *str;
180
+ size_t idx, len;
181
+ VALUE metadata;
182
+ VALUE obj_link = Qnil;
183
+
178
184
  OCI8SafeStringValue(name);
179
185
  if (RSTRING_LEN(name) == 0) {
180
186
  rb_raise(rb_eArgError, "empty string is set.");
181
187
  }
182
- return oci8_do_describe(self, RSTRING_PTR(name), RSTRING_LEN(name), OCI_OTYPE_NAME, klass, check_public);
188
+ str = RSTRING_PTR(name);
189
+ len = RSTRING_LEN(name);
190
+ for (idx = 0; idx < len; idx++) {
191
+ if (str[idx] == '@') {
192
+ obj_link = rb_enc_str_new(str + idx + 1, len - idx - 1, oci8_encoding);
193
+ break;
194
+ }
195
+ }
196
+ metadata = oci8_do_describe(self, str, len, OCI_OTYPE_NAME, klass, check_public);
197
+ rb_ivar_set(metadata, id_at_obj_link, obj_link);
198
+ return metadata;
183
199
  }
184
200
 
185
201
  static VALUE metadata_get_type_metadata(VALUE self, VALUE klass)
@@ -230,6 +246,7 @@ void Init_oci8_metadata(VALUE cOCI8)
230
246
  class_to_ptype = rb_hash_new();
231
247
  rb_global_variable(&ptype_to_class);
232
248
  rb_global_variable(&class_to_ptype);
249
+ id_at_obj_link = rb_intern("@obj_link");
233
250
 
234
251
  rb_define_singleton_method(cOCI8MetadataBase, "register_ptype", metadata_s_register_ptype, 1);
235
252
  rb_define_private_method(cOCI8MetadataBase, "__param", metadata_get_param, 1);
@@ -152,6 +152,7 @@ static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr
152
152
  #ifndef HAVE_TYPE_RB_ENCODING
153
153
  /* ruby 1.8, rubinuis 1.2 */
154
154
  #define rb_enc_associate(str, enc) do {} while(0)
155
+ #define rb_enc_str_new(str, len, enc) rb_str_new((str), (len))
155
156
  #define rb_enc_str_buf_cat(str, ptr, len, enc) rb_str_buf_cat((str), (ptr), (len))
156
157
  #define rb_external_str_new_with_enc(ptr, len, enc) rb_tainted_str_new((ptr), (len))
157
158
  #define rb_locale_str_new_cstr(ptr) rb_str_new2(ptr)
@@ -334,8 +334,8 @@ Backtrace:
334
334
  #{$!.backtrace.join("\n ")}
335
335
  ---------------------------------------------------
336
336
  See:
337
- * http://ruby-oci8.rubyforge.org/en/file.install-full-client.html for Oracle full client
338
- * http://ruby-oci8.rubyforge.org/en/file.install-instant-client.html for Oracle instant client
337
+ * http://rubydoc.info/gems/ruby-oci8/file/docs/install-full-client.md for Oracle full client
338
+ * http://rubydoc.info/gems/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
339
339
  * http://ruby-oci8.rubyforge.org/en/file.report-installation-issue.html to report an issue.
340
340
 
341
341
  EOS
@@ -43,11 +43,12 @@ 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
54
  when /^1\.9\.0/
@@ -57,7 +58,7 @@ when 'ruby'
57
58
  when /^1\.8/
58
59
  so_basename += '18'
59
60
  else
60
- so_basename += RUBY_VERSION.gsub(/\W/, '')
61
+ so_basename += RUBY_VERSION.gsub(/(\d+)\.(\d+).(.*)/, '\1\20')
61
62
  end
62
63
  when 'rbx'
63
64
  so_basename += 'rbx'
@@ -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}>"
@@ -2066,6 +2075,9 @@ class OCI8
2066
2075
  __describe(table_name, OCI8::Metadata::Table, false)
2067
2076
  else
2068
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.
2069
2081
  recursive_level = 20
2070
2082
  recursive_level.times do
2071
2083
  metadata = __describe(table_name, OCI8::Metadata::Unknown, true)
@@ -2074,6 +2086,11 @@ class OCI8
2074
2086
  return metadata
2075
2087
  when OCI8::Metadata::Synonym
2076
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
2077
2094
  else
2078
2095
  raise OCIError.new(4043, table_name) # ORA-04043: object %s does not exist
2079
2096
  end
@@ -19,7 +19,7 @@ spec = Gem::Specification.new do |s|
19
19
  s.version = File.read('VERSION').strip
20
20
  s.summary = 'Ruby interface for Oracle using OCI8 API'
21
21
  s.email = 'kubo@jiubao.org'
22
- s.homepage = 'http://ruby-oci8.rubyforge.org'
22
+ s.homepage = 'https://github.com/kubo/ruby-oci8/'
23
23
  s.rubyforge_project = 'ruby-oci8'
24
24
  s.description = <<EOS
25
25
  ruby-oci8 is a ruby interface for Oracle using OCI8 API. It is available with Oracle8i, Oracle9i, Oracle10g, Oracle11g and Oracle Instant Client.
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 1
8
- - 6
9
- version: 2.1.6
8
+ - 7
9
+ version: 2.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kubo Takehiro
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-12-29 00:00:00 +09:00
17
+ date: 2014-02-02 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -121,7 +121,7 @@ files:
121
121
  - test/test_oranumber.rb
122
122
  - test/test_rowid.rb
123
123
  has_rdoc: true
124
- homepage: http://ruby-oci8.rubyforge.org
124
+ homepage: https://github.com/kubo/ruby-oci8/
125
125
  licenses:
126
126
  - 2-clause BSD-style license
127
127
  post_install_message: