activerecord-jdbcas400-adapter 1.3.6 → 1.3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/arjdbc/as400/adapter.rb +16 -8
- data/test/test_adapter.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fb163c69c0eeb68c3858a28d84c9597efb2968c
|
4
|
+
data.tar.gz: 2f667ccd270bba1fcb3f1604060eb8e111f36116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f77a9c49b012e0323904c2d1f99d4a44514740587c6df1d51f1c812208713679b274fe3a139894eee5ad3dc1ed1cb38f9e8a1d936b4cc9c3d5a5c4550cd726
|
7
|
+
data.tar.gz: af3d5a03ce0583ed3327a81f155301048aa812de34c1e45605a5f4913922d6beb2bc897f80b4adfe4f52976bb5b46daa02ac4b720106d70a7c2298aa842c4787
|
data/README.md
CHANGED
@@ -4,6 +4,11 @@
|
|
4
4
|
[![Dependency Status](http://img.shields.io/gemnasium/pierrickrouxel/activerecord-jdbcas400-adapter.svg)][gemnasium]
|
5
5
|
[![Code Climate](http://img.shields.io/codeclimate/github/pierrickrouxel/activerecord-jdbcas400-adapter.svg)][codeclimate]
|
6
6
|
|
7
|
+
[gem]: https://rubygems.org/gems/activerecord-jdbcas400-adapter
|
8
|
+
[gemnasium]: https://gemnasium.com/pierrickrouxel/activerecord-jdbcas400-adapter
|
9
|
+
[codeclimate]: https://codeclimate.com/github/pierrickrouxel/activerecord-jdbcas400-adapter
|
10
|
+
|
11
|
+
|
7
12
|
https://github.com/pierrickrouxel/activerecord-jdbcas400-adapter/
|
8
13
|
|
9
14
|
## Description
|
data/lib/arjdbc/as400/adapter.rb
CHANGED
@@ -74,11 +74,10 @@ module ArJdbc
|
|
74
74
|
def execute_and_auto_confirm(sql, name = nil)
|
75
75
|
|
76
76
|
begin
|
77
|
-
execute_system_command('
|
77
|
+
execute_system_command('CHGJOB INQMSGRPY(*SYSRPYL)')
|
78
78
|
execute_system_command("ADDRPYLE SEQNBR(9876) MSGID(CPA32B2) RPY('I')")
|
79
79
|
rescue Exception => e
|
80
|
-
raise "
|
81
|
-
"Do you have authority to do this?\n\n#{e.inspect}"
|
80
|
+
raise unauthorized_error_message("CHGJOB INQMSGRPY(*SYSRPYL) and ADDRPYLE SEQNBR(9876) MSGID(CPA32B2) RPY('I')", e)
|
82
81
|
end
|
83
82
|
|
84
83
|
begin
|
@@ -92,11 +91,10 @@ module ArJdbc
|
|
92
91
|
|
93
92
|
# Ensure default configuration restoration
|
94
93
|
begin
|
95
|
-
execute_system_command('
|
94
|
+
execute_system_command('CHGJOB INQMSGRPY(*DFT)')
|
96
95
|
execute_system_command('RMVRPYLE SEQNBR(9876)')
|
97
96
|
rescue Exception => e
|
98
|
-
raise
|
99
|
-
"Do you have authority to do this?\n\n#{e.inspect}"
|
97
|
+
raise unauthorized_error_message('CHGJOB INQMSGRPY(*DFT) and RMVRPYLE SEQNBR(9876)', e)
|
100
98
|
end
|
101
99
|
|
102
100
|
end
|
@@ -134,10 +132,16 @@ module ArJdbc
|
|
134
132
|
execute_system_command("CHGCURLIB CURLIB(#{current_library})")
|
135
133
|
end
|
136
134
|
|
135
|
+
# Change libraries
|
136
|
+
def change_libraries(libraries)
|
137
|
+
libraries = libraries.nil? || libraries.size < 1 ? '*NONE' :libraries.join(' ')
|
138
|
+
execute_system_command("CHGLIBL LIBL(#{libraries})")
|
139
|
+
end
|
140
|
+
|
137
141
|
def execute_system_command(command)
|
138
142
|
length = command.length
|
139
|
-
command =
|
140
|
-
|
143
|
+
command = quote(command)
|
144
|
+
execute("CALL qsys.qcmdexc(#{command}, CAST(#{length} AS DECIMAL(15, 5)))")
|
141
145
|
end
|
142
146
|
|
143
147
|
# Disable transactions when they are not supported
|
@@ -184,5 +188,9 @@ module ArJdbc
|
|
184
188
|
result['00001']
|
185
189
|
end
|
186
190
|
end
|
191
|
+
|
192
|
+
def unauthorized_error_message(command, exception)
|
193
|
+
"Could not call #{command}.\nDo you have authority to do this?\n\n#{exception.inspect}"
|
194
|
+
end
|
187
195
|
end
|
188
196
|
end
|
data/test/test_adapter.rb
CHANGED
@@ -42,4 +42,11 @@ class TestAdapter < Test::Unit::TestCase
|
|
42
42
|
connection.change_current_library(nil)
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
def test_change_libraries
|
47
|
+
assert_nothing_raised do
|
48
|
+
connection.change_libraries(%w(QGPL QTEMP))
|
49
|
+
connection.change_libraries(nil)
|
50
|
+
end
|
51
|
+
end
|
45
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbcas400-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.6
|
4
|
+
version: 1.3.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sieger, Ola Bini, Pierrick Rouxel and JRuby contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-jdbc-adapter
|