jdbc-helper 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -22,16 +22,20 @@ class ParameterizedStatement
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def set_param(idx, param)
|
25
|
-
if param.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
@java_obj.send setter, idx,
|
30
|
-
|
31
|
-
@java_obj.send setter, idx,
|
32
|
-
|
33
|
-
|
25
|
+
if setter = (JDBCHelper::Connection::SETTER_MAP[param.class] ||
|
26
|
+
JDBCHelper::Connection::SETTER_MAP[param.class.to_s])
|
27
|
+
case setter
|
28
|
+
when :setNull
|
29
|
+
return @java_obj.send setter, idx, java.sql.Types::NULL
|
30
|
+
when :setBinaryStream
|
31
|
+
return @java_obj.send setter, idx, param.getBinaryStream, param.length
|
32
|
+
when :setTimestamp
|
33
|
+
if param.kind_of?(Time)
|
34
|
+
return @java_obj.send setter, idx, java.sql.Timestamp.new(param.to_i * 1000)
|
35
|
+
end
|
34
36
|
end
|
37
|
+
|
38
|
+
@java_obj.send setter, idx, param
|
35
39
|
else
|
36
40
|
@java_obj.set_string idx, param.to_s
|
37
41
|
end
|
@@ -13,16 +13,18 @@ class Connection
|
|
13
13
|
|
14
14
|
SETTER_MAP =
|
15
15
|
{
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
Fixnum => :setInt,
|
17
|
+
String => :setString,
|
18
|
+
NilClass => :setNull,
|
19
|
+
Float => :setDouble,
|
20
|
+
|
19
21
|
# See there's a caveat. Check out ParameterizedStatement#set_param
|
20
|
-
|
22
|
+
Time => :setTimestamp,
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
Java::JavaSql::Date => :setDate,
|
25
|
+
Java::JavaSql::Time => :setTime,
|
26
|
+
Java::JavaSql::Timestamp => :setTimestamp,
|
27
|
+
Java::JavaSql::Blob => :setBinaryStream,
|
26
28
|
|
27
29
|
#########
|
28
30
|
# MySQL #
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jdbc-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Junegunn Choi
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-28 00:00:00 +09:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|