ruby-oci8 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +23 -0
- data/NEWS +13 -0
- data/VERSION +1 -1
- data/ext/oci8/lob.c +4 -0
- data/ext/oci8/oci8.h +4 -0
- data/ext/oci8/oraconf.rb +40 -11
- data/ruby-oci8.spec +1 -1
- data/test/test_clob.rb +21 -0
- metadata +3 -3
data/ChangeLog
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
2009-10-21 KUBO Takehiro <kubo@jiubao.org>
|
2
|
+
* NEWS: add changes between 1.0.6 and 1.0.7.
|
3
|
+
* VERSION: change version to 1.0.7.
|
4
|
+
|
5
|
+
2009-10-04 KUBO Takehiro <kubo@jiubao.org>
|
6
|
+
* ext/oci8/oraconf.rb:
|
7
|
+
1. Fix for ruby 1.8.5 with Oracle 8.x which needs some object
|
8
|
+
files to link with.
|
9
|
+
(reported by Jayson Cena)
|
10
|
+
2. Add additional error message if under the sudo environemnt.
|
11
|
+
3. Print not only error message but also the error backtrace when
|
12
|
+
oraconf.rb fails.
|
13
|
+
|
14
|
+
2009-09-13 KUBO Takehiro <kubo@jiubao.org>
|
15
|
+
* ext/oci8/lob.c, ext/oci8/oci8.h, test/test_clob.rb: Change
|
16
|
+
OCI8::LOB#write to accept an object which is not a String and
|
17
|
+
doesn't respond to 'to_str' as IO#write does.
|
18
|
+
(requested by Christopher Jones)
|
19
|
+
|
20
|
+
2009-09-12 KUBO Takehiro <kubo@jiubao.org>
|
21
|
+
* ext/oci8/oraconf.rb: Fixed to compile for AIX instant clients.
|
22
|
+
(reported by Kazuya Teramoto)
|
23
|
+
|
1
24
|
2009-05-17 KUBO Takehiro <kubo@jiubao.org>
|
2
25
|
* NEWS: add changes between 1.0.5 and 1.0.6.
|
3
26
|
* VERSION: change version to 1.0.6.
|
data/NEWS
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
1.0.7:
|
2
|
+
|
3
|
+
* change OCI8::LOB#write to accept an object which is not a String and
|
4
|
+
doesn't respond to 'to_str' as IO#write does.
|
5
|
+
(requested by Christopher Jones)
|
6
|
+
|
7
|
+
* fix oraconf.rb for AIX instant clients.
|
8
|
+
(reported by Kazuya Teramoto)
|
9
|
+
|
10
|
+
* fix oraconf.rb for ruby 1.8.5 with Oracle 8.x which needs some object
|
11
|
+
files to link with.
|
12
|
+
(reported by Jayson Cena)
|
13
|
+
|
1
14
|
1.0.6:
|
2
15
|
|
3
16
|
* fix a problem when compiling for Oracle 8.0.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.7
|
data/ext/oci8/lob.c
CHANGED
@@ -184,6 +184,10 @@ static VALUE oci8_lob_write(int argc, VALUE *argv, VALUE self)
|
|
184
184
|
Get_Handle(self, h); /* 0 */
|
185
185
|
Check_Handle(vsvc, OCISvcCtx, svch); /* 1 */
|
186
186
|
offset = NUM2UINT(voffset); /* 2 */
|
187
|
+
if (TYPE(vbuf) != T_STRING) {
|
188
|
+
vbuf = rb_obj_as_string(vbuf);
|
189
|
+
}
|
190
|
+
RB_GC_GUARD(vbuf);
|
187
191
|
Get_String(vbuf, buf); /* 3 */
|
188
192
|
csid = NIL_P(vcsid) ? 0 : NUM2INT(vcsid); /* 4 */
|
189
193
|
csfrm = NIL_P(vcsfrm) ? SQLCS_IMPLICIT : NUM2INT(vcsfrm); /* 5 */
|
data/ext/oci8/oci8.h
CHANGED
data/ext/oci8/oraconf.rb
CHANGED
@@ -353,8 +353,10 @@ EOS
|
|
353
353
|
end
|
354
354
|
print <<EOS
|
355
355
|
---------------------------------------------------
|
356
|
-
|
357
|
-
#{$!.to_s}
|
356
|
+
Error Message:
|
357
|
+
#{$!.to_s.gsub(/\n/, "\n ")}
|
358
|
+
Backtrace:
|
359
|
+
#{$!.backtrace.join("\n ")}
|
358
360
|
---------------------------------------------------
|
359
361
|
See:
|
360
362
|
* http://ruby-oci8.rubyforge.org/#{lang}/HowToInstall.html
|
@@ -383,15 +385,16 @@ EOS
|
|
383
385
|
# get library load path names
|
384
386
|
oci_basename = 'libclntsh'
|
385
387
|
oci_glob_postfix = '.[0-9]*'
|
386
|
-
|
388
|
+
nls_data_basename = ['libociei', 'libociicus']
|
387
389
|
@@ld_envs = %w[LD_LIBRARY_PATH]
|
388
390
|
so_ext = 'so'
|
391
|
+
nls_data_ext = nil
|
389
392
|
check_proc = nil
|
390
393
|
case RUBY_PLATFORM
|
391
394
|
when /mswin32|cygwin|mingw32|bccwin32/
|
392
395
|
oci_basename = 'oci'
|
393
396
|
oci_glob_postfix = ''
|
394
|
-
|
397
|
+
nls_data_basename = ['oraociei11', 'oraociicus11', 'oraociei10', 'oraociicus10']
|
395
398
|
@@ld_envs = %w[PATH]
|
396
399
|
so_ext = 'dll'
|
397
400
|
when /i.86-linux/
|
@@ -434,6 +437,7 @@ EOS
|
|
434
437
|
oci_glob_postfix = ''
|
435
438
|
@@ld_envs = %w[LIBPATH]
|
436
439
|
so_ext = 'a'
|
440
|
+
nls_data_ext = 'so'
|
437
441
|
when /hppa.*-hpux/
|
438
442
|
if [0].pack('l!').length == 4
|
439
443
|
@@ld_envs = %w[SHLIB_PATH]
|
@@ -529,8 +533,9 @@ EOS
|
|
529
533
|
end
|
530
534
|
|
531
535
|
if ld_path
|
532
|
-
|
533
|
-
|
536
|
+
nls_data_ext ||= so_ext # nls_data_ext is same with so_ext by default.
|
537
|
+
nls_data_basename.each do |basename|
|
538
|
+
if File.exist?(File.join(ld_path, "#{basename}.#{nls_data_ext}"))
|
534
539
|
puts " #{file} looks like an instant client."
|
535
540
|
return ld_path
|
536
541
|
end
|
@@ -613,6 +618,7 @@ You need /usr/include/sys/types.h to compile ruby-oci8.
|
|
613
618
|
EOS
|
614
619
|
end
|
615
620
|
puts "ok"
|
621
|
+
$stdout.flush
|
616
622
|
end # check_ruby_header
|
617
623
|
|
618
624
|
def try_link_oci
|
@@ -860,10 +866,33 @@ EOS
|
|
860
866
|
def get_home
|
861
867
|
oracle_home = ENV['ORACLE_HOME']
|
862
868
|
if oracle_home.nil?
|
863
|
-
|
869
|
+
msg = <<EOS
|
864
870
|
Set the environment variable ORACLE_HOME if Oracle Full Client.
|
865
871
|
Append the path of Oracle client libraries to #{OraConf.ld_envs[0]} if Oracle Instant Client.
|
866
872
|
EOS
|
873
|
+
|
874
|
+
# check sudo environment
|
875
|
+
sudo_command = ENV['SUDO_COMMAND']
|
876
|
+
if /\w*make\b/ =~ sudo_command
|
877
|
+
msg += <<EOS
|
878
|
+
|
879
|
+
The 'sudo' command unset some environment variables for security reasons.
|
880
|
+
Use it only when running 'make install' as follows
|
881
|
+
make
|
882
|
+
sudo make install
|
883
|
+
EOS
|
884
|
+
end
|
885
|
+
if /\w+\/gem\b/ =~ sudo_command
|
886
|
+
msg += <<EOS
|
887
|
+
|
888
|
+
The 'sudo' command unset some environment variables for security reasons.
|
889
|
+
Pass required varialbes as follows
|
890
|
+
sudo env #{OraConf.ld_envs[0]}=$#{OraConf.ld_envs[0]} #{sudo_command}
|
891
|
+
or
|
892
|
+
sudo env ORACLE_HOME=$ORACLE_HOME #{sudo_command}
|
893
|
+
EOS
|
894
|
+
end
|
895
|
+
raise msg
|
867
896
|
end
|
868
897
|
oracle_home
|
869
898
|
end
|
@@ -953,10 +982,10 @@ EOS
|
|
953
982
|
|
954
983
|
# monkey patching!
|
955
984
|
Object.module_eval do
|
956
|
-
alias :
|
957
|
-
def link_command(
|
958
|
-
|
959
|
-
|
985
|
+
alias :link_command_pre_oci8 :link_command
|
986
|
+
def link_command(*args)
|
987
|
+
args[1] = "" if args[1] == $libs
|
988
|
+
link_command_pre_oci8(*args)
|
960
989
|
end
|
961
990
|
end
|
962
991
|
|
data/ruby-oci8.spec
CHANGED
data/test/test_clob.rb
CHANGED
@@ -64,6 +64,27 @@ class TestCLob < RUNIT::TestCase
|
|
64
64
|
lob.free()
|
65
65
|
end
|
66
66
|
|
67
|
+
def test_insert_symbol
|
68
|
+
filename = 'test_symbol'
|
69
|
+
value = :foo_bar
|
70
|
+
@stmt.prepare("DELETE FROM test_clob WHERE filename = :1")
|
71
|
+
@stmt.bindByPos(1, String, filename.size).set(filename)
|
72
|
+
@stmt.execute(@svc)
|
73
|
+
|
74
|
+
@stmt.prepare("INSERT INTO test_clob(filename, content) VALUES (:1, EMPTY_CLOB())")
|
75
|
+
@stmt.bindByPos(1, String, filename.size).set(filename)
|
76
|
+
@stmt.execute(@svc)
|
77
|
+
|
78
|
+
lob = @env.alloc(OCILobLocator)
|
79
|
+
@stmt.prepare("SELECT content FROM test_clob WHERE filename = :1 FOR UPDATE")
|
80
|
+
@stmt.bindByPos(1, String, filename.size).set(filename)
|
81
|
+
@stmt.defineByPos(1, OCI_TYPECODE_CLOB, lob)
|
82
|
+
@stmt.execute(@svc, 1)
|
83
|
+
lob.write(@svc, 1, value)
|
84
|
+
assert_equal(value.to_s, lob.read(@svc, 1, 30))
|
85
|
+
lob.free()
|
86
|
+
end
|
87
|
+
|
67
88
|
def test_read
|
68
89
|
filename = File.basename($lobfile)
|
69
90
|
test_insert() # first insert data.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-oci8
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KUBO Takehiro
|
@@ -9,7 +9,7 @@ autorequire: oci8
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-21 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements: []
|
119
119
|
|
120
120
|
rubyforge_project: ruby-oci8
|
121
|
-
rubygems_version: 1.
|
121
|
+
rubygems_version: 1.2.0
|
122
122
|
signing_key:
|
123
123
|
specification_version: 2
|
124
124
|
summary: Ruby interface for Oracle using OCI8 API
|