jfb 0.5.1 → 1.0.0
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.
- checksums.yaml +4 -4
- data/lib/jfb/{jaybird-2.2.12.jar → jaybird-full-2.2.14.jar} +0 -0
- data/lib/jfb/jfb.rb +50 -5
- data/lib/jfb/version.rb +4 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 491052289fc4051583763f2a4a72a2c3f7dd12e8
|
4
|
+
data.tar.gz: e76743290755e60e18c9c437bb184c793795e652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ab5306f46cb675b31e307c100e5d7c2cbf00fd989cbcbd3c9b623c5186860698907cf9320c3d58d6c2c774e20d0f097106b7316a2cd93fd05d7ce6aa6e981f9
|
7
|
+
data.tar.gz: c8bbf92f189e6e4bdf06d0151cae74c98e50db3a991fd8cfa744af3a526637943183afe5445566775af0fdab33287d4e878fa1b07ceaea5d6dc179188e44d822
|
Binary file
|
data/lib/jfb/jfb.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
require_relative 'jaybird-2.2.
|
1
|
+
require_relative 'jaybird-full-2.2.14.jar'
|
2
2
|
java_import 'java.sql.ResultSet'
|
3
|
+
java_import 'java.sql.Connection'
|
3
4
|
java_import 'java.sql.SQLRecoverableException'
|
4
5
|
|
5
6
|
class JFB
|
@@ -15,7 +16,7 @@ class JFB
|
|
15
16
|
@con = nil
|
16
17
|
end
|
17
18
|
|
18
|
-
def connect()
|
19
|
+
def connect(attr={})
|
19
20
|
if @closed then
|
20
21
|
@con = nil
|
21
22
|
|
@@ -29,7 +30,39 @@ class JFB
|
|
29
30
|
begin
|
30
31
|
@con = @fbd.connect("jdbc:firebirdsql:#{@url}", props)
|
31
32
|
@con.set_auto_commit false
|
32
|
-
|
33
|
+
|
34
|
+
if attr[:holdability] != nil then
|
35
|
+
case attr[:holdability]
|
36
|
+
when :hcoc
|
37
|
+
@con.set_holdability java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT
|
38
|
+
when :ccac
|
39
|
+
@con.set_holdability java.sql.ResultSet.CLOSE_CURSORS_AT_COMMIT
|
40
|
+
else
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if attr[:transaction_isolation] != nil
|
45
|
+
case
|
46
|
+
when :tru
|
47
|
+
@con.set_transaction_isolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED)
|
48
|
+
|
49
|
+
when :trc
|
50
|
+
@con.set_transaction_isolation(java.sql.Connection.TRANSACTION_READ_COMMITTED)
|
51
|
+
|
52
|
+
when :trr
|
53
|
+
@con.set_transaction_isolation(java.sql.Connection.TRANSACTION_REPEATABLE_READ)
|
54
|
+
|
55
|
+
when :ts
|
56
|
+
@con.set_transaction_isolation(java.sql.Connection.TRANSACTION_SERIALIZABLE)
|
57
|
+
|
58
|
+
when :tn
|
59
|
+
@con.set_transaction_isolation(java.sql.Connection.TRANSACTION_NONE)
|
60
|
+
|
61
|
+
else
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
@properties = attr
|
33
66
|
@closed = false
|
34
67
|
|
35
68
|
rescue SQLRecoverableException => erro
|
@@ -49,10 +82,20 @@ class JFB
|
|
49
82
|
end
|
50
83
|
end
|
51
84
|
|
85
|
+
def create_statement()
|
86
|
+
st = @con.createStatement()
|
87
|
+
|
88
|
+
if @properties[:query_timeout] != nil then
|
89
|
+
st.set_query_timeout(@properties[:query_timeout])
|
90
|
+
end
|
91
|
+
|
92
|
+
st
|
93
|
+
end
|
94
|
+
|
52
95
|
def query(cmd)
|
53
96
|
if not @closed then
|
54
97
|
begin
|
55
|
-
return convert_rs_to_array(
|
98
|
+
return convert_rs_to_array(create_statement.executeQuery(cmd))
|
56
99
|
rescue Exception => erro
|
57
100
|
puts "Error message while querying:\n#{erro}\nQuery: #{cmd}"
|
58
101
|
end
|
@@ -64,7 +107,7 @@ class JFB
|
|
64
107
|
def update(cmd)
|
65
108
|
if not @closed then
|
66
109
|
begin
|
67
|
-
|
110
|
+
create_statement.executeUpdate(cmd)
|
68
111
|
rescue Exception => erro
|
69
112
|
puts "Error message while updating:\n#{erro}\nUpdate: #{cmd}"
|
70
113
|
end
|
@@ -116,6 +159,8 @@ class JFB
|
|
116
159
|
k = k + 1
|
117
160
|
end
|
118
161
|
|
162
|
+
rs.close
|
163
|
+
|
119
164
|
res
|
120
165
|
end
|
121
166
|
end
|
data/lib/jfb/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Jfb
|
2
|
-
VERSION = "0.
|
2
|
+
VERSION = "1.0.0"
|
3
3
|
|
4
4
|
#What the numbers mean: rr.ff.hh
|
5
5
|
# rr: Major releases and changes in the project;
|
@@ -63,4 +63,7 @@ module Jfb
|
|
63
63
|
#Version 0.5.1
|
64
64
|
# Implements a simple test to interact with a database in my envyro.
|
65
65
|
# Fixes wrong column refference.
|
66
|
+
|
67
|
+
#Version 1.0.0
|
68
|
+
# Enables setting up of connection, resultset and querie properties.
|
66
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jfb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rCamposCruz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,7 +72,7 @@ files:
|
|
72
72
|
- bin/setup
|
73
73
|
- jfb.gemspec
|
74
74
|
- lib/jfb.rb
|
75
|
-
- lib/jfb/jaybird-2.2.
|
75
|
+
- lib/jfb/jaybird-full-2.2.14.jar
|
76
76
|
- lib/jfb/jfb.rb
|
77
77
|
- lib/jfb/version.rb
|
78
78
|
homepage: https://github.com/rCamposCruz/jfb
|