ruby-plsql 0.2.0 → 0.2.1
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.
- data/History.txt +9 -0
- data/README.txt +6 -1
- data/lib/plsql/connection.rb +48 -0
- data/lib/plsql/procedure.rb +12 -6
- data/lib/ruby_plsql.rb +4 -0
- data/lib/ruby_plsql/version.rb +1 -1
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/txt2html +0 -0
- data/spec/plsql/schema_spec.rb +18 -0
- data/website/index.html +1 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.2.1 2008-07-22
|
2
|
+
|
3
|
+
* Improvements
|
4
|
+
* Implemented plsql.commit and plsql.rollback methods which call corresponding Connection methods.
|
5
|
+
In addition plsql.connection.autocommit= and plsql.connection.autocommit? methods are added.
|
6
|
+
* Bug fixes
|
7
|
+
* Fixed loading of ojdbc14.jar from PATH directory
|
8
|
+
* Workaround for slow SELECT from all_arguments in Oracle 10gR2
|
9
|
+
|
1
10
|
== 0.2.0 2008-06-26
|
2
11
|
|
3
12
|
* New features
|
data/README.txt
CHANGED
@@ -4,7 +4,9 @@
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
ruby-plsql gem provides simple Ruby API for calling Oracle PL/SQL procedures.
|
7
|
+
ruby-plsql gem provides simple Ruby API for calling Oracle PL/SQL procedures.
|
8
|
+
ruby-plsql support both MRI and JRuby runtime environments.
|
9
|
+
This gem requires ruby-oci8 library (if MRI is used) or Oracle JDBC driver (ojdbc14.jar) (if JRuby is used) for connection to Oracle database.
|
8
10
|
|
9
11
|
See http://blog.rayapps.com for more information.
|
10
12
|
|
@@ -34,7 +36,10 @@ plsql.logoff
|
|
34
36
|
|
35
37
|
== REQUIREMENTS:
|
36
38
|
|
39
|
+
MRI
|
37
40
|
* Requires ruby-oci8 library to connect to Oracle
|
41
|
+
JRuby
|
42
|
+
* Requires Oracle JDBC driver (ojdbc14.jar should be somewhere in PATH) to connect to Oracle
|
38
43
|
|
39
44
|
== INSTALL:
|
40
45
|
|
data/lib/plsql/connection.rb
CHANGED
@@ -30,6 +30,22 @@ module PLSQL
|
|
30
30
|
raise NoMethodError, "Not implemented for this raw driver"
|
31
31
|
end
|
32
32
|
|
33
|
+
def commit
|
34
|
+
raise NoMethodError, "Not implemented for this raw driver"
|
35
|
+
end
|
36
|
+
|
37
|
+
def rollback
|
38
|
+
raise NoMethodError, "Not implemented for this raw driver"
|
39
|
+
end
|
40
|
+
|
41
|
+
def autocommit?
|
42
|
+
raise NoMethodError, "Not implemented for this raw driver"
|
43
|
+
end
|
44
|
+
|
45
|
+
def autocommit=(value)
|
46
|
+
raise NoMethodError, "Not implemented for this raw driver"
|
47
|
+
end
|
48
|
+
|
33
49
|
def select_first(sql, *bindvars)
|
34
50
|
raise NoMethodError, "Not implemented for this raw driver"
|
35
51
|
end
|
@@ -53,7 +69,23 @@ module PLSQL
|
|
53
69
|
def logoff
|
54
70
|
raw_connection.logoff
|
55
71
|
end
|
72
|
+
|
73
|
+
def commit
|
74
|
+
raw_connection.commit
|
75
|
+
end
|
76
|
+
|
77
|
+
def rollback
|
78
|
+
raw_connection.rollback
|
79
|
+
end
|
56
80
|
|
81
|
+
def autocommit?
|
82
|
+
raw_connection.autocommit?
|
83
|
+
end
|
84
|
+
|
85
|
+
def autocommit=(value)
|
86
|
+
raw_connection.autocommit = value
|
87
|
+
end
|
88
|
+
|
57
89
|
def select_first(sql, *bindvars)
|
58
90
|
cursor = raw_connection.exec(sql, *bindvars)
|
59
91
|
result = cursor.fetch
|
@@ -185,6 +217,22 @@ module PLSQL
|
|
185
217
|
false
|
186
218
|
end
|
187
219
|
|
220
|
+
def commit
|
221
|
+
raw_connection.commit
|
222
|
+
end
|
223
|
+
|
224
|
+
def rollback
|
225
|
+
raw_connection.rollback
|
226
|
+
end
|
227
|
+
|
228
|
+
def autocommit?
|
229
|
+
raw_connection.getAutoCommit
|
230
|
+
end
|
231
|
+
|
232
|
+
def autocommit=(value)
|
233
|
+
raw_connection.setAutoCommit(value)
|
234
|
+
end
|
235
|
+
|
188
236
|
def select_first(sql, *bindvars)
|
189
237
|
stmt = prepare_statement(sql, *bindvars)
|
190
238
|
rset = stmt.executeQuery
|
data/lib/plsql/procedure.rb
CHANGED
@@ -34,16 +34,22 @@ module PLSQL
|
|
34
34
|
@out_list = {}
|
35
35
|
@return = {}
|
36
36
|
@overloaded = false
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
# RSI: due to 10gR2 all_arguments performance issue SELECT spllit into two statements
|
38
|
+
object_id = @schema.connection.select_first("
|
39
|
+
SELECT o.object_id
|
40
|
+
FROM all_objects o
|
40
41
|
WHERE o.owner = :owner
|
41
42
|
AND o.object_name = :object_name
|
42
|
-
|
43
|
-
|
43
|
+
", @schema.schema_name, @package ? @package : @procedure
|
44
|
+
)[0] rescue nil
|
45
|
+
num_rows = @schema.connection.select_all("
|
46
|
+
SELECT a.argument_name, a.position, a.data_type, a.in_out, a.data_length, a.data_precision, a.data_scale, a.overload
|
47
|
+
FROM all_arguments a
|
48
|
+
WHERE a.object_id = :object_id
|
49
|
+
AND a.owner = :owner
|
44
50
|
AND a.object_name = :procedure_name
|
45
51
|
AND NVL(a.package_name,'nil') = :package
|
46
|
-
", @schema.schema_name, @
|
52
|
+
", object_id, @schema.schema_name, @procedure, @package ? @package : 'nil'
|
47
53
|
) do |r|
|
48
54
|
|
49
55
|
argument_name, position, data_type, in_out, data_length, data_precision, data_scale, overload = r
|
data/lib/ruby_plsql.rb
CHANGED
@@ -15,6 +15,10 @@ unless defined?(JRUBY_VERSION)
|
|
15
15
|
else
|
16
16
|
begin
|
17
17
|
require "java"
|
18
|
+
require "jruby"
|
19
|
+
# Adds JRuby classloader to current thread classloader - as a result ojdbc14.jar should not be in $JRUBY_HOME/lib
|
20
|
+
java.lang.Thread.currentThread.setContextClassLoader(JRuby.runtime.jruby_class_loader)
|
21
|
+
|
18
22
|
ojdbc_jar = "ojdbc14.jar"
|
19
23
|
if ojdbc_jar_path = ENV["PATH"].split(":").find{|d| File.exists?(File.join(d,ojdbc_jar))}
|
20
24
|
require File.join(ojdbc_jar_path,ojdbc_jar)
|
data/lib/ruby_plsql/version.rb
CHANGED
data/script/destroy
CHANGED
File without changes
|
data/script/generate
CHANGED
File without changes
|
data/script/txt2html
CHANGED
File without changes
|
data/spec/plsql/schema_spec.rb
CHANGED
@@ -68,4 +68,22 @@ describe "Named Schema" do
|
|
68
68
|
lambda { plsql.hr.hr }.should raise_error(ArgumentError)
|
69
69
|
end
|
70
70
|
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "Schema commit and rollback" do
|
74
|
+
before(:all) do
|
75
|
+
plsql.connection = @conn = get_connection
|
76
|
+
end
|
77
|
+
|
78
|
+
after(:all) do
|
79
|
+
plsql.connection.logoff
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should do commit" do
|
83
|
+
plsql.commit
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should do rollback" do
|
87
|
+
plsql.rollback
|
88
|
+
end
|
71
89
|
end
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Ruby API for PL/SQL</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ruby-plsql"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/ruby-plsql" class="numbers">0.2.
|
36
|
+
<a href="http://rubyforge.org/projects/ruby-plsql" class="numbers">0.2.1</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘ruby-plsql’</h1>
|
39
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-plsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-07-22 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
requirements: []
|
84
84
|
|
85
85
|
rubyforge_project: ruby-plsql
|
86
|
-
rubygems_version: 1.0
|
86
|
+
rubygems_version: 1.2.0
|
87
87
|
signing_key:
|
88
88
|
specification_version: 2
|
89
89
|
summary: ruby-plsql gem provides simple Ruby API for calling Oracle PL/SQL procedures.
|