Skip to content

Commit 45b90c7

Browse files
committed
Merge pull request #75 from rsim/refactor/whitespace-reformat-jdbc-conn-and-conn-spec
Whitespace reformat jdbc_connection, connection_spec
2 parents b5bd98d + fff7c2f commit 45b90c7

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

lib/plsql/jdbc_connection.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ def bind_param(arg, value, metadata)
109109
@out_types[arg] = type || ora_value.class
110110
@out_index[arg] = bind_param_index(arg)
111111
if ['TABLE','VARRAY','OBJECT'].include?(metadata[:data_type])
112-
@statement.registerOutParameter(@out_index[arg], @connection.get_java_sql_type(ora_value,type),
112+
@statement.registerOutParameter(@out_index[arg], @connection.get_java_sql_type(ora_value,type),
113113
metadata[:sql_type_name])
114114
else
115115
@statement.registerOutParameter(@out_index[arg],@connection.get_java_sql_type(ora_value,type))
116116
end
117117
end
118118
end
119-
119+
120120
def exec
121121
@statement.execute
122122
end
@@ -128,9 +128,9 @@ def [](key)
128128
def close
129129
@statement.close
130130
end
131-
131+
132132
private
133-
133+
134134
def bind_param_index(key)
135135
return key if key.kind_of? Integer
136136
key = ":#{key.to_s}" unless key.to_s =~ /^:/
@@ -301,7 +301,7 @@ def set_bind_variable(stmt, i, value, type=nil, length=nil, metadata={})
301301
raise ArgumentError, "Don't know how to bind variable with type #{type_symbol}"
302302
end
303303
end
304-
304+
305305
def get_bind_variable(stmt, i, type)
306306
case type.to_s.to_sym
307307
when :Fixnum, :Bignum, :Integer
@@ -337,7 +337,7 @@ def get_ruby_value_from_result_set(rset, i, metadata)
337337
end
338338

339339
def result_set_to_ruby_data_type(column_type, column_type_name)
340-
340+
341341
end
342342

343343
def plsql_to_ruby_data_type(metadata)
@@ -521,7 +521,7 @@ def database_version
521521
end
522522

523523
private
524-
524+
525525
def java_date(value)
526526
value && Java::oracle.sql.DATE.new(value.strftime("%Y-%m-%d %H:%M:%S"))
527527
end
@@ -538,7 +538,7 @@ def ora_number_to_ruby_number(num)
538538
# return BigDecimal instead of Float to avoid rounding errors
539539
num == (num_to_i = num.to_i) ? num_to_i : (num.is_a?(BigDecimal) ? num : BigDecimal.new(num.to_s))
540540
end
541-
541+
542542
end
543-
543+
544544
end

spec/plsql/connection_spec.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
clob = OCI8::CLOB.new(@raw_conn, large_text)
118118
expect(@conn.ora_value_to_ruby_value(clob)).to eq large_text
119119
end
120-
120+
121121
end
122122

123123
# JRuby
@@ -132,19 +132,19 @@
132132
it "should translate PL/SQL NUMBER to Ruby BigDecimal" do
133133
expect(@conn.plsql_to_ruby_data_type(:data_type => "NUMBER", :data_length => 15)).to eq [BigDecimal, nil]
134134
end
135-
135+
136136
it "should translate PL/SQL DATE to Ruby DateTime" do
137137
expect(@conn.plsql_to_ruby_data_type(:data_type => "DATE", :data_length => nil)).to eq [DateTime, nil]
138138
end
139-
139+
140140
it "should translate PL/SQL TIMESTAMP to Ruby Time" do
141141
expect(@conn.plsql_to_ruby_data_type(:data_type => "TIMESTAMP", :data_length => nil)).to eq [Time, nil]
142142
end
143-
143+
144144
it "should not translate Ruby Fixnum when BigDecimal type specified" do
145145
expect(@conn.ruby_value_to_ora_value(100, BigDecimal)).to eq java.math.BigDecimal.new(100)
146146
end
147-
147+
148148
it "should translate Ruby Bignum value to BigDecimal when BigDecimal type specified" do
149149
big_decimal = @conn.ruby_value_to_ora_value(12345678901234567890, BigDecimal)
150150
expect(big_decimal).to eq java.math.BigDecimal.new("12345678901234567890")
@@ -167,7 +167,7 @@
167167
it "should translate Oracle BigDecimal integer value to Fixnum" do
168168
expect(@conn.ora_value_to_ruby_value(BigDecimal("100"))).to eql(100)
169169
end
170-
170+
171171
it "should translate Oracle BigDecimal float value to BigDecimal" do
172172
expect(@conn.ora_value_to_ruby_value(BigDecimal("100.11"))).to eql(BigDecimal("100.11"))
173173
end
@@ -210,7 +210,7 @@
210210
expect(@conn.select_first("SELECT :1,:2,:3,:4,:5 FROM dual",
211211
'abc',123,123.456,@now,@today)).to eq ["abc",123,123.456,@now,Time.parse(@today.to_s)]
212212
end
213-
213+
214214
it "should execute SQL statement with NULL values and return first result" do
215215
@now = Time.local(2008,05,31,23,22,11)
216216
expect(@conn.select_first("SELECT NULL,123,123.456,
@@ -226,7 +226,7 @@
226226
expect(@conn.select_first("SELECT :1,:2,:3,:4,:5 FROM dual",
227227
nil,123,123.456,@now,@today)).to eq [nil,123,123.456,@now,Time.parse(@today.to_s)]
228228
end
229-
229+
230230
end
231231

232232
it "should execute SQL statement and return all results" do
@@ -254,7 +254,7 @@
254254
expect(@conn.select_all("SELECT :1,:2,:3,:4 FROM dual UNION ALL SELECT :1,:2,:3,:4 FROM dual",
255255
'abc',123,123.456,@now,'abc',123,123.456,@now)).to eq [["abc",123,123.456,@now],["abc",123,123.456,@now]]
256256
end
257-
257+
258258
it "should execute SQL statement and yield all results in block" do
259259
@now = Time.local(2008,05,31,23,22,11)
260260
expect(@conn.select_all("SELECT 'abc',123,123.456,
@@ -266,7 +266,7 @@
266266
expect(r).to eq ["abc",123,123.456,@now]
267267
end).to eq 2
268268
end
269-
269+
270270
it "should execute SQL statement with bind parameters and yield all results in block" do
271271
@now = Time.local(2008,05,31,23,22,11)
272272
expect(@conn.select_all("SELECT :1,:2,:3,:4 FROM dual UNION ALL SELECT :1,:2,:3,:4 FROM dual",
@@ -276,7 +276,7 @@
276276
end
277277

278278
end
279-
279+
280280
describe "PL/SQL procedures" do
281281
before(:all) do
282282
@random = rand(1000)
@@ -313,9 +313,9 @@
313313
expect(cursor[":p_date"]).to eq @now
314314
expect(cursor.close).to be_nil
315315
end
316-
316+
317317
end
318-
318+
319319
describe "commit and rollback" do
320320
before(:all) do
321321
expect(@conn.exec("CREATE TABLE test_commit (dummy VARCHAR2(100))")).to be true

0 commit comments

Comments
 (0)