do_oracle 0.10.3-x86-mswin32-60 → 0.10.4.rc1-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/README.markdown +2 -9
- data/Rakefile +11 -46
- data/lib/do_oracle/1.8/do_oracle.so +0 -0
- data/lib/do_oracle/1.9/do_oracle.so +0 -0
- data/lib/do_oracle/version.rb +1 -1
- data/lib/do_oracle.rb +8 -1
- data/spec/command_spec.rb +3 -3
- data/spec/connection_spec.rb +10 -10
- data/spec/encoding_spec.rb +2 -2
- data/spec/reader_spec.rb +2 -2
- data/spec/result_spec.rb +19 -16
- data/spec/spec_helper.rb +14 -5
- data/spec/typecast/array_spec.rb +2 -2
- data/spec/typecast/bigdecimal_spec.rb +3 -3
- data/spec/typecast/boolean_spec.rb +3 -3
- data/spec/typecast/byte_array_spec.rb +7 -4
- data/spec/typecast/class_spec.rb +7 -3
- data/spec/typecast/date_spec.rb +3 -3
- data/spec/typecast/datetime_spec.rb +3 -3
- data/spec/typecast/float_spec.rb +12 -8
- data/spec/typecast/integer_spec.rb +2 -2
- data/spec/typecast/nil_spec.rb +4 -4
- data/spec/typecast/other_spec.rb +2 -2
- data/spec/typecast/range_spec.rb +2 -2
- data/spec/typecast/string_spec.rb +17 -9
- data/spec/typecast/time_spec.rb +17 -9
- data/tasks/compile.rake +11 -13
- data/tasks/spec.rake +8 -19
- metadata +35 -49
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2007 -
|
1
|
+
Copyright (c) 2007 - 2011 Yehuda Katz, Dirkjan Bussink, Raimonds Simanovskis
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.markdown
CHANGED
@@ -18,10 +18,6 @@ An example of usage:
|
|
18
18
|
@reader = @connection.create_command('SELECT * FROM users').execute_reader
|
19
19
|
@reader.next!
|
20
20
|
|
21
|
-
In the future, the `Connection` constructor will be able to be passed either a
|
22
|
-
DataObjects-style URL or JDBC style URL, when using do\_oracle on JRuby. However,
|
23
|
-
this feature is not currently working reliably and is a known issue.
|
24
|
-
|
25
21
|
## Requirements
|
26
22
|
|
27
23
|
This driver is provided for the following platforms:
|
@@ -62,7 +58,7 @@ For more information, see the Oracle driver wiki page:
|
|
62
58
|
## Developers
|
63
59
|
|
64
60
|
Follow the above installation instructions. Additionally, you'll need:
|
65
|
-
* `
|
61
|
+
* `rspec` gem for running specs.
|
66
62
|
* `YARD` gem for generating documentation.
|
67
63
|
|
68
64
|
See the DataObjects wiki for more comprehensive information on installing and
|
@@ -95,10 +91,7 @@ To run specs without compiling extensions first:
|
|
95
91
|
|
96
92
|
To run individual specs:
|
97
93
|
|
98
|
-
rake spec
|
99
|
-
|
100
|
-
(Note that the `rake` task uses a `TEST` parameter, not `SPEC`. This is because
|
101
|
-
the `Rake::TestTask` is used for executing the Bacon specs).
|
94
|
+
rake spec SPEC=spec/connection_spec.rb
|
102
95
|
|
103
96
|
## License
|
104
97
|
|
data/Rakefile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'pathname'
|
2
|
-
require '
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
3
5
|
require 'rake'
|
4
6
|
require 'rake/clean'
|
5
7
|
|
@@ -15,51 +17,14 @@ BINARY_VERSION = '10.2.0.4.0'
|
|
15
17
|
|
16
18
|
CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_oracle/Makefile ext-java/target ])
|
17
19
|
|
18
|
-
begin
|
19
|
-
gem 'jeweler', '~> 1.4'
|
20
|
-
require 'jeweler'
|
21
|
-
|
22
|
-
Jeweler::Tasks.new do |gem|
|
23
|
-
gem.name = 'do_oracle'
|
24
|
-
gem.version = DataObjects::Oracle::VERSION
|
25
|
-
gem.summary = 'DataObjects Oracle Driver'
|
26
|
-
gem.description = 'Implements the DataObjects API for Oracle'
|
27
|
-
gem.platform = Gem::Platform::RUBY
|
28
|
-
gem.files = Dir['lib/**/*.rb', 'spec/**/*.rb', 'tasks/**/*.rake',
|
29
|
-
'ext/**/*.{rb,c,h}', 'LICENSE', 'Rakefile',
|
30
|
-
'*.{markdown,rdoc,txt,yml}']
|
31
|
-
gem.extra_rdoc_files = FileList['README*', 'ChangeLog*', 'INSTALL.markdown',
|
32
|
-
'LICENSE']
|
33
|
-
gem.test_files = FileList['spec/**/*.rb']
|
34
|
-
|
35
|
-
# rake-compiler should generate gemspecs for other platforms (e.g. 'java')
|
36
|
-
# and modify dependencies and extensions appropriately
|
37
|
-
gem.extensions << 'ext/do_oracle/extconf.rb'
|
38
|
-
|
39
|
-
gem.add_dependency 'data_objects', DataObjects::Oracle::VERSION
|
40
|
-
gem.add_dependency 'ruby-oci8', '~>2.0'
|
41
|
-
|
42
|
-
gem.add_development_dependency 'bacon', '~>1.1'
|
43
|
-
gem.add_development_dependency 'rake-compiler', '= 0.7.0'
|
44
20
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
21
|
+
if JRUBY
|
22
|
+
Rake::Task['build'].clear_actions if Rake::Task.task_defined?('build')
|
23
|
+
Rake::Task['install'].clear_actions if Rake::Task.task_defined?('install')
|
24
|
+
task :build => [ :java, :gem ]
|
25
|
+
task :install do
|
26
|
+
sh "#{Config::CONFIG['RUBY_INSTALL_NAME']} -S gem install pkg/do_oracle-#{DataObjects::Oracle::VERSION}-java.gem"
|
49
27
|
end
|
50
|
-
|
51
|
-
if JRUBY
|
52
|
-
Rake::Task['build'].clear_actions if Rake::Task.task_defined?('build')
|
53
|
-
Rake::Task['install'].clear_actions if Rake::Task.task_defined?('install')
|
54
|
-
task :build => [ :java, :gem ]
|
55
|
-
task :install do
|
56
|
-
sh "#{Config::CONFIG['RUBY_INSTALL_NAME']} -S gem install pkg/do_oracle-#{DataObjects::Oracle::VERSION}-java.gem"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
Jeweler::GemcutterTasks.new
|
61
|
-
|
62
|
-
FileList['tasks/**/*.rake'].each { |task| import task }
|
63
|
-
rescue LoadError
|
64
|
-
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
|
65
28
|
end
|
29
|
+
|
30
|
+
FileList['tasks/**/*.rake'].each { |task| import task }
|
Binary file
|
Binary file
|
data/lib/do_oracle/version.rb
CHANGED
data/lib/do_oracle.rb
CHANGED
@@ -21,12 +21,19 @@ end
|
|
21
21
|
require 'do_oracle/version'
|
22
22
|
|
23
23
|
if RUBY_PLATFORM =~ /java/
|
24
|
+
|
25
|
+
module DataObjects
|
26
|
+
module Oracle
|
27
|
+
JDBC_DRIVER = 'oracle.jdbc.OracleDriver'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
24
31
|
# Oracle JDBC driver (ojdbc14.jar or ojdbc5.jar) file should be in JRUBY_HOME/lib or should be in Java class path
|
25
32
|
# Register Oracle JDBC driver
|
26
33
|
begin
|
27
34
|
java.sql.DriverManager.registerDriver Java::oracle.jdbc.OracleDriver.new
|
28
35
|
rescue NameError => e
|
29
|
-
raise
|
36
|
+
raise LoadError, "Cannot load Oracle JDBC driver, put it (ojdbc14.jar or ojdbc5.jar) in JRUBY_HOME/lib or in the java extension directory or include in Java class path or call jruby with the option -J-Djava.ext.dirs=/path/to/directory/with/oracle/jars"
|
30
37
|
end
|
31
38
|
# JDBC driver has transactions implementation in Java
|
32
39
|
|
data/spec/command_spec.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
-
require 'data_objects/spec/command_spec'
|
4
|
+
require 'data_objects/spec/shared/command_spec'
|
5
5
|
|
6
6
|
describe DataObjects::Oracle::Command do
|
7
|
-
|
7
|
+
it_should_behave_like 'a Command'
|
8
8
|
|
9
9
|
if JRUBY
|
10
|
-
|
10
|
+
it_should_behave_like 'a Command with async'
|
11
11
|
else
|
12
12
|
describe 'running queries in parallel' do
|
13
13
|
|
data/spec/connection_spec.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
-
require 'data_objects/spec/connection_spec'
|
4
|
+
require 'data_objects/spec/shared/connection_spec'
|
5
5
|
|
6
6
|
describe DataObjects::Oracle::Connection do
|
7
7
|
|
8
|
-
before do
|
9
|
-
@driver
|
10
|
-
@user
|
8
|
+
before :all do
|
9
|
+
@driver = CONFIG.scheme
|
10
|
+
@user = CONFIG.user
|
11
11
|
@password = CONFIG.pass
|
12
|
-
@host
|
13
|
-
@port
|
12
|
+
@host = CONFIG.host
|
13
|
+
@port = CONFIG.port
|
14
14
|
@database = CONFIG.database
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
it_should_behave_like 'a Connection'
|
18
|
+
it_should_behave_like 'a Connection with authentication support'
|
19
|
+
it_should_behave_like 'a Connection with JDBC URL support' if JRUBY
|
20
|
+
it_should_behave_like 'a Connection via JDNI' if JRUBY
|
21
21
|
end
|
data/spec/encoding_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
# require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
-
# require 'data_objects/spec/encoding_spec'
|
4
|
+
# require 'data_objects/spec/shared/encoding_spec'
|
5
5
|
#
|
6
6
|
# describe DataObjects::Oracle::Connection do
|
7
|
-
#
|
7
|
+
# it_should_behave_like 'a driver supporting different encodings'
|
8
8
|
# end
|
9
9
|
|
10
10
|
|
data/spec/reader_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
-
require 'data_objects/spec/reader_spec'
|
4
|
+
require 'data_objects/spec/shared/reader_spec'
|
5
5
|
|
6
6
|
describe DataObjects::Oracle::Reader do
|
7
|
-
|
7
|
+
it_should_behave_like 'a Reader'
|
8
8
|
end
|
data/spec/result_spec.rb
CHANGED
@@ -1,23 +1,26 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
4
|
-
require 'data_objects/spec/result_spec'
|
4
|
+
require 'data_objects/spec/shared/result_spec'
|
5
5
|
|
6
6
|
describe DataObjects::Oracle::Result do
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def current_sequence_value(seq_name)
|
11
|
-
reader = @connection.create_command("SELECT #{seq_name}.currval FROM dual").execute_reader
|
12
|
-
reader.next!
|
13
|
-
value = reader.values.first
|
14
|
-
reader.close
|
15
|
-
value
|
7
|
+
it_should_behave_like 'a Result'
|
16
8
|
end
|
17
9
|
|
18
10
|
describe DataObjects::Oracle::Result do
|
11
|
+
#include DataObjectsSpecHelpers
|
12
|
+
|
13
|
+
def current_sequence_value(seq_name)
|
14
|
+
reader = @connection.create_command("SELECT #{seq_name}.currval FROM dual").execute_reader
|
15
|
+
reader.next!
|
16
|
+
value = reader.values.first
|
17
|
+
reader.close
|
18
|
+
value
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
+
before :all do
|
22
|
+
setup_test_environment(false)
|
23
|
+
end
|
21
24
|
|
22
25
|
describe 'without using RETURNING' do
|
23
26
|
|
@@ -31,7 +34,7 @@ describe DataObjects::Oracle::Result do
|
|
31
34
|
@connection.close
|
32
35
|
end
|
33
36
|
|
34
|
-
it
|
37
|
+
it { @result.should respond_to(:affected_rows) }
|
35
38
|
|
36
39
|
describe 'affected_rows' do
|
37
40
|
|
@@ -41,12 +44,12 @@ describe DataObjects::Oracle::Result do
|
|
41
44
|
|
42
45
|
end
|
43
46
|
|
44
|
-
it
|
47
|
+
it { @result.should respond_to(:insert_id) }
|
45
48
|
|
46
49
|
describe 'insert_id' do
|
47
50
|
|
48
51
|
it 'should return nil' do
|
49
|
-
@result.insert_id.should
|
52
|
+
@result.insert_id.should be_nil
|
50
53
|
end
|
51
54
|
|
52
55
|
it 'should be retrievable through currval' do
|
@@ -70,7 +73,7 @@ describe DataObjects::Oracle::Result do
|
|
70
73
|
@connection.close
|
71
74
|
end
|
72
75
|
|
73
|
-
it
|
76
|
+
it { @result.should respond_to(:affected_rows) }
|
74
77
|
|
75
78
|
describe 'affected_rows' do
|
76
79
|
|
@@ -80,7 +83,7 @@ describe DataObjects::Oracle::Result do
|
|
80
83
|
|
81
84
|
end
|
82
85
|
|
83
|
-
it
|
86
|
+
it { @result.should respond_to(:insert_id) }
|
84
87
|
|
85
88
|
describe 'insert_id' do
|
86
89
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,7 @@ $TESTING=true
|
|
2
2
|
JRUBY = RUBY_PLATFORM =~ /java/
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
+
require 'rspec'
|
5
6
|
require 'date'
|
6
7
|
require 'ostruct'
|
7
8
|
require 'fileutils'
|
@@ -18,12 +19,14 @@ repo_root = File.expand_path('../../..', __FILE__)
|
|
18
19
|
end
|
19
20
|
|
20
21
|
require 'data_objects'
|
21
|
-
require 'data_objects/spec/
|
22
|
+
require 'data_objects/spec/setup'
|
23
|
+
require 'data_objects/spec/lib/pending_helpers'
|
22
24
|
require 'do_oracle'
|
23
25
|
|
24
26
|
DataObjects::Oracle.logger = DataObjects::Logger.new(STDOUT, :off)
|
25
27
|
at_exit { DataObjects.logger.flush }
|
26
28
|
|
29
|
+
|
27
30
|
# Set default time zone in MRI if not set in environment
|
28
31
|
# as otherwise wrong time zone is set for database connection
|
29
32
|
ENV['TZ'] ||= 'EET' unless JRUBY
|
@@ -36,9 +39,12 @@ CONFIG.host = ENV['DO_ORACLE_HOST'] || 'localhost'
|
|
36
39
|
CONFIG.port = ENV['DO_ORACLE_PORT'] || '1521'
|
37
40
|
CONFIG.database = ENV['DO_ORACLE_DATABASE'] || '/orcl'
|
38
41
|
|
39
|
-
CONFIG.
|
40
|
-
CONFIG.
|
41
|
-
CONFIG.
|
42
|
+
CONFIG.driver = 'oracle'
|
43
|
+
CONFIG.jdbc_driver = DataObjects::Oracle.const_get('JDBC_DRIVER') rescue nil
|
44
|
+
CONFIG.uri = ENV["DO_ORACLE_SPEC_URI"] ||"#{CONFIG.scheme}://#{CONFIG.user}:#{CONFIG.pass}@#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
|
45
|
+
CONFIG.jdbc_uri = "jdbc:oracle:thin:#{CONFIG.user}/#{CONFIG.pass}@//#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
|
46
|
+
CONFIG.sleep = "BEGIN SYS.DBMS_LOCK.sleep(seconds => 1); END;"
|
47
|
+
CONFIG.testsql = "SELECT 1 FROM dual"
|
42
48
|
|
43
49
|
module DataObjectsSpecHelpers
|
44
50
|
|
@@ -191,4 +197,7 @@ module DataObjectsSpecHelpers
|
|
191
197
|
|
192
198
|
end
|
193
199
|
|
194
|
-
|
200
|
+
RSpec.configure do |config|
|
201
|
+
config.include(DataObjectsSpecHelpers)
|
202
|
+
config.include(DataObjects::Spec::PendingHelpers)
|
203
|
+
end
|
data/spec/typecast/array_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/array_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/array_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Array' do
|
7
|
-
|
7
|
+
it_should_behave_like 'supporting Array'
|
8
8
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/bigdecimal_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/bigdecimal_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with BigDecimal' do
|
7
|
-
|
8
|
-
|
7
|
+
it_should_behave_like 'supporting BigDecimal'
|
8
|
+
it_should_behave_like 'supporting BigDecimal autocasting'
|
9
9
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/boolean_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/boolean_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Boolean' do
|
7
|
-
|
8
|
-
|
7
|
+
it_should_behave_like 'supporting Boolean'
|
8
|
+
it_should_behave_like 'supporting Boolean autocasting'
|
9
9
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/byte_array_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/byte_array_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with ByteArray' do
|
7
|
+
include DataObjectsSpecHelpers
|
7
8
|
|
8
|
-
|
9
|
+
before :all do
|
10
|
+
setup_test_environment
|
11
|
+
end
|
9
12
|
|
10
13
|
before do
|
11
14
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
@@ -30,7 +33,7 @@ describe 'DataObjects::Oracle with ByteArray' do
|
|
30
33
|
end
|
31
34
|
|
32
35
|
it 'should return the correctly typed result' do
|
33
|
-
@values.first.should
|
36
|
+
@values.first.should be_kind_of(::Extlib::ByteArray)
|
34
37
|
end
|
35
38
|
|
36
39
|
it 'should return the correct result' do
|
@@ -54,7 +57,7 @@ describe 'DataObjects::Oracle with ByteArray' do
|
|
54
57
|
end
|
55
58
|
|
56
59
|
it 'should return the correctly typed result' do
|
57
|
-
@values.first.should
|
60
|
+
@values.first.should be_kind_of(::Extlib::ByteArray)
|
58
61
|
end
|
59
62
|
|
60
63
|
it 'should return the correct result' do
|
data/spec/typecast/class_spec.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/class_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/class_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Class' do
|
7
7
|
|
8
|
-
|
8
|
+
include DataObjectsSpecHelpers
|
9
|
+
|
10
|
+
before :all do
|
11
|
+
setup_test_environment
|
12
|
+
end
|
9
13
|
|
10
14
|
before do
|
11
15
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
@@ -32,7 +36,7 @@ describe 'DataObjects::Oracle with Class' do
|
|
32
36
|
end
|
33
37
|
|
34
38
|
it 'should return the correctly typed result' do
|
35
|
-
@values.first.should
|
39
|
+
@values.first.should be_kind_of(Class)
|
36
40
|
end
|
37
41
|
|
38
42
|
it 'should return the correct result' do
|
data/spec/typecast/date_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/date_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/date_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Date' do
|
7
|
-
|
7
|
+
it_should_behave_like 'supporting Date'
|
8
8
|
|
9
9
|
# Oracle will cast DATE type to Time
|
10
|
-
#
|
10
|
+
# it_should_behave_like 'supporting Date autocasting'
|
11
11
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/datetime_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/datetime_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with DateTime' do
|
7
|
-
|
8
|
-
#
|
7
|
+
it_should_behave_like 'supporting DateTime'
|
8
|
+
# it_should_behave_like 'supporting DateTime autocasting'
|
9
9
|
end
|
data/spec/typecast/float_spec.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/float_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/float_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Float' do
|
7
|
-
|
8
|
-
#
|
7
|
+
it_should_behave_like 'supporting Float'
|
8
|
+
# it_should_behave_like 'supporting Float autocasting'
|
9
9
|
end
|
10
10
|
|
11
11
|
describe 'DataObjects::Oracle with Float supporting Float autocasting' do
|
12
12
|
|
13
|
-
|
13
|
+
include DataObjectsSpecHelpers
|
14
|
+
|
15
|
+
before :all do
|
16
|
+
setup_test_environment
|
17
|
+
end
|
14
18
|
|
15
19
|
before do
|
16
20
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
@@ -35,13 +39,13 @@ describe 'DataObjects::Oracle with Float supporting Float autocasting' do
|
|
35
39
|
end
|
36
40
|
|
37
41
|
it 'should return the correctly typed result' do
|
38
|
-
@values.first.should
|
39
|
-
@values.last.should
|
42
|
+
@values.first.should be_kind_of(Float)
|
43
|
+
@values.last.should be_kind_of(Float)
|
40
44
|
end
|
41
45
|
|
42
46
|
it 'should return the correct result' do
|
43
|
-
@values.first.should.
|
44
|
-
@values.last.should.
|
47
|
+
@values.first.should be_within(0.000001).of(13.4)
|
48
|
+
@values.last.should be_within(0.000001).of(10.23)
|
45
49
|
end
|
46
50
|
|
47
51
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/integer_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/integer_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Integer' do
|
7
|
-
|
7
|
+
it_should_behave_like 'supporting Integer'
|
8
8
|
end
|
data/spec/typecast/nil_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/nil_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/nil_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Nil' do
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
it_should_behave_like 'supporting Nil'
|
8
|
+
it_should_behave_like 'supporting writing an Nil'
|
9
|
+
it_should_behave_like 'supporting Nil autocasting'
|
10
10
|
end
|
data/spec/typecast/other_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/other_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/other_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::H2 with other (unknown) type' do
|
7
|
-
|
7
|
+
it_should_behave_like 'supporting other (unknown) type'
|
8
8
|
end
|
data/spec/typecast/range_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/range_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/range_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Range' do
|
7
|
-
|
7
|
+
it_should_behave_like 'supporting Range'
|
8
8
|
end
|
@@ -1,15 +1,19 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/string_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/string_spec'
|
5
5
|
|
6
6
|
# describe 'DataObjects::Oracle with String' do
|
7
|
-
#
|
7
|
+
# it_should_behave_like 'supporting String'
|
8
8
|
# end
|
9
9
|
|
10
10
|
describe 'DataObjects::Oracle with String' do
|
11
11
|
|
12
|
-
|
12
|
+
include DataObjectsSpecHelpers
|
13
|
+
|
14
|
+
before :all do
|
15
|
+
setup_test_environment
|
16
|
+
end
|
13
17
|
|
14
18
|
before do
|
15
19
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
@@ -34,7 +38,7 @@ describe 'DataObjects::Oracle with String' do
|
|
34
38
|
end
|
35
39
|
|
36
40
|
it 'should return the correctly typed result' do
|
37
|
-
@values.first.should
|
41
|
+
@values.first.should be_kind_of(String)
|
38
42
|
end
|
39
43
|
|
40
44
|
it 'should return the correct result' do
|
@@ -58,11 +62,11 @@ describe 'DataObjects::Oracle with String' do
|
|
58
62
|
end
|
59
63
|
|
60
64
|
it 'should return the correctly typed result' do
|
61
|
-
@values.first.should
|
65
|
+
@values.first.should be_kind_of(String)
|
62
66
|
end
|
63
67
|
|
64
68
|
it 'should return the correct result' do
|
65
|
-
@values.first.to_f.should.
|
69
|
+
@values.first.to_f.should be_within(0.000001).of(13.4)
|
66
70
|
end
|
67
71
|
|
68
72
|
end
|
@@ -83,7 +87,7 @@ describe 'DataObjects::Oracle with String' do
|
|
83
87
|
|
84
88
|
it 'should return the correct entry' do
|
85
89
|
# Some of the drivers starts autoincrementation from 0 not 1
|
86
|
-
@values.first.should
|
90
|
+
@values.first.should satisfy { |val| val == 1 or val == 2 }
|
87
91
|
end
|
88
92
|
|
89
93
|
end
|
@@ -92,7 +96,11 @@ end
|
|
92
96
|
|
93
97
|
describe 'DataObjects::Oracle with Text' do
|
94
98
|
|
95
|
-
|
99
|
+
include DataObjectsSpecHelpers
|
100
|
+
|
101
|
+
before :all do
|
102
|
+
setup_test_environment
|
103
|
+
end
|
96
104
|
|
97
105
|
before do
|
98
106
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
@@ -117,7 +125,7 @@ describe 'DataObjects::Oracle with Text' do
|
|
117
125
|
end
|
118
126
|
|
119
127
|
it 'should return the correctly typed result' do
|
120
|
-
@values.first.should
|
128
|
+
@values.first.should be_kind_of(String)
|
121
129
|
end
|
122
130
|
|
123
131
|
it 'should return the correct result' do
|
data/spec/typecast/time_spec.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
-
require 'data_objects/spec/typecast/time_spec'
|
4
|
+
require 'data_objects/spec/shared/typecast/time_spec'
|
5
5
|
|
6
6
|
describe 'DataObjects::Oracle with Time' do
|
7
|
-
|
7
|
+
it_should_behave_like 'supporting Time'
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'DataObjects::Oracle with Time' do
|
11
11
|
|
12
|
-
|
12
|
+
include DataObjectsSpecHelpers
|
13
|
+
|
14
|
+
before :all do
|
15
|
+
setup_test_environment
|
16
|
+
end
|
13
17
|
|
14
18
|
before do
|
15
19
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
@@ -34,7 +38,7 @@ describe 'DataObjects::Oracle with Time' do
|
|
34
38
|
end
|
35
39
|
|
36
40
|
it 'should return the correctly typed result' do
|
37
|
-
@values.first.should
|
41
|
+
@values.first.should be_kind_of(Time)
|
38
42
|
end
|
39
43
|
|
40
44
|
it 'should return the correct result' do
|
@@ -49,18 +53,18 @@ end
|
|
49
53
|
|
50
54
|
describe 'DataObjects::Oracle session time zone' do
|
51
55
|
|
52
|
-
after do
|
53
|
-
@connection.close
|
54
|
-
end
|
55
|
-
|
56
56
|
describe 'set from environment' do
|
57
57
|
|
58
58
|
before do
|
59
|
-
pending "set TZ environment shell variable before running this test" unless ENV['TZ']
|
60
59
|
@connection = DataObjects::Connection.new(CONFIG.uri)
|
61
60
|
end
|
62
61
|
|
62
|
+
after do
|
63
|
+
@connection.close
|
64
|
+
end
|
65
|
+
|
63
66
|
it "should have time zone from environment" do
|
67
|
+
pending "set TZ environment shell variable before running this test" unless ENV['TZ']
|
64
68
|
@reader = @connection.create_command("SELECT sessiontimezone FROM dual").execute_reader
|
65
69
|
@reader.next!
|
66
70
|
@reader.values.first.should == ENV['TZ']
|
@@ -74,6 +78,10 @@ describe 'DataObjects::Oracle session time zone' do
|
|
74
78
|
@connection = DataObjects::Connection.new(CONFIG.uri+"?time_zone=CET")
|
75
79
|
end
|
76
80
|
|
81
|
+
after do
|
82
|
+
@connection.close
|
83
|
+
end
|
84
|
+
|
77
85
|
it "should have time zone from connection option" do
|
78
86
|
@reader = @connection.create_command("SELECT sessiontimezone FROM dual").execute_reader
|
79
87
|
@reader.next!
|
data/tasks/compile.rake
CHANGED
@@ -3,24 +3,22 @@ begin
|
|
3
3
|
require 'rake/extensiontask'
|
4
4
|
require 'rake/javaextensiontask'
|
5
5
|
|
6
|
-
# Hack to avoid "allocator undefined for Proc" issue when unpacking Gems:
|
7
|
-
# gemspec provided by Jeweler uses Rake::FileList for files, test_files and
|
8
|
-
# extra_rdoc_files, and procs cannot be marshalled.
|
9
6
|
def gemspec
|
10
|
-
@clean_gemspec ||=
|
7
|
+
@clean_gemspec ||= Gem::Specification::load(File.expand_path('../../do_oracle.gemspec', __FILE__))
|
11
8
|
end
|
12
9
|
|
13
|
-
|
10
|
+
unless JRUBY
|
11
|
+
Rake::ExtensionTask.new('do_oracle', gemspec) do |ext|
|
14
12
|
|
15
|
-
|
13
|
+
ext.lib_dir = "lib/#{gemspec.name}"
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
# automatically add build options to avoid need of manual input
|
16
|
+
if RUBY_PLATFORM =~ /mswin|mingw/ then
|
17
|
+
else
|
18
|
+
ext.cross_compile = true
|
19
|
+
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
20
|
+
end
|
22
21
|
end
|
23
|
-
|
24
22
|
end
|
25
23
|
|
26
24
|
Rake::JavaExtensionTask.new('do_oracle', gemspec) do |ext|
|
@@ -34,7 +32,7 @@ begin
|
|
34
32
|
# Gem::Specification API.
|
35
33
|
gem.dependencies.delete_if { |d| d.name == 'ruby-oci8'}
|
36
34
|
|
37
|
-
gem.add_dependency "do_jdbc", '0.10.
|
35
|
+
gem.add_dependency "do_jdbc", '0.10.4.rc1'
|
38
36
|
end
|
39
37
|
end
|
40
38
|
rescue LoadError
|
data/tasks/spec.rake
CHANGED
@@ -1,23 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspec/core/rake_task'
|
2
2
|
|
3
|
-
|
4
|
-
spec.
|
5
|
-
spec.
|
6
|
-
spec.verbose = true
|
3
|
+
RSpec::Core::RakeTask.new(:spec => [:clean, :compile]) do |spec|
|
4
|
+
spec.pattern = './spec/**/*_spec.rb'
|
5
|
+
spec.skip_bundler = true
|
7
6
|
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
require 'rcov/rcovtask'
|
14
|
-
Rcov::RcovTask.new do |spec|
|
15
|
-
spec.libs << 'spec'
|
16
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
17
|
-
spec.verbose = true
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
task :rcov do
|
21
|
-
abort 'RCov is not available. In order to run rcov, you must: gem install rcov'
|
22
|
-
end
|
8
|
+
RSpec::Core::RakeTask.new(:rcov => [:clean, :compile]) do |rcov|
|
9
|
+
rcov.pattern = "./spec/**/*_spec.rb"
|
10
|
+
rcov.rcov = true
|
11
|
+
rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
|
23
12
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: do_oracle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 977940494
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 10
|
9
|
-
-
|
10
|
-
|
9
|
+
- 4
|
10
|
+
- rc1
|
11
|
+
version: 0.10.4.rc1
|
11
12
|
platform: x86-mswin32-60
|
12
13
|
authors:
|
13
14
|
- Raimonds Simanovskis
|
@@ -15,71 +16,56 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-03-29 00:00:00 +02:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
name: data_objects
|
23
|
-
prerelease: false
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
27
26
|
- - "="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
28
|
+
hash: 977940494
|
30
29
|
segments:
|
31
30
|
- 0
|
32
31
|
- 10
|
33
|
-
-
|
34
|
-
|
32
|
+
- 4
|
33
|
+
- rc1
|
34
|
+
version: 0.10.4.rc1
|
35
35
|
type: :runtime
|
36
|
+
name: data_objects
|
37
|
+
prerelease: false
|
36
38
|
version_requirements: *id001
|
37
39
|
- !ruby/object:Gem::Dependency
|
38
|
-
name: ruby-oci8
|
39
|
-
prerelease: false
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 9
|
46
46
|
segments:
|
47
47
|
- 2
|
48
|
-
-
|
49
|
-
version: "2.
|
50
|
-
type: :
|
48
|
+
- 5
|
49
|
+
version: "2.5"
|
50
|
+
type: :development
|
51
|
+
name: rspec
|
52
|
+
prerelease: false
|
51
53
|
version_requirements: *id002
|
52
54
|
- !ruby/object:Gem::Dependency
|
53
|
-
name: bacon
|
54
|
-
prerelease: false
|
55
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
61
|
-
segments:
|
62
|
-
- 1
|
63
|
-
- 1
|
64
|
-
version: "1.1"
|
65
|
-
type: :development
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: rake-compiler
|
69
|
-
prerelease: false
|
70
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
|
-
requirements:
|
73
|
-
- - "="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
60
|
+
hash: 5
|
76
61
|
segments:
|
77
62
|
- 0
|
78
63
|
- 7
|
79
|
-
|
80
|
-
version: 0.7.0
|
64
|
+
version: "0.7"
|
81
65
|
type: :development
|
82
|
-
|
66
|
+
name: rake-compiler
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *id003
|
83
69
|
description: Implements the DataObjects API for Oracle
|
84
70
|
email: raimonds.simanovskis@gmail.com
|
85
71
|
executables: []
|
@@ -87,14 +73,21 @@ executables: []
|
|
87
73
|
extensions: []
|
88
74
|
|
89
75
|
extra_rdoc_files:
|
90
|
-
- README.markdown
|
91
76
|
- ChangeLog.markdown
|
92
77
|
- INSTALL.markdown
|
93
78
|
- LICENSE
|
79
|
+
- README.markdown
|
94
80
|
files:
|
81
|
+
- ChangeLog.markdown
|
82
|
+
- INSTALL.markdown
|
83
|
+
- LICENSE
|
84
|
+
- README.markdown
|
85
|
+
- Rakefile
|
86
|
+
- ext/do_oracle/do_oracle.c
|
87
|
+
- ext/do_oracle/extconf.rb
|
88
|
+
- lib/do_oracle.rb
|
95
89
|
- lib/do_oracle/transaction.rb
|
96
90
|
- lib/do_oracle/version.rb
|
97
|
-
- lib/do_oracle.rb
|
98
91
|
- spec/command_spec.rb
|
99
92
|
- spec/connection_spec.rb
|
100
93
|
- spec/encoding_spec.rb
|
@@ -119,22 +112,15 @@ files:
|
|
119
112
|
- tasks/release.rake
|
120
113
|
- tasks/retrieve.rake
|
121
114
|
- tasks/spec.rake
|
122
|
-
- ext/do_oracle/extconf.rb
|
123
|
-
- ext/do_oracle/do_oracle.c
|
124
|
-
- LICENSE
|
125
|
-
- Rakefile
|
126
|
-
- ChangeLog.markdown
|
127
|
-
- INSTALL.markdown
|
128
|
-
- README.markdown
|
129
115
|
- lib/do_oracle/1.8/do_oracle.so
|
130
116
|
- lib/do_oracle/1.9/do_oracle.so
|
131
|
-
has_rdoc:
|
117
|
+
has_rdoc: true
|
132
118
|
homepage:
|
133
119
|
licenses: []
|
134
120
|
|
135
121
|
post_install_message:
|
136
|
-
rdoc_options:
|
137
|
-
|
122
|
+
rdoc_options: []
|
123
|
+
|
138
124
|
require_paths:
|
139
125
|
- lib
|
140
126
|
required_ruby_version: !ruby/object:Gem::Requirement
|