do_oracle 0.10.1-x86-mingw32

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.
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/array_spec'
5
+
6
+ describe 'DataObjects::Oracle with Array' do
7
+ behaves_like 'supporting Array'
8
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/bigdecimal_spec'
5
+
6
+ describe 'DataObjects::Oracle with BigDecimal' do
7
+ behaves_like 'supporting BigDecimal'
8
+ behaves_like 'supporting BigDecimal autocasting'
9
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/boolean_spec'
5
+
6
+ describe 'DataObjects::Oracle with Boolean' do
7
+ behaves_like 'supporting Boolean'
8
+ behaves_like 'supporting Boolean autocasting'
9
+ end
@@ -0,0 +1,89 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/byte_array_spec'
5
+
6
+ describe 'DataObjects::Oracle with ByteArray' do
7
+
8
+ setup_test_environment
9
+
10
+ before do
11
+ @connection = DataObjects::Connection.new(CONFIG.uri)
12
+ end
13
+
14
+ after do
15
+ @connection.close
16
+ end
17
+
18
+ describe 'reading a ByteArray' do
19
+
20
+ describe 'with automatic typecasting' do
21
+
22
+ before do
23
+ @reader = @connection.create_command("SELECT cad_drawing FROM widgets WHERE ad_description = ?").execute_reader('Buy this product now!')
24
+ @reader.next!
25
+ @values = @reader.values
26
+ end
27
+
28
+ after do
29
+ @reader.close
30
+ end
31
+
32
+ it 'should return the correctly typed result' do
33
+ @values.first.should.be.kind_of(::Extlib::ByteArray)
34
+ end
35
+
36
+ it 'should return the correct result' do
37
+ @values.first.should == "CAD \001 \000 DRAWING"
38
+ end
39
+
40
+ end
41
+
42
+ describe 'with manual typecasting' do
43
+
44
+ before do
45
+ @command = @connection.create_command("SELECT cad_drawing FROM widgets WHERE ad_description = ?")
46
+ @command.set_types(::Extlib::ByteArray)
47
+ @reader = @command.execute_reader('Buy this product now!')
48
+ @reader.next!
49
+ @values = @reader.values
50
+ end
51
+
52
+ after do
53
+ @reader.close
54
+ end
55
+
56
+ it 'should return the correctly typed result' do
57
+ @values.first.should.be.kind_of(::Extlib::ByteArray)
58
+ end
59
+
60
+ it 'should return the correct result' do
61
+ @values.first.should == "CAD \001 \000 DRAWING"
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
68
+ describe 'inserting a large binary value' do
69
+
70
+ before do
71
+ @binary_value = ::Extlib::ByteArray.new("\000\001\002\003\004"*1000)
72
+ @result = @connection.create_command("INSERT INTO widgets (cad_drawing) VALUES (?) RETURNING id INTO :insert_id").
73
+ execute_non_query(@binary_value)
74
+ @reader = @connection.create_command("SELECT cad_drawing FROM widgets WHERE id = ?").execute_reader(@result.insert_id)
75
+ @reader.next!
76
+ @values = @reader.values
77
+ end
78
+
79
+ after do
80
+ @reader.close
81
+ end
82
+
83
+ it 'should return the correct entry' do
84
+ @values.first.should == @binary_value
85
+ end
86
+
87
+ end
88
+
89
+ end
@@ -0,0 +1,64 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/class_spec'
5
+
6
+ describe 'DataObjects::Oracle with Class' do
7
+
8
+ setup_test_environment
9
+
10
+ before do
11
+ @connection = DataObjects::Connection.new(CONFIG.uri)
12
+ end
13
+
14
+ after do
15
+ @connection.close
16
+ end
17
+
18
+ describe 'reading a Class' do
19
+
20
+ describe 'with manual typecasting' do
21
+
22
+ before do
23
+ @command = @connection.create_command("SELECT class_name FROM widgets WHERE ad_description = ?")
24
+ @command.set_types(Class)
25
+ @reader = @command.execute_reader('Buy this product now!')
26
+ @reader.next!
27
+ @values = @reader.values
28
+ end
29
+
30
+ after do
31
+ @reader.close
32
+ end
33
+
34
+ it 'should return the correctly typed result' do
35
+ @values.first.should.be.kind_of(Class)
36
+ end
37
+
38
+ it 'should return the correct result' do
39
+ @values.first.should == String
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+
46
+ describe 'writing a Class' do
47
+
48
+ before do
49
+ @reader = @connection.create_command("SELECT class_name FROM widgets WHERE class_name = ?").execute_reader(String)
50
+ @reader.next!
51
+ @values = @reader.values
52
+ end
53
+
54
+ after do
55
+ @reader.close
56
+ end
57
+
58
+ it 'should return the correct entry' do
59
+ @values.first.should == "String"
60
+ end
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/date_spec'
5
+
6
+ describe 'DataObjects::Oracle with Date' do
7
+ behaves_like 'supporting Date'
8
+
9
+ # Oracle will cast DATE type to Time
10
+ # behaves_like 'supporting Date autocasting'
11
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/datetime_spec'
5
+
6
+ describe 'DataObjects::Oracle with DateTime' do
7
+ behaves_like 'supporting DateTime'
8
+ # behaves_like 'supporting DateTime autocasting'
9
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/float_spec'
5
+
6
+ describe 'DataObjects::Oracle with Float' do
7
+ behaves_like 'supporting Float'
8
+ # behaves_like 'supporting Float autocasting'
9
+ end
10
+
11
+ describe 'DataObjects::Oracle with Float supporting Float autocasting' do
12
+
13
+ setup_test_environment
14
+
15
+ before do
16
+ @connection = DataObjects::Connection.new(CONFIG.uri)
17
+ end
18
+
19
+ after do
20
+ @connection.close
21
+ end
22
+
23
+ describe 'reading a Float' do
24
+
25
+ describe 'with automatic typecasting' do
26
+
27
+ before do
28
+ @reader = @connection.create_command("SELECT weight, cost1 FROM widgets WHERE ad_description = ?").execute_reader('Buy this product now!')
29
+ @reader.next!
30
+ @values = @reader.values
31
+ end
32
+
33
+ after do
34
+ @reader.close
35
+ end
36
+
37
+ it 'should return the correctly typed result' do
38
+ @values.first.should.be.kind_of(Float)
39
+ @values.last.should.be.kind_of(Float)
40
+ end
41
+
42
+ it 'should return the correct result' do
43
+ @values.first.should.be.close(13.4, 0.000001)
44
+ @values.last.should.be.close(10.23, 0.000001)
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/integer_spec'
5
+
6
+ describe 'DataObjects::Oracle with Integer' do
7
+ behaves_like 'supporting Integer'
8
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/nil_spec'
5
+
6
+ describe 'DataObjects::Oracle with Nil' do
7
+ behaves_like 'supporting Nil'
8
+ behaves_like 'supporting writing an Nil'
9
+ behaves_like 'supporting Nil autocasting'
10
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/other_spec'
5
+
6
+ describe 'DataObjects::H2 with other (unknown) type' do
7
+ behaves_like 'supporting other (unknown) type'
8
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/range_spec'
5
+
6
+ describe 'DataObjects::Oracle with Range' do
7
+ behaves_like 'supporting Range'
8
+ end
@@ -0,0 +1,170 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
+ require 'data_objects/spec/typecast/string_spec'
5
+
6
+ # describe 'DataObjects::Oracle with String' do
7
+ # behaves_like 'supporting String'
8
+ # end
9
+
10
+ describe 'DataObjects::Oracle with String' 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 String' do
23
+
24
+ describe 'with automatic typecasting' do
25
+
26
+ before do
27
+ @reader = @connection.create_command("SELECT code 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(String)
38
+ end
39
+
40
+ it 'should return the correct result' do
41
+ @values.first.should == "W0000001"
42
+ end
43
+
44
+ end
45
+
46
+ describe 'with manual typecasting' do
47
+
48
+ before do
49
+ @command = @connection.create_command("SELECT weight FROM widgets WHERE ad_description = ?")
50
+ @command.set_types(String)
51
+ @reader = @command.execute_reader('Buy this product now!')
52
+ @reader.next!
53
+ @values = @reader.values
54
+ end
55
+
56
+ after do
57
+ @reader.close
58
+ end
59
+
60
+ it 'should return the correctly typed result' do
61
+ @values.first.should.be.kind_of(String)
62
+ end
63
+
64
+ it 'should return the correct result' do
65
+ @values.first.to_f.should.be.close(13.4, 0.000001)
66
+ end
67
+
68
+ end
69
+
70
+ end
71
+
72
+ describe 'writing a String' do
73
+
74
+ before do
75
+ @reader = @connection.create_command("SELECT id FROM widgets WHERE id = ?").execute_reader("2")
76
+ @reader.next!
77
+ @values = @reader.values
78
+ end
79
+
80
+ after do
81
+ @reader.close
82
+ end
83
+
84
+ it 'should return the correct entry' do
85
+ # Some of the drivers starts autoincrementation from 0 not 1
86
+ @values.first.should.satisfy { |val| val == 1 or val == 2 }
87
+ end
88
+
89
+ end
90
+
91
+ end
92
+
93
+ describe 'DataObjects::Oracle with Text' do
94
+
95
+ setup_test_environment
96
+
97
+ before do
98
+ @connection = DataObjects::Connection.new(CONFIG.uri)
99
+ end
100
+
101
+ after do
102
+ @connection.close
103
+ end
104
+
105
+ describe 'reading a Text' do
106
+
107
+ describe 'with automatic typecasting' do
108
+
109
+ before do
110
+ @reader = @connection.create_command("SELECT whitepaper_text FROM widgets WHERE ad_description = ?").execute_reader('Buy this product now!')
111
+ @reader.next!
112
+ @values = @reader.values
113
+ end
114
+
115
+ after do
116
+ @reader.close
117
+ end
118
+
119
+ it 'should return the correctly typed result' do
120
+ @values.first.should.be.kind_of(String)
121
+ end
122
+
123
+ it 'should return the correct result' do
124
+ @values.first.should == "1234567890"*500
125
+ end
126
+
127
+ end
128
+
129
+ end
130
+
131
+ describe 'inserting a short string to Text column' do
132
+
133
+ before do
134
+ @result = @connection.create_command("INSERT INTO widgets (whitepaper_text) VALUES (?) RETURNING id INTO :insert_id").execute_non_query("short text")
135
+ @reader = @connection.create_command("SELECT whitepaper_text FROM widgets WHERE id = ?").execute_reader(@result.insert_id)
136
+ @reader.next!
137
+ @values = @reader.values
138
+ end
139
+
140
+ after do
141
+ @reader.close
142
+ end
143
+
144
+ it 'should return the correct entry' do
145
+ @values.first.should == "short text"
146
+ end
147
+
148
+ end
149
+
150
+ describe 'inserting a large text to Text column' do
151
+
152
+ before do
153
+ @result = @connection.create_command("INSERT INTO widgets (whitepaper_text) VALUES (?) RETURNING id INTO :insert_id").
154
+ execute_non_query("long text"*1000)
155
+ @reader = @connection.create_command("SELECT whitepaper_text FROM widgets WHERE id = ?").execute_reader(@result.insert_id)
156
+ @reader.next!
157
+ @values = @reader.values
158
+ end
159
+
160
+ after do
161
+ @reader.close
162
+ end
163
+
164
+ it 'should return the correct entry' do
165
+ @values.first.should == "long text"*1000
166
+ end
167
+
168
+ end
169
+
170
+ end