do_oracle 0.10.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.markdown +3 -0
- data/INSTALL.markdown +5 -0
- data/LICENSE +20 -0
- data/README.markdown +106 -0
- data/Rakefile +65 -0
- data/ext/do_oracle/do_oracle.c +903 -0
- data/ext/do_oracle/extconf.rb +36 -0
- data/lib/do_oracle.rb +133 -0
- 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/transaction.rb +36 -0
- data/lib/do_oracle/version.rb +5 -0
- data/spec/command_spec.rb +53 -0
- data/spec/connection_spec.rb +21 -0
- data/spec/encoding_spec.rb +12 -0
- data/spec/reader_spec.rb +8 -0
- data/spec/result_spec.rb +95 -0
- data/spec/spec_helper.rb +190 -0
- data/spec/typecast/array_spec.rb +8 -0
- data/spec/typecast/bigdecimal_spec.rb +9 -0
- data/spec/typecast/boolean_spec.rb +9 -0
- data/spec/typecast/byte_array_spec.rb +89 -0
- data/spec/typecast/class_spec.rb +64 -0
- data/spec/typecast/date_spec.rb +11 -0
- data/spec/typecast/datetime_spec.rb +9 -0
- data/spec/typecast/float_spec.rb +51 -0
- data/spec/typecast/integer_spec.rb +8 -0
- data/spec/typecast/nil_spec.rb +10 -0
- data/spec/typecast/other_spec.rb +8 -0
- data/spec/typecast/range_spec.rb +8 -0
- data/spec/typecast/string_spec.rb +170 -0
- data/spec/typecast/time_spec.rb +85 -0
- data/tasks/compile.rake +42 -0
- data/tasks/release.rake +16 -0
- data/tasks/retrieve.rake +67 -0
- data/tasks/spec.rake +23 -0
- metadata +151 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
4
|
+
require 'data_objects/spec/typecast/time_spec'
|
5
|
+
|
6
|
+
describe 'DataObjects::Oracle with Time' do
|
7
|
+
behaves_like 'supporting Time'
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'DataObjects::Oracle with Time' do
|
11
|
+
|
12
|
+
setup_test_environment
|
13
|
+
|
14
|
+
before do
|
15
|
+
@connection = DataObjects::Connection.new(CONFIG.uri)
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
@connection.close
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'reading a Time' do
|
23
|
+
|
24
|
+
describe 'with automatic typecasting' do
|
25
|
+
|
26
|
+
before do
|
27
|
+
@reader = @connection.create_command("SELECT release_datetime FROM widgets WHERE ad_description = ?").execute_reader('Buy this product now!')
|
28
|
+
@reader.next!
|
29
|
+
@values = @reader.values
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
@reader.close
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should return the correctly typed result' do
|
37
|
+
@values.first.should.be.kind_of(Time)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should return the correct result' do
|
41
|
+
@values.first.should == Time.local(2008, 2, 14, 00, 31, 12)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'DataObjects::Oracle session time zone' do
|
51
|
+
|
52
|
+
after do
|
53
|
+
@connection.close
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'set from environment' do
|
57
|
+
|
58
|
+
before do
|
59
|
+
pending "set TZ environment shell variable before running this test" unless ENV['TZ']
|
60
|
+
@connection = DataObjects::Connection.new(CONFIG.uri)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should have time zone from environment" do
|
64
|
+
@reader = @connection.create_command("SELECT sessiontimezone FROM dual").execute_reader
|
65
|
+
@reader.next!
|
66
|
+
@reader.values.first.should == ENV['TZ']
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "set with connection string option" do
|
72
|
+
|
73
|
+
before do
|
74
|
+
@connection = DataObjects::Connection.new(CONFIG.uri+"?time_zone=CET")
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should have time zone from connection option" do
|
78
|
+
@reader = @connection.create_command("SELECT sessiontimezone FROM dual").execute_reader
|
79
|
+
@reader.next!
|
80
|
+
@reader.values.first.should == 'CET'
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
data/tasks/compile.rake
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rake-compiler', '~>0.7'
|
3
|
+
require 'rake/extensiontask'
|
4
|
+
require 'rake/javaextensiontask'
|
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
|
+
def gemspec
|
10
|
+
@clean_gemspec ||= eval("#{Rake.application.jeweler.gemspec.to_ruby}") # $SAFE = 3\n
|
11
|
+
end
|
12
|
+
|
13
|
+
Rake::ExtensionTask.new('do_oracle', gemspec) do |ext|
|
14
|
+
|
15
|
+
ext.lib_dir = "lib/#{gemspec.name}"
|
16
|
+
|
17
|
+
# automatically add build options to avoid need of manual input
|
18
|
+
if RUBY_PLATFORM =~ /mswin|mingw/ then
|
19
|
+
else
|
20
|
+
ext.cross_compile = true
|
21
|
+
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
Rake::JavaExtensionTask.new('do_oracle', gemspec) do |ext|
|
27
|
+
ext.lib_dir = "lib/#{gemspec.name}"
|
28
|
+
ext.ext_dir = 'ext-java/src/main/java'
|
29
|
+
ext.debug = ENV.has_key?('DO_JAVA_DEBUG') && ENV['DO_JAVA_DEBUG']
|
30
|
+
ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
|
31
|
+
ext.java_compiling do |gem|
|
32
|
+
|
33
|
+
# Hack: Unfortunately there is no way to remove a dependency in the
|
34
|
+
# Gem::Specification API.
|
35
|
+
gem.dependencies.delete_if { |d| d.name == 'ruby-oci8'}
|
36
|
+
|
37
|
+
gem.add_dependency "do_jdbc", '0.10.1'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
rescue LoadError
|
41
|
+
warn "To compile, install rake-compiler (gem install rake-compiler)"
|
42
|
+
end
|
data/tasks/release.rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
desc 'Builds all gems (native, binaries for JRuby and Windows)'
|
2
|
+
task :build_all do
|
3
|
+
`rake clean`
|
4
|
+
`rake build`
|
5
|
+
`rake java gem`
|
6
|
+
`rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1`
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Release all gems (native, binaries for JRuby and Windows)'
|
10
|
+
task :release_all => :build_all do
|
11
|
+
Dir["pkg/do_oracle-#{DataObjects::Oracle::VERSION}*.gem"].each do |gem_path|
|
12
|
+
command = "gem push #{gem_path}"
|
13
|
+
puts "Executing #{command.inspect}:"
|
14
|
+
sh command
|
15
|
+
end
|
16
|
+
end
|
data/tasks/retrieve.rake
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rake-compiler', '~>0.7'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/extensioncompiler'
|
5
|
+
|
6
|
+
# download mysql library and headers
|
7
|
+
directory "vendor"
|
8
|
+
|
9
|
+
# only on Windows or cross platform compilation
|
10
|
+
def dlltool(dllname, deffile, libfile)
|
11
|
+
# define if we are using GCC or not
|
12
|
+
if Rake::ExtensionCompiler.mingw_gcc_executable then
|
13
|
+
dir = File.dirname(Rake::ExtensionCompiler.mingw_gcc_executable)
|
14
|
+
tool = case RUBY_PLATFORM
|
15
|
+
when /mingw/
|
16
|
+
File.join(dir, 'dlltool.exe')
|
17
|
+
when /linux|darwin/
|
18
|
+
File.join(dir, "#{Rake::ExtensionCompiler.mingw_host}-dlltool")
|
19
|
+
end
|
20
|
+
return "#{tool} --dllname #{dllname} --def #{deffile} --output-lib #{libfile}"
|
21
|
+
else
|
22
|
+
if RUBY_PLATFORM =~ /mswin/ then
|
23
|
+
tool = 'lib.exe'
|
24
|
+
else
|
25
|
+
fail "Unsupported platform for cross-compilation (please, contribute some patches)."
|
26
|
+
end
|
27
|
+
return "#{tool} /DEF:#{deffile} /OUT:#{libfile}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# file "vendor/mysql-noinstall-#{BINARY_VERSION}-win32.zip" => ['vendor'] do |t|
|
32
|
+
# base_version = BINARY_VERSION.gsub(/\.[0-9]+$/, '')
|
33
|
+
# url = "http://mysql.proserve.nl/Downloads/MySQL-#{base_version}/#{File.basename(t.name)}"
|
34
|
+
# when_writing "downloading #{t.name}" do
|
35
|
+
# cd File.dirname(t.name) do
|
36
|
+
# sh "wget -c #{url} || curl -C - -O #{url}"
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# file "vendor/mysql-#{BINARY_VERSION}-win32/include/mysql.h" => ["vendor/mysql-noinstall-#{BINARY_VERSION}-win32.zip"] do |t|
|
42
|
+
# full_file = File.expand_path(t.prerequisites.last)
|
43
|
+
# when_writing "creating #{t.name}" do
|
44
|
+
# cd "vendor" do
|
45
|
+
# sh "unzip #{full_file} mysql-#{BINARY_VERSION}-win32/bin/** mysql-#{BINARY_VERSION}-win32/include/** mysql-#{BINARY_VERSION}-win32/lib/**"
|
46
|
+
# end
|
47
|
+
# # update file timestamp to avoid Rake perform this extraction again.
|
48
|
+
# touch t.name
|
49
|
+
# end
|
50
|
+
# end
|
51
|
+
|
52
|
+
# # clobber vendored packages
|
53
|
+
# CLOBBER.include('vendor')
|
54
|
+
|
55
|
+
# # vendor:mysql
|
56
|
+
# task 'vendor:mysql' => ["vendor/mysql-#{BINARY_VERSION}-win32/include/mysql.h"]
|
57
|
+
#
|
58
|
+
# # hook into cross compilation vendored mysql dependency
|
59
|
+
# if RUBY_PLATFORM =~ /mingw|mswin/ then
|
60
|
+
# Rake::Task['compile'].prerequisites.unshift 'vendor:mysql'
|
61
|
+
# else
|
62
|
+
# if Rake::Task.tasks.map {|t| t.name }.include? 'cross'
|
63
|
+
# Rake::Task['cross'].prerequisites.unshift 'vendor:mysql'
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
rescue LoadError
|
67
|
+
end
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
|
3
|
+
spec_defaults = lambda do |spec|
|
4
|
+
spec.libs << 'lib' << 'spec'
|
5
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
6
|
+
spec.verbose = true
|
7
|
+
end
|
8
|
+
|
9
|
+
Rake::TestTask.new(:spec => [ :clean, :compile ], &spec_defaults)
|
10
|
+
Rake::TestTask.new(:spec_no_compile, &spec_defaults)
|
11
|
+
|
12
|
+
begin
|
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
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: do_oracle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.1
|
5
|
+
platform: x86-mingw32
|
6
|
+
authors:
|
7
|
+
- Raimonds Simanovskis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-09 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: data_objects
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.10.1
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: ruby-oci8
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "2.0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: bacon
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "1.1"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: rake-compiler
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0.7"
|
54
|
+
version:
|
55
|
+
description: Implements the DataObjects API for Oracle
|
56
|
+
email: raimonds.simanovskis@gmail.com
|
57
|
+
executables: []
|
58
|
+
|
59
|
+
extensions: []
|
60
|
+
|
61
|
+
extra_rdoc_files:
|
62
|
+
- README.markdown
|
63
|
+
- ChangeLog.markdown
|
64
|
+
- INSTALL.markdown
|
65
|
+
- LICENSE
|
66
|
+
files:
|
67
|
+
- lib/do_oracle/transaction.rb
|
68
|
+
- lib/do_oracle/version.rb
|
69
|
+
- lib/do_oracle.rb
|
70
|
+
- spec/command_spec.rb
|
71
|
+
- spec/connection_spec.rb
|
72
|
+
- spec/encoding_spec.rb
|
73
|
+
- spec/reader_spec.rb
|
74
|
+
- spec/result_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
- spec/typecast/array_spec.rb
|
77
|
+
- spec/typecast/bigdecimal_spec.rb
|
78
|
+
- spec/typecast/boolean_spec.rb
|
79
|
+
- spec/typecast/byte_array_spec.rb
|
80
|
+
- spec/typecast/class_spec.rb
|
81
|
+
- spec/typecast/date_spec.rb
|
82
|
+
- spec/typecast/datetime_spec.rb
|
83
|
+
- spec/typecast/float_spec.rb
|
84
|
+
- spec/typecast/integer_spec.rb
|
85
|
+
- spec/typecast/nil_spec.rb
|
86
|
+
- spec/typecast/other_spec.rb
|
87
|
+
- spec/typecast/range_spec.rb
|
88
|
+
- spec/typecast/string_spec.rb
|
89
|
+
- spec/typecast/time_spec.rb
|
90
|
+
- tasks/compile.rake
|
91
|
+
- tasks/release.rake
|
92
|
+
- tasks/retrieve.rake
|
93
|
+
- tasks/spec.rake
|
94
|
+
- ext/do_oracle/extconf.rb
|
95
|
+
- ext/do_oracle/do_oracle.c
|
96
|
+
- LICENSE
|
97
|
+
- Rakefile
|
98
|
+
- ChangeLog.markdown
|
99
|
+
- INSTALL.markdown
|
100
|
+
- README.markdown
|
101
|
+
- lib/do_oracle/1.8/do_oracle.so
|
102
|
+
- lib/do_oracle/1.9/do_oracle.so
|
103
|
+
has_rdoc: false
|
104
|
+
homepage:
|
105
|
+
licenses: []
|
106
|
+
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options:
|
109
|
+
- --charset=UTF-8
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: "0"
|
117
|
+
version:
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
version:
|
124
|
+
requirements: []
|
125
|
+
|
126
|
+
rubyforge_project: dorb
|
127
|
+
rubygems_version: 1.3.5
|
128
|
+
signing_key:
|
129
|
+
specification_version: 3
|
130
|
+
summary: DataObjects Oracle Driver
|
131
|
+
test_files:
|
132
|
+
- spec/command_spec.rb
|
133
|
+
- spec/connection_spec.rb
|
134
|
+
- spec/encoding_spec.rb
|
135
|
+
- spec/reader_spec.rb
|
136
|
+
- spec/result_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
- spec/typecast/array_spec.rb
|
139
|
+
- spec/typecast/bigdecimal_spec.rb
|
140
|
+
- spec/typecast/boolean_spec.rb
|
141
|
+
- spec/typecast/byte_array_spec.rb
|
142
|
+
- spec/typecast/class_spec.rb
|
143
|
+
- spec/typecast/date_spec.rb
|
144
|
+
- spec/typecast/datetime_spec.rb
|
145
|
+
- spec/typecast/float_spec.rb
|
146
|
+
- spec/typecast/integer_spec.rb
|
147
|
+
- spec/typecast/nil_spec.rb
|
148
|
+
- spec/typecast/other_spec.rb
|
149
|
+
- spec/typecast/range_spec.rb
|
150
|
+
- spec/typecast/string_spec.rb
|
151
|
+
- spec/typecast/time_spec.rb
|