ruby-oci8 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +36 -0
- data/NEWS +14 -0
- data/README.md +1 -1
- data/dist-files +1 -0
- data/docs/install-on-osx.md +33 -30
- data/ext/oci8/metadata.c +2 -2
- data/ext/oci8/oci8.c +1 -1
- data/ext/oci8/oci8.h +22 -18
- data/ext/oci8/ocinumber.c +1 -1
- data/lib/oci8/bindtype.rb +5 -2
- data/lib/oci8/compat.rb +5 -1
- data/lib/oci8/oci8.rb +1 -1
- data/lib/oci8/version.rb +1 -1
- data/lib/ruby-oci8.rb +1 -1
- data/test/config.rb +7 -0
- data/test/test_bind_array.rb +70 -0
- data/test/test_clob.rb +1 -1
- data/test/test_metadata.rb +2 -1
- data/test/test_object.rb +47 -9
- data/test/test_oci8.rb +1 -1
- data/test/test_package_type.rb +2 -0
- metadata +4 -3
data/ChangeLog
CHANGED
@@ -1,3 +1,39 @@
|
|
1
|
+
2016-12-27 Kubo Takehiro <kubo@jiubao.org>
|
2
|
+
* NEWS: Add changes between 2.2.2 and 2.2.3.
|
3
|
+
* lib/oci8/version.rb: update to 2.2.3.
|
4
|
+
* dist-files: add test/test_bind_array.rb
|
5
|
+
* mkpkg-win32.rb: add path to ruby 2.4.0
|
6
|
+
|
7
|
+
2016-12-26 Kubo Takehiro <kubo@jiubao.org>
|
8
|
+
* test/test_clob.rb, test/test_metadata.rb, test/test_object.rb,
|
9
|
+
test/test_oci8.rb, test/test_package_type.rb: Suppress warnings:
|
10
|
+
"Use assert_nil if expecting nil from ... in `...' This will
|
11
|
+
fail in MT6" printed by Minitest.
|
12
|
+
|
13
|
+
2016-12-26 Kubo Takehiro <kubo@jiubao.org>
|
14
|
+
* lib/oci8/bindtype.rb, lib/oci8/compat.rb, lib/oci8/oci8.rb,
|
15
|
+
test/config.rb: Suppress "warning: constant ::Fixnum is deprecated"
|
16
|
+
and "warning: constant ::Bignum is deprecated" due to integer
|
17
|
+
unification in ruby 2.4.0.
|
18
|
+
|
19
|
+
2016-12-14 Koichi ITO <koic.ito@gmail.com>
|
20
|
+
* ext/oci8/ocinumber.c: Fix invalid value for BigDecimal in
|
21
|
+
Ruby 2.4.0+
|
22
|
+
|
23
|
+
2016-09-25 Kubo Takehiro <kubo@jiubao.org>
|
24
|
+
* ext/oci8/metadata.c, ext/oci8/oci8.c: Fix load error when
|
25
|
+
GC.stress = true.
|
26
|
+
|
27
|
+
2016-09-11 Kubo Takehiro <kubo@jiubao.org>
|
28
|
+
* ext/oci8/oci8.h: Suppress 'warning: "ALWAYS_INLINE" redefined' when
|
29
|
+
compiled for ruby 2.4.0-preview2.
|
30
|
+
|
31
|
+
2016-05-28 Kubo Takehiro <kubo@jiubao.org>
|
32
|
+
* docs/install-on-osx.md: Update installation document about OS X again.
|
33
|
+
|
34
|
+
2016-05-28 Kubo Takehiro <kubo@jiubao.org>
|
35
|
+
* docs/install-on-osx.md: Update installation document about OS X.
|
36
|
+
|
1
37
|
2016-04-24 Kubo Takehiro <kubo@jiubao.org>
|
2
38
|
* mkpkg-win32.rb: Added to compile mingw32 packages.
|
3
39
|
* dist-files: Updated to include docs/report-installation-issue.md.
|
data/NEWS
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# @markup markdown
|
2
2
|
|
3
|
+
2.2.3
|
4
|
+
=====
|
5
|
+
|
6
|
+
New Features
|
7
|
+
------------
|
8
|
+
|
9
|
+
### Support ruby 2.4.0
|
10
|
+
|
11
|
+
- [Fix invalid value for BigDecimal](https://github.com/kubo/ruby-oci8/issues/144)
|
12
|
+
- Fix load error when `GC.stress = true`.
|
13
|
+
- Suppress warnings caused by integer unification
|
14
|
+
- Suppress warnings outputted by Minitest in ruby 2.4.0
|
15
|
+
- Suppress warnings when compiling with ruby 2.4.0
|
16
|
+
|
3
17
|
2.2.2
|
4
18
|
=====
|
5
19
|
|
data/README.md
CHANGED
data/dist-files
CHANGED
data/docs/install-on-osx.md
CHANGED
@@ -35,34 +35,45 @@ Download Oracle Instant Client Packages
|
|
35
35
|
|
36
36
|
Download the following packages from [Oracle Technology Network][]
|
37
37
|
|
38
|
-
* Instant Client Package - Basic or Basic Lite
|
39
|
-
* Instant Client Package - SDK
|
40
|
-
* Instant Client Package - SQL*Plus (optionally)
|
38
|
+
* Instant Client Package - Basic (`instantclient-basic-macos.x64-12.1.0.2.0.zip`) or Basic Lite (`instantclient-basiclite-macos.x64-12.1.0.2.0.zip`)
|
39
|
+
* Instant Client Package - SDK (`instantclient-sdk-macos.x64-12.1.0.2.0.zip`)
|
40
|
+
* Instant Client Package - SQL*Plus (`instantclient-sdk-macos.x64-12.1.0.2.0.zip`) (optionally)
|
41
41
|
|
42
42
|
Install Oracle Instant Client Packages via Homebrew
|
43
43
|
---------------------------------------------------
|
44
44
|
|
45
|
-
To install `Oracle Instant Client Basic
|
45
|
+
To install `Oracle Instant Client Basic` via [Homebrew][]
|
46
46
|
|
47
|
-
*
|
48
|
-
|
47
|
+
* Copy downloaded zip files to `/Library/Caches/Homebrew`
|
48
|
+
(if the environment variable `HOMEBREW_CACHE`
|
49
49
|
is not set and `$HOME/Library/Caches/Homebrew` doesn't exist.)
|
50
|
+
|
50
51
|
* Run the followining commands:
|
51
52
|
|
52
|
-
brew
|
53
|
-
brew install
|
53
|
+
brew tap InstantClientTap/instantclient
|
54
|
+
brew install instantclient-basic
|
55
|
+
brew install instantclient-sdk
|
56
|
+
brew install instantclient-sqlplus # (optionally)
|
54
57
|
|
55
|
-
|
58
|
+
* Set the environment variable `OCI_DIR` while performing the following installation steps
|
59
|
+
if Homebrew is installed outside `/usr/local`.
|
60
|
+
|
61
|
+
export OCI_DIR=$(brew --prefix)/lib
|
62
|
+
|
63
|
+
To install `Oracle Instant Client Basic Lite` via [Homebrew][]
|
64
|
+
|
65
|
+
* Copy downloaded zip files to `/Library/Caches/Homebrew`
|
66
|
+
(if the environment variable `HOMEBREW_CACHE`
|
67
|
+
is not set and `$HOME/Library/Caches/Homebrew` doesn't exist.)
|
56
68
|
|
57
|
-
* Download *three* instant client packages: `Basic`, `Basic Lite` and `SDK`
|
58
|
-
and put them in `/Library/Caches/Homebrew` (if the environment variable
|
59
|
-
`HOMEBREW_CACHE` is not set and `$HOME/Library/Caches/Homebrew` doesn't exist.)
|
60
69
|
* Run the followining commands:
|
61
70
|
|
62
|
-
brew
|
63
|
-
brew install
|
71
|
+
brew tap InstantClientTap/instantclient
|
72
|
+
brew install instantclient-basiclite
|
73
|
+
brew install instantclient-sdk
|
74
|
+
brew install instantclient-sqlplus --with-basiclite # (optionally)
|
64
75
|
|
65
|
-
* Set the environment variable OCI_DIR while performing the following installation steps
|
76
|
+
* Set the environment variable `OCI_DIR` while performing the following installation steps
|
66
77
|
if Homebrew is installed outside `/usr/local`.
|
67
78
|
|
68
79
|
export OCI_DIR=$(brew --prefix)/lib
|
@@ -74,31 +85,23 @@ If you don't use [Homebrew][], do the following:
|
|
74
85
|
|
75
86
|
Unzip the packages as follows:
|
76
87
|
|
77
|
-
mkdir /opt
|
78
|
-
mkdir /opt/oracle
|
88
|
+
mkdir -p /opt/oracle
|
79
89
|
cd /opt/oracle
|
80
90
|
|
81
91
|
Copy downloaded files to /opt/oracle before running the following commands.
|
82
92
|
|
83
|
-
unzip instantclient-basic-macos.x64-
|
84
|
-
unzip instantclient-sdk-macos.x64-
|
85
|
-
unzip instantclient-sqlplus-macos.x64-
|
93
|
+
unzip instantclient-basic-macos.x64-12.1.0.2.0.zip
|
94
|
+
unzip instantclient-sdk-macos.x64-12.1.0.2.0.zip
|
95
|
+
unzip instantclient-sqlplus-macos.x64-12.1.0.2.0.zip
|
86
96
|
|
87
97
|
Make a symbolic link to link the library.
|
88
98
|
|
89
|
-
cd /opt/oracle/
|
90
|
-
ln -s libclntsh.dylib.
|
91
|
-
|
92
|
-
Fix the library install and identification names using [fix_oralib][] to make them work
|
93
|
-
without `DYLD_LIBRARY_PATH`.
|
94
|
-
|
95
|
-
cd /opt/oracle/instantclient11_2
|
96
|
-
curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb
|
97
|
-
ruby fix_oralib.rb
|
99
|
+
cd /opt/oracle/instantclient_12_1
|
100
|
+
ln -s libclntsh.dylib.12.1 libclntsh.dylib
|
98
101
|
|
99
102
|
Set the environment variable OCI_DIR while performing the following installation steps.
|
100
103
|
|
101
|
-
export OCI_DIR=/opt/oracle/
|
104
|
+
export OCI_DIR=/opt/oracle/instantclient_12_1
|
102
105
|
|
103
106
|
Installation
|
104
107
|
============
|
data/ext/oci8/metadata.c
CHANGED
@@ -259,10 +259,10 @@ void Init_oci8_metadata(VALUE cOCI8)
|
|
259
259
|
{
|
260
260
|
mOCI8Metadata = rb_define_module_under(cOCI8, "Metadata");
|
261
261
|
cOCI8MetadataBase = oci8_define_class_under(mOCI8Metadata, "Base", &oci8_metadata_base_data_type, oci8_metadata_alloc);
|
262
|
-
ptype_to_class = rb_hash_new();
|
263
|
-
class_to_ptype = rb_hash_new();
|
264
262
|
rb_global_variable(&ptype_to_class);
|
265
263
|
rb_global_variable(&class_to_ptype);
|
264
|
+
ptype_to_class = rb_hash_new();
|
265
|
+
class_to_ptype = rb_hash_new();
|
266
266
|
id_at_obj_link = rb_intern("@obj_link");
|
267
267
|
|
268
268
|
rb_define_singleton_method(cOCI8MetadataBase, "register_ptype", metadata_s_register_ptype, 1);
|
data/ext/oci8/oci8.c
CHANGED
@@ -372,8 +372,8 @@ void oci8_do_parse_connect_string(VALUE conn_str, VALUE *user, VALUE *pass, VALU
|
|
372
372
|
{
|
373
373
|
static VALUE re = Qnil;
|
374
374
|
if (NIL_P(re)) {
|
375
|
-
re = rb_eval_string(CONN_STR_REGEX);
|
376
375
|
rb_global_variable(&re);
|
376
|
+
re = rb_eval_string(CONN_STR_REGEX);
|
377
377
|
}
|
378
378
|
OCI8SafeStringValue(conn_str);
|
379
379
|
if (RTEST(rb_reg_match(re, conn_str))) {
|
data/ext/oci8/oci8.h
CHANGED
@@ -139,10 +139,25 @@ struct oci8_data_type_struct {
|
|
139
139
|
#define RB_OBJ_WRITTEN(a, oldv, b) do {(void)oldv;} while (0)
|
140
140
|
#endif
|
141
141
|
|
142
|
+
/* new macros in ruby 2.4.0
|
143
|
+
*/
|
144
|
+
#ifndef ALWAYS_INLINE
|
145
|
+
#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
146
|
+
/* gcc version >= 3.1 */
|
147
|
+
#define ALWAYS_INLINE(x) __attribute__((always_inline)) x
|
148
|
+
#endif
|
149
|
+
#ifdef _MSC_VER
|
150
|
+
/* microsoft c */
|
151
|
+
#define ALWAYS_INLINE(x) __forceinline x
|
152
|
+
#endif
|
153
|
+
#ifndef ALWAYS_INLINE
|
154
|
+
#define ALWAYS_INLINE(x) x
|
155
|
+
#endif
|
156
|
+
#endif /* ALWAYS_INLINE */
|
157
|
+
|
142
158
|
/* macros depends on the compiler.
|
143
159
|
* LIKELY(x) hint for the compiler that 'x' is 1(TRUE) in many cases.
|
144
160
|
* UNLIKELY(x) hint for the compiler that 'x' is 0(FALSE) in many cases.
|
145
|
-
* ALWAYS_INLINE forcely inline the function.
|
146
161
|
*/
|
147
162
|
#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
|
148
163
|
/* gcc version >= 2.96 */
|
@@ -153,14 +168,6 @@ struct oci8_data_type_struct {
|
|
153
168
|
#define LIKELY(x) (x)
|
154
169
|
#define UNLIKELY(x) (x)
|
155
170
|
#endif
|
156
|
-
#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
157
|
-
/* gcc version >= 3.1 */
|
158
|
-
#define ALWAYS_INLINE inline __attribute__((always_inline))
|
159
|
-
#endif
|
160
|
-
#ifdef _MSC_VER
|
161
|
-
/* microsoft c */
|
162
|
-
#define ALWAYS_INLINE __forceinline
|
163
|
-
#endif
|
164
171
|
|
165
172
|
/* macros to access thread-local storage.
|
166
173
|
*
|
@@ -186,27 +193,24 @@ struct oci8_data_type_struct {
|
|
186
193
|
/* utility macros
|
187
194
|
*/
|
188
195
|
#define IS_OCI_ERROR(v) (((v) != OCI_SUCCESS) && ((v) != OCI_SUCCESS_WITH_INFO))
|
189
|
-
#ifdef ALWAYS_INLINE
|
190
196
|
#define TO_ORATEXT to_oratext
|
191
197
|
#define TO_CONST_ORATEXT to_const_oratext
|
192
198
|
#define TO_CHARPTR to_charptr
|
193
|
-
static
|
199
|
+
ALWAYS_INLINE(static OraText *to_oratext(char *c));
|
200
|
+
static inline OraText *to_oratext(char *c)
|
194
201
|
{
|
195
202
|
return (OraText*)c;
|
196
203
|
}
|
197
|
-
static
|
204
|
+
ALWAYS_INLINE(static const OraText *to_const_oratext(const char *c));
|
205
|
+
static inline const OraText *to_const_oratext(const char *c)
|
198
206
|
{
|
199
207
|
return (const OraText*)c;
|
200
208
|
}
|
201
|
-
static
|
209
|
+
ALWAYS_INLINE(static char *to_charptr(OraText *c));
|
210
|
+
static inline char *to_charptr(OraText *c)
|
202
211
|
{
|
203
212
|
return (char*)c;
|
204
213
|
}
|
205
|
-
#else
|
206
|
-
#define TO_ORATEXT(c) ((OraText*)(c))
|
207
|
-
#define TO_CONST_ORATEXT(c) ((const OraText*)(c))
|
208
|
-
#define TO_CHARPTR(c) ((char*)(c))
|
209
|
-
#endif
|
210
214
|
#define RSTRING_ORATEXT(obj) TO_ORATEXT(RSTRING_PTR(obj))
|
211
215
|
#define rb_str_new2_ora(str) rb_str_new2(TO_CHARPTR(str))
|
212
216
|
|
data/ext/oci8/ocinumber.c
CHANGED
@@ -1429,7 +1429,7 @@ static VALUE onum_to_d_real(OCINumber *num, OCIError *errhp)
|
|
1429
1429
|
{
|
1430
1430
|
char buf[64];
|
1431
1431
|
ub4 buf_size = sizeof(buf);
|
1432
|
-
const char *fmt = "FM9.
|
1432
|
+
const char *fmt = "FM9.09999999999999999999999999999999999999EEEE";
|
1433
1433
|
|
1434
1434
|
if (!cBigDecimal) {
|
1435
1435
|
rb_require("bigdecimal");
|
data/lib/oci8/bindtype.rb
CHANGED
@@ -203,10 +203,13 @@ OCI8::BindType::Mapping[String] = OCI8::BindType::String
|
|
203
203
|
OCI8::BindType::Mapping[OraNumber] = OCI8::BindType::OraNumber
|
204
204
|
OCI8::BindType::Mapping['BigDecimal'] = OCI8::BindType::BigDecimal
|
205
205
|
OCI8::BindType::Mapping['Rational'] = OCI8::BindType::Rational
|
206
|
-
OCI8::BindType::Mapping[Fixnum] = OCI8::BindType::Integer
|
207
206
|
OCI8::BindType::Mapping[Float] = OCI8::BindType::Float
|
208
207
|
OCI8::BindType::Mapping[Integer] = OCI8::BindType::Integer
|
209
|
-
|
208
|
+
unless 0.class == Integer
|
209
|
+
# ruby before integer unification
|
210
|
+
OCI8::BindType::Mapping[Fixnum] = OCI8::BindType::Integer
|
211
|
+
OCI8::BindType::Mapping[Bignum] = OCI8::BindType::Integer
|
212
|
+
end
|
210
213
|
OCI8::BindType::Mapping[OraDate] = OCI8::BindType::OraDate
|
211
214
|
OCI8::BindType::Mapping[Time] = OCI8::BindType::Time
|
212
215
|
OCI8::BindType::Mapping[Date] = OCI8::BindType::Date
|
data/lib/oci8/compat.rb
CHANGED
@@ -70,7 +70,7 @@ class OCI8
|
|
70
70
|
constants.each do |name|
|
71
71
|
next if name.to_s.index("SQLT_") != 0
|
72
72
|
val = const_get name.intern
|
73
|
-
if val.is_a?
|
73
|
+
if val.is_a? Integer
|
74
74
|
SQLT_NAMES[val] = name
|
75
75
|
end
|
76
76
|
end
|
@@ -79,6 +79,10 @@ class OCI8
|
|
79
79
|
alias autocommit autocommit?
|
80
80
|
|
81
81
|
class Cursor
|
82
|
+
# @!visibility private
|
83
|
+
# dirty hack to suppress "warning: constant ::Fixnum is deprecated"
|
84
|
+
Fixnum = (0.class == ::Integer) ? ::Integer : ::Fixnum
|
85
|
+
|
82
86
|
def self.select_number_as=(val)
|
83
87
|
if val == Fixnum
|
84
88
|
@@bind_unknown_number = OCI8::BindType::Fixnum
|
data/lib/oci8/oci8.rb
CHANGED
data/lib/oci8/version.rb
CHANGED
data/lib/ruby-oci8.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
if caller[0] !~ /\/bundler\/runtime\.rb:\d+:in `require'/
|
2
|
-
warn "Don't
|
2
|
+
warn "Don't require 'ruby-oci8'. Use \"require 'oci8'\" instead. 'ruby-oci8.rb' was added only for 'Bundler.require'."
|
3
3
|
end
|
4
4
|
require 'oci8'
|
data/test/config.rb
CHANGED
@@ -125,6 +125,13 @@ end
|
|
125
125
|
|
126
126
|
class Minitest::Test
|
127
127
|
|
128
|
+
# @!visibility private
|
129
|
+
# dirty hack to suppress "warning: constant ::Fixnum is deprecated"
|
130
|
+
Fixnum = (0.class == ::Integer) ? ::Integer : ::Fixnum
|
131
|
+
# @!visibility private
|
132
|
+
# dirty hack to suppress "warning: constant ::Bignum is deprecated"
|
133
|
+
Bignum = (0.class == ::Integer) ? ::Integer : ::Bignum
|
134
|
+
|
128
135
|
def get_oci8_connection()
|
129
136
|
OCI8.new($dbuser, $dbpass, $dbname)
|
130
137
|
rescue OCIError
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'oci8'
|
2
|
+
require File.dirname(__FILE__) + '/config'
|
3
|
+
|
4
|
+
class TestBindArray < Minitest::Test
|
5
|
+
|
6
|
+
def test_bind_array_names
|
7
|
+
assert_equal(":id_0", OCI8::in_cond(:id, []).names)
|
8
|
+
assert_equal(":id_0", OCI8::in_cond(:id, [1]).names)
|
9
|
+
assert_equal(":id_0, :id_1", OCI8::in_cond(:id, [1, 2]).names)
|
10
|
+
assert_equal(":id_0, :id_1, :id_2", OCI8::in_cond(:id, [1, 2, 3]).names)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_bind_array_values
|
14
|
+
assert_equal([[nil, String, nil]], OCI8::in_cond(:id, []).values)
|
15
|
+
assert_equal([[1, nil, nil]], OCI8::in_cond(:id, [1]).values)
|
16
|
+
assert_equal([[1, nil, nil], [2, nil, nil]], OCI8::in_cond(:id, [1, 2]).values)
|
17
|
+
assert_equal([[1, nil, nil], [2, nil, nil], [3, nil, nil]], OCI8::in_cond(:id, [1, 2, 3]).values)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_bind_array_values_containg_nil
|
21
|
+
assert_equal([[nil, String]], OCI8::in_cond(:id, [nil]).values)
|
22
|
+
assert_equal([[nil, Fixnum], [2, nil, nil], [3, nil, nil]], OCI8::in_cond(:id, [nil, 2, 3]).values)
|
23
|
+
assert_equal([[1, nil, nil], [nil, Fixnum], [3, nil, nil]], OCI8::in_cond(:id, [1, nil, 3]).values)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_bind_array_values_with_type
|
27
|
+
assert_equal([[nil, Integer, nil]], OCI8::in_cond(:id, [], Integer).values)
|
28
|
+
assert_equal([[1, Integer, nil]], OCI8::in_cond(:id, [1], Integer).values)
|
29
|
+
assert_equal([[1, Integer, nil], [2, Integer, nil]], OCI8::in_cond(:id, [1, 2], Integer).values)
|
30
|
+
assert_equal([[1, Integer, nil], [2, Integer, nil], [3, Integer, nil]], OCI8::in_cond(:id, [1, 2, 3], Integer).values)
|
31
|
+
assert_equal([[nil, Integer, nil], [2, Integer, nil], [3, Integer, nil]], OCI8::in_cond(:id, [nil, 2, 3], Integer).values)
|
32
|
+
assert_equal([[1, Integer, nil], [nil, Integer, nil], [3, Integer, nil]], OCI8::in_cond(:id, [1, nil, 3], Integer).values)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_select
|
36
|
+
@conn = get_oci8_connection
|
37
|
+
begin
|
38
|
+
drop_table('test_table')
|
39
|
+
@conn.exec(<<EOS)
|
40
|
+
CREATE TABLE test_table (ID NUMBER(38))
|
41
|
+
EOS
|
42
|
+
cursor = @conn.parse('insert into test_table values(:1)')
|
43
|
+
cursor.bind_param(1, nil, Integer)
|
44
|
+
[1, 3, 5].each do |id|
|
45
|
+
cursor.exec(id)
|
46
|
+
end
|
47
|
+
cursor.close
|
48
|
+
|
49
|
+
[
|
50
|
+
[],
|
51
|
+
[1],
|
52
|
+
[1, 2],
|
53
|
+
[1, 2, 3],
|
54
|
+
[nil],
|
55
|
+
[nil, 2, 3],
|
56
|
+
[1, nil, 3],
|
57
|
+
].each do |ids|
|
58
|
+
in_cond = OCI8::in_cond(:id, ids)
|
59
|
+
cursor = @conn.exec("select * from test_table where id in (#{in_cond.names}) order by id", *in_cond.values)
|
60
|
+
([1, 3, 5] & ids).each do |id|
|
61
|
+
assert_equal(id, cursor.fetch[0])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
drop_table('test_table')
|
66
|
+
ensure
|
67
|
+
@conn.logoff
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/test/test_clob.rb
CHANGED
data/test/test_metadata.rb
CHANGED
@@ -42,6 +42,8 @@ class TestMetadata < Minitest::Test
|
|
42
42
|
assert(expected_value.call(val), "#{msg} > #{method}")
|
43
43
|
when Regexp
|
44
44
|
assert_match(expected_value, val, "#{msg} > #{method}")
|
45
|
+
when nil
|
46
|
+
assert_nil(val, "#{msg} > #{method}")
|
45
47
|
else
|
46
48
|
assert_equal(expected_value, val, "#{msg} > #{method}")
|
47
49
|
end
|
@@ -1335,7 +1337,6 @@ EOS
|
|
1335
1337
|
drop_type('TEST_TYPE_NESTEAD_TABLE')
|
1336
1338
|
drop_type('TEST_TYPE_CHILD')
|
1337
1339
|
drop_type('TEST_TYPE_PARENT')
|
1338
|
-
expected_values = []
|
1339
1340
|
attrs_map = {}
|
1340
1341
|
|
1341
1342
|
@conn.exec(<<-EOS)
|
data/test/test_object.rb
CHANGED
@@ -237,15 +237,35 @@ class TestObj1 < Minitest::Test
|
|
237
237
|
assert_equal(@nclob_val, nclob_val)
|
238
238
|
assert_equal(@blob_val, blob_val)
|
239
239
|
assert_equal(@obj_val, obj_val)
|
240
|
-
|
240
|
+
if @int_array_val
|
241
|
+
assert_equal(@int_array_val, int_array_val.to_ary)
|
242
|
+
else
|
243
|
+
assert_nil(@int_array_val, int_array_val)
|
244
|
+
end
|
241
245
|
assert_array_in_delta(@flt_array_val, flt_array_val && flt_array_val.to_ary)
|
242
246
|
assert_array_in_delta(@num_array_val, num_array_val && num_array_val.to_ary)
|
243
247
|
assert_array_in_delta(@bdbl_array_val, bdbl_array_val && bdbl_array_val.to_ary)
|
244
248
|
assert_array_in_delta(@bflt_array_val, bflt_array_val && bflt_array_val.to_ary)
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
+
if @str_array_val
|
250
|
+
assert_equal(@str_array_val, str_array_val.to_ary)
|
251
|
+
else
|
252
|
+
assert_nil(str_array_val)
|
253
|
+
end
|
254
|
+
if @raw_array_val
|
255
|
+
assert_equal(@raw_array_val, raw_array_val.to_ary)
|
256
|
+
else
|
257
|
+
assert_nil(raw_array_val)
|
258
|
+
end
|
259
|
+
if @obj_array_val
|
260
|
+
assert_equal(@obj_array_val, obj_array_val.to_ary)
|
261
|
+
else
|
262
|
+
assert_nil(obj_array_val)
|
263
|
+
end
|
264
|
+
if @obj_ary_of_ary_val
|
265
|
+
assert_equal(@obj_ary_of_ary_val, obj_ary_of_ary_val.to_ary.collect { |elem| elem.to_ary })
|
266
|
+
else
|
267
|
+
assert_nil(obj_ary_of_ary_val)
|
268
|
+
end
|
249
269
|
assert_equal(@date_val, date_val)
|
250
270
|
# assert_equal(@date_array_val, date_array_val && date_array_val.to_ary)
|
251
271
|
end
|
@@ -256,6 +276,8 @@ class TestObj1 < Minitest::Test
|
|
256
276
|
exp.each_with_index do |elem, idx|
|
257
277
|
assert_in_delta(elem, val[idx], Delta)
|
258
278
|
end
|
279
|
+
elsif exp.nil?
|
280
|
+
assert_nil(val)
|
259
281
|
else
|
260
282
|
assert_equal(exp, val)
|
261
283
|
end
|
@@ -456,10 +478,26 @@ EOS
|
|
456
478
|
csr.bind_param(:out2, nil, Integer)
|
457
479
|
csr.bind_param(:out3, nil, Integer)
|
458
480
|
csr.exec
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
481
|
+
if ary
|
482
|
+
assert_equal(ary.length, csr[:cnt])
|
483
|
+
else
|
484
|
+
assert_equal(-1, csr[:cnt])
|
485
|
+
end
|
486
|
+
if ary && ary[0]
|
487
|
+
assert_equal(ary[0], csr[:out1])
|
488
|
+
else
|
489
|
+
assert_nil(csr[:out1])
|
490
|
+
end
|
491
|
+
if ary && ary[1]
|
492
|
+
assert_equal(ary[1], csr[:out2])
|
493
|
+
else
|
494
|
+
assert_nil(csr[:out2])
|
495
|
+
end
|
496
|
+
if ary && ary[2]
|
497
|
+
assert_equal(ary[2], csr[:out3])
|
498
|
+
else
|
499
|
+
assert_nil(csr[:out3])
|
500
|
+
end
|
463
501
|
end
|
464
502
|
end
|
465
503
|
|
data/test/test_oci8.rb
CHANGED
@@ -69,7 +69,7 @@ EOS
|
|
69
69
|
cursor.exec
|
70
70
|
assert_equal(test_data1, cursor.fetch[0])
|
71
71
|
assert_equal(test_data2, cursor.fetch[0])
|
72
|
-
|
72
|
+
assert_nil(cursor.fetch[0])
|
73
73
|
assert_equal(test_data4, cursor.fetch[0])
|
74
74
|
cursor.close
|
75
75
|
drop_table('test_table')
|
data/test/test_package_type.rb
CHANGED
@@ -38,6 +38,8 @@ class TestPackageType < Minitest::Test
|
|
38
38
|
val = method.is_a?(Array) ? obj[method[0]] : obj.send(method)
|
39
39
|
if expected_value.is_a? Hash
|
40
40
|
check_attributes("#{msg} > #{method}", val, expected_value)
|
41
|
+
elsif expected_value.nil?
|
42
|
+
assert_nil(val, "#{msg} > #{method}")
|
41
43
|
else
|
42
44
|
assert_equal(expected_value, val, "#{msg} > #{method}")
|
43
45
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 2.2.
|
8
|
+
- 3
|
9
|
+
version: 2.2.3
|
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: 2016-
|
17
|
+
date: 2016-12-27 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- test/test_all.rb
|
115
115
|
- test/test_appinfo.rb
|
116
116
|
- test/test_array_dml.rb
|
117
|
+
- test/test_bind_array.rb
|
117
118
|
- test/test_bind_raw.rb
|
118
119
|
- test/test_bind_string.rb
|
119
120
|
- test/test_bind_time.rb
|