ruby-plsql 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/History.txt +7 -0
- data/README.rdoc +97 -29
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/plsql/connection.rb +85 -11
- data/lib/plsql/jdbc_connection.rb +317 -165
- data/lib/plsql/oci_connection.rb +158 -78
- data/lib/plsql/package.rb +5 -5
- data/lib/plsql/procedure.rb +69 -134
- data/lib/plsql/procedure_call.rb +345 -0
- data/lib/plsql/schema.rb +58 -40
- data/lib/plsql/sequence.rb +49 -0
- data/lib/plsql/sql_statements.rb +61 -0
- data/lib/plsql/table.rb +285 -0
- data/lib/plsql/version.rb +3 -0
- data/lib/ruby-plsql.rb +1 -0
- data/lib/ruby_plsql.rb +7 -40
- data/spec/plsql/connection_spec.rb +40 -24
- data/spec/plsql/procedure_spec.rb +1145 -453
- data/spec/plsql/schema_spec.rb +9 -2
- data/spec/plsql/sequence_spec.rb +67 -0
- data/spec/plsql/sql_statements_spec.rb +109 -0
- data/spec/plsql/table_spec.rb +269 -0
- data/spec/spec_helper.rb +20 -10
- metadata +35 -34
- data/lib/ruby_plsql/version.rb +0 -3
data/spec/spec_helper.rb
CHANGED
@@ -6,32 +6,42 @@ gem "activerecord"
|
|
6
6
|
require "activerecord"
|
7
7
|
gem "activerecord-oracle_enhanced-adapter"
|
8
8
|
|
9
|
-
|
9
|
+
if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby'
|
10
|
+
# gem "ruby-oci8", "=2.0.2"
|
11
|
+
gem "ruby-oci8", ">=2.0.3"
|
12
|
+
end
|
13
|
+
|
14
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
15
|
+
|
16
|
+
require "ruby_plsql"
|
10
17
|
|
11
18
|
DATABASE_NAME = ENV['DATABASE_NAME'] || 'orcl'
|
12
19
|
DATABASE_HOST = ENV['DATABASE_HOST'] || 'localhost'
|
13
20
|
DATABASE_PORT = ENV['DATABASE_PORT'] || 1521
|
14
|
-
|
15
|
-
|
21
|
+
DATABASE_USERS_AND_PASSWORDS = [
|
22
|
+
[ENV['DATABASE_USER'] || 'hr', ENV['DATABASE_PASSWORD'] || 'hr'],
|
23
|
+
[ENV['DATABASE_USER2'] || 'arunit', ENV['DATABASE_PASSWORD2'] || 'arunit']
|
24
|
+
]
|
16
25
|
|
17
|
-
def get_connection
|
26
|
+
def get_connection(user_number = 0)
|
27
|
+
database_user, database_password = DATABASE_USERS_AND_PASSWORDS[user_number]
|
18
28
|
unless defined?(JRUBY_VERSION)
|
19
29
|
begin
|
20
|
-
OCI8.new(
|
30
|
+
OCI8.new(database_user, database_password, DATABASE_NAME)
|
21
31
|
# if connection fails then sleep 5 seconds and retry
|
22
32
|
rescue OCIError
|
23
33
|
sleep 5
|
24
|
-
OCI8.new(
|
34
|
+
OCI8.new(database_user, database_password, DATABASE_NAME)
|
25
35
|
end
|
26
36
|
else
|
27
37
|
begin
|
28
38
|
java.sql.DriverManager.getConnection("jdbc:oracle:thin:@#{DATABASE_HOST}:#{DATABASE_PORT}:#{DATABASE_NAME}",
|
29
|
-
|
39
|
+
database_user, database_password)
|
30
40
|
# if connection fails then sleep 5 seconds and retry
|
31
41
|
rescue NativeException
|
32
42
|
sleep 5
|
33
43
|
java.sql.DriverManager.getConnection("jdbc:oracle:thin:@#{DATABASE_HOST}:#{DATABASE_PORT}:#{DATABASE_NAME}",
|
34
|
-
|
44
|
+
database_user, database_password)
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
@@ -41,6 +51,6 @@ CONNECTION_PARAMS = {
|
|
41
51
|
:database => DATABASE_NAME,
|
42
52
|
:host => DATABASE_HOST,
|
43
53
|
:port => DATABASE_PORT,
|
44
|
-
:username =>
|
45
|
-
:password =>
|
54
|
+
:username => DATABASE_USERS_AND_PASSWORDS[0][0],
|
55
|
+
:password => DATABASE_USERS_AND_PASSWORDS[0][1]
|
46
56
|
}
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
@@ -9,73 +9,67 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-24 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: rspec
|
17
17
|
type: :development
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
23
|
+
version: 1.2.9
|
24
24
|
version:
|
25
|
-
|
26
|
-
name: hoe
|
27
|
-
type: :development
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.8.0
|
34
|
-
version:
|
35
|
-
description: |-
|
25
|
+
description: |
|
36
26
|
ruby-plsql gem provides simple Ruby API for calling Oracle PL/SQL procedures.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
Look ar RSpec tests under spec directory for usage examples.
|
43
|
-
email:
|
44
|
-
- raimonds.simanovskis@gmail.com
|
27
|
+
It could be used both for accessing Oracle PL/SQL API procedures in legacy applications
|
28
|
+
as well as it could be used to create PL/SQL unit tests using Ruby testing libraries.
|
29
|
+
|
30
|
+
email: raimonds.simanovskis@gmail.com
|
45
31
|
executables: []
|
46
32
|
|
47
33
|
extensions: []
|
48
34
|
|
49
35
|
extra_rdoc_files:
|
50
|
-
- History.txt
|
51
|
-
- License.txt
|
52
36
|
- README.rdoc
|
53
37
|
files:
|
38
|
+
- .gitignore
|
54
39
|
- History.txt
|
55
40
|
- License.txt
|
56
41
|
- README.rdoc
|
42
|
+
- Rakefile
|
43
|
+
- VERSION
|
57
44
|
- lib/plsql/connection.rb
|
58
45
|
- lib/plsql/jdbc_connection.rb
|
59
46
|
- lib/plsql/oci_connection.rb
|
60
47
|
- lib/plsql/package.rb
|
61
48
|
- lib/plsql/procedure.rb
|
49
|
+
- lib/plsql/procedure_call.rb
|
62
50
|
- lib/plsql/schema.rb
|
51
|
+
- lib/plsql/sequence.rb
|
52
|
+
- lib/plsql/sql_statements.rb
|
53
|
+
- lib/plsql/table.rb
|
54
|
+
- lib/plsql/version.rb
|
55
|
+
- lib/ruby-plsql.rb
|
63
56
|
- lib/ruby_plsql.rb
|
64
|
-
- lib/ruby_plsql/version.rb
|
65
57
|
- spec/plsql/connection_spec.rb
|
66
58
|
- spec/plsql/package_spec.rb
|
67
59
|
- spec/plsql/procedure_spec.rb
|
68
60
|
- spec/plsql/schema_spec.rb
|
61
|
+
- spec/plsql/sequence_spec.rb
|
62
|
+
- spec/plsql/sql_statements_spec.rb
|
63
|
+
- spec/plsql/table_spec.rb
|
69
64
|
- spec/spec.opts
|
70
65
|
- spec/spec_helper.rb
|
71
66
|
has_rdoc: true
|
72
|
-
homepage: http://
|
67
|
+
homepage: http://github.com/rsim/ruby-plsql
|
73
68
|
licenses: []
|
74
69
|
|
75
70
|
post_install_message:
|
76
71
|
rdoc_options:
|
77
|
-
- --
|
78
|
-
- README.rdoc
|
72
|
+
- --charset=UTF-8
|
79
73
|
require_paths:
|
80
74
|
- lib
|
81
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -92,10 +86,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
86
|
version:
|
93
87
|
requirements: []
|
94
88
|
|
95
|
-
rubyforge_project:
|
96
|
-
rubygems_version: 1.3.
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 1.3.5
|
97
91
|
signing_key:
|
98
92
|
specification_version: 3
|
99
|
-
summary:
|
100
|
-
test_files:
|
101
|
-
|
93
|
+
summary: Ruby API for calling Oracle PL/SQL procedures.
|
94
|
+
test_files:
|
95
|
+
- spec/plsql/connection_spec.rb
|
96
|
+
- spec/plsql/package_spec.rb
|
97
|
+
- spec/plsql/procedure_spec.rb
|
98
|
+
- spec/plsql/schema_spec.rb
|
99
|
+
- spec/plsql/sequence_spec.rb
|
100
|
+
- spec/plsql/sql_statements_spec.rb
|
101
|
+
- spec/plsql/table_spec.rb
|
102
|
+
- spec/spec_helper.rb
|
data/lib/ruby_plsql/version.rb
DELETED