ruby-plsql 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -2
- data/Gemfile +14 -0
- data/History.txt +8 -0
- data/Rakefile +4 -3
- data/VERSION +1 -1
- data/lib/plsql/connection.rb +14 -1
- data/lib/plsql/jdbc_connection.rb +5 -0
- data/lib/plsql/procedure.rb +2 -2
- data/lib/plsql/schema.rb +4 -4
- data/ruby-plsql.gemspec +101 -0
- data/spec/plsql/connection_spec.rb +2 -2
- data/spec/plsql/package_spec.rb +1 -1
- data/spec/plsql/procedure_spec.rb +67 -4
- data/spec/plsql/schema_spec.rb +11 -1
- data/spec/plsql/sequence_spec.rb +1 -1
- data/spec/plsql/sql_statements_spec.rb +2 -2
- data/spec/plsql/table_spec.rb +2 -2
- data/spec/plsql/type_spec.rb +1 -1
- data/spec/plsql/variable_spec.rb +2 -2
- data/spec/plsql/version_spec.rb +1 -1
- data/spec/plsql/view_spec.rb +2 -2
- data/spec/spec_helper.rb +26 -14
- metadata +27 -14
data/.gitignore
CHANGED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'jeweler'
|
4
|
+
gem 'rspec', "~> 1.3.0"
|
5
|
+
|
6
|
+
unless ENV['NO_ACTIVERECORD']
|
7
|
+
# avoid loading activerecord 3.0 beta
|
8
|
+
gem 'activerecord', '=2.3.8'
|
9
|
+
gem 'activerecord-oracle_enhanced-adapter', '=1.3.1'
|
10
|
+
end
|
11
|
+
|
12
|
+
if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby'
|
13
|
+
gem 'ruby-oci8', '>=2.0.4'
|
14
|
+
end
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.4.4 2010-10-06
|
2
|
+
|
3
|
+
* Improvements
|
4
|
+
* When using plsql.connect! then set session time zone from ENV['TZ'] or from :time_zone option
|
5
|
+
* Bug fixes
|
6
|
+
* Bugfix for case when object is in invalid state but has no errors
|
7
|
+
* Support ref cursor return value with type defined inside package
|
8
|
+
|
1
9
|
== 0.4.3 2010-03-25
|
2
10
|
|
3
11
|
* Improvements
|
data/Rakefile
CHANGED
@@ -14,9 +14,9 @@ EOS
|
|
14
14
|
gem.email = "raimonds.simanovskis@gmail.com"
|
15
15
|
gem.homepage = "http://github.com/rsim/ruby-plsql"
|
16
16
|
gem.authors = ["Raimonds Simanovskis"]
|
17
|
-
gem.add_development_dependency "rspec", "
|
18
|
-
gem.add_development_dependency "activerecord", "= 2.3.
|
19
|
-
gem.add_development_dependency "activerecord-oracle_enhanced-adapter", "
|
17
|
+
gem.add_development_dependency "rspec", "~> 1.3.0"
|
18
|
+
gem.add_development_dependency "activerecord", "= 2.3.8"
|
19
|
+
gem.add_development_dependency "activerecord-oracle_enhanced-adapter", "~> 1.3.1"
|
20
20
|
gem.extra_rdoc_files = ['README.rdoc']
|
21
21
|
end
|
22
22
|
Jeweler::GemcutterTasks.new
|
@@ -34,6 +34,7 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
34
34
|
spec.libs << 'lib' << 'spec'
|
35
35
|
spec.pattern = 'spec/**/*_spec.rb'
|
36
36
|
spec.rcov = true
|
37
|
+
spec.rcov_opts = ['--exclude', '/Library,spec/']
|
37
38
|
end
|
38
39
|
|
39
40
|
task :spec => :check_dependencies
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
data/lib/plsql/connection.rb
CHANGED
@@ -24,7 +24,7 @@ module PLSQL
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.create_new(params) #:nodoc:
|
27
|
-
case driver_type
|
27
|
+
conn = case driver_type
|
28
28
|
when :oci
|
29
29
|
OCIConnection.create_raw(params)
|
30
30
|
when :jdbc
|
@@ -32,6 +32,8 @@ module PLSQL
|
|
32
32
|
else
|
33
33
|
raise ArgumentError, "Unknown raw driver"
|
34
34
|
end
|
35
|
+
conn.set_time_zone(params[:time_zone])
|
36
|
+
conn
|
35
37
|
end
|
36
38
|
|
37
39
|
def self.driver_type #:nodoc:
|
@@ -195,6 +197,17 @@ module PLSQL
|
|
195
197
|
@session_id ||= select_first("SELECT TO_NUMBER(USERENV('SESSIONID')) FROM dual")[0]
|
196
198
|
end
|
197
199
|
|
200
|
+
# Set time zone (default taken from TZ environment variable)
|
201
|
+
def set_time_zone(time_zone=nil)
|
202
|
+
time_zone ||= ENV['TZ']
|
203
|
+
exec("alter session set time_zone = '#{time_zone}'") if time_zone
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns session time zone
|
207
|
+
def time_zone
|
208
|
+
select_first("SELECT SESSIONTIMEZONE FROM dual")[0]
|
209
|
+
end
|
210
|
+
|
198
211
|
RUBY_TEMP_TABLE_PREFIX = 'ruby_'
|
199
212
|
|
200
213
|
# Drop all ruby temporary tables that are used for calling packages with table parameter types defined in packages
|
@@ -41,6 +41,11 @@ module PLSQL
|
|
41
41
|
new(java.sql.DriverManager.getConnection(url, params[:username], params[:password]))
|
42
42
|
end
|
43
43
|
|
44
|
+
def set_time_zone(time_zone=nil)
|
45
|
+
time_zone ||= ENV['TZ']
|
46
|
+
raw_connection.setSessionTimeZone(time_zone)
|
47
|
+
end
|
48
|
+
|
44
49
|
def logoff
|
45
50
|
super
|
46
51
|
raw_connection.close
|
data/lib/plsql/procedure.rb
CHANGED
@@ -165,7 +165,7 @@ module PLSQL
|
|
165
165
|
case previous_level_argument_metadata[data_level - 1][:data_type]
|
166
166
|
when 'PL/SQL RECORD'
|
167
167
|
previous_level_argument_metadata[data_level - 1][:fields][argument_name.downcase.to_sym] = argument_metadata
|
168
|
-
when 'PL/SQL TABLE', 'TABLE', 'VARRAY'
|
168
|
+
when 'PL/SQL TABLE', 'TABLE', 'VARRAY', 'REF CURSOR'
|
169
169
|
previous_level_argument_metadata[data_level - 1][:element] = argument_metadata
|
170
170
|
end
|
171
171
|
end
|
@@ -209,7 +209,7 @@ module PLSQL
|
|
209
209
|
@tmp_tables_created[overload] = true
|
210
210
|
end
|
211
211
|
|
212
|
-
PLSQL_COMPOSITE_TYPES = ['PL/SQL RECORD', 'PL/SQL TABLE', 'TABLE', 'VARRAY'].freeze
|
212
|
+
PLSQL_COMPOSITE_TYPES = ['PL/SQL RECORD', 'PL/SQL TABLE', 'TABLE', 'VARRAY', 'REF CURSOR'].freeze
|
213
213
|
def composite_type?(data_type) #:nodoc:
|
214
214
|
PLSQL_COMPOSITE_TYPES.include? data_type
|
215
215
|
end
|
data/lib/plsql/schema.rb
CHANGED
@@ -204,10 +204,10 @@ module PLSQL
|
|
204
204
|
AND object_type IN ('PROCEDURE','FUNCTION','PACKAGE','TABLE','VIEW','SEQUENCE','TYPE','SYNONYM')",
|
205
205
|
object_schema_name, object_name)
|
206
206
|
object_type, object_id, status, body_status = row
|
207
|
-
raise ArgumentError, "Database object '#{object_schema_name}.#{object_name}' is not in valid status\n
|
208
|
-
_errors(object_schema_name, object_name, object_type) if status == 'INVALID'
|
209
|
-
raise ArgumentError, "Package '#{object_schema_name}.#{object_name}' body is not in valid status\n
|
210
|
-
_errors(object_schema_name, object_name, 'PACKAGE BODY') if body_status == 'INVALID'
|
207
|
+
raise ArgumentError, "Database object '#{object_schema_name}.#{object_name}' is not in valid status\n#{
|
208
|
+
_errors(object_schema_name, object_name, object_type)}" if status == 'INVALID'
|
209
|
+
raise ArgumentError, "Package '#{object_schema_name}.#{object_name}' body is not in valid status\n#{
|
210
|
+
_errors(object_schema_name, object_name, 'PACKAGE BODY')}" if body_status == 'INVALID'
|
211
211
|
case object_type
|
212
212
|
when 'PROCEDURE', 'FUNCTION'
|
213
213
|
Procedure.new(self, name, nil, override_schema_name, object_id)
|
data/ruby-plsql.gemspec
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ruby-plsql}
|
8
|
+
s.version = "0.4.4"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Raimonds Simanovskis"]
|
12
|
+
s.date = %q{2010-10-06}
|
13
|
+
s.description = %q{ruby-plsql gem provides simple Ruby API for calling Oracle PL/SQL procedures.
|
14
|
+
It could be used both for accessing Oracle PL/SQL API procedures in legacy applications
|
15
|
+
as well as it could be used to create PL/SQL unit tests using Ruby testing libraries.
|
16
|
+
}
|
17
|
+
s.email = %q{raimonds.simanovskis@gmail.com}
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".gitignore",
|
23
|
+
"Gemfile",
|
24
|
+
"History.txt",
|
25
|
+
"License.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/plsql/connection.rb",
|
30
|
+
"lib/plsql/helpers.rb",
|
31
|
+
"lib/plsql/jdbc_connection.rb",
|
32
|
+
"lib/plsql/oci8_patches.rb",
|
33
|
+
"lib/plsql/oci_connection.rb",
|
34
|
+
"lib/plsql/package.rb",
|
35
|
+
"lib/plsql/procedure.rb",
|
36
|
+
"lib/plsql/procedure_call.rb",
|
37
|
+
"lib/plsql/schema.rb",
|
38
|
+
"lib/plsql/sequence.rb",
|
39
|
+
"lib/plsql/sql_statements.rb",
|
40
|
+
"lib/plsql/table.rb",
|
41
|
+
"lib/plsql/type.rb",
|
42
|
+
"lib/plsql/variable.rb",
|
43
|
+
"lib/plsql/version.rb",
|
44
|
+
"lib/plsql/view.rb",
|
45
|
+
"lib/ruby-plsql.rb",
|
46
|
+
"lib/ruby_plsql.rb",
|
47
|
+
"ruby-plsql.gemspec",
|
48
|
+
"spec/plsql/connection_spec.rb",
|
49
|
+
"spec/plsql/package_spec.rb",
|
50
|
+
"spec/plsql/procedure_spec.rb",
|
51
|
+
"spec/plsql/schema_spec.rb",
|
52
|
+
"spec/plsql/sequence_spec.rb",
|
53
|
+
"spec/plsql/sql_statements_spec.rb",
|
54
|
+
"spec/plsql/table_spec.rb",
|
55
|
+
"spec/plsql/type_spec.rb",
|
56
|
+
"spec/plsql/variable_spec.rb",
|
57
|
+
"spec/plsql/version_spec.rb",
|
58
|
+
"spec/plsql/view_spec.rb",
|
59
|
+
"spec/spec.opts",
|
60
|
+
"spec/spec_helper.rb"
|
61
|
+
]
|
62
|
+
s.homepage = %q{http://github.com/rsim/ruby-plsql}
|
63
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
64
|
+
s.require_paths = ["lib"]
|
65
|
+
s.rubygems_version = %q{1.3.7}
|
66
|
+
s.summary = %q{Ruby API for calling Oracle PL/SQL procedures.}
|
67
|
+
s.test_files = [
|
68
|
+
"spec/plsql/connection_spec.rb",
|
69
|
+
"spec/plsql/package_spec.rb",
|
70
|
+
"spec/plsql/procedure_spec.rb",
|
71
|
+
"spec/plsql/schema_spec.rb",
|
72
|
+
"spec/plsql/sequence_spec.rb",
|
73
|
+
"spec/plsql/sql_statements_spec.rb",
|
74
|
+
"spec/plsql/table_spec.rb",
|
75
|
+
"spec/plsql/type_spec.rb",
|
76
|
+
"spec/plsql/variable_spec.rb",
|
77
|
+
"spec/plsql/version_spec.rb",
|
78
|
+
"spec/plsql/view_spec.rb",
|
79
|
+
"spec/spec_helper.rb"
|
80
|
+
]
|
81
|
+
|
82
|
+
if s.respond_to? :specification_version then
|
83
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
84
|
+
s.specification_version = 3
|
85
|
+
|
86
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
87
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
|
88
|
+
s.add_development_dependency(%q<activerecord>, ["= 2.3.8"])
|
89
|
+
s.add_development_dependency(%q<activerecord-oracle_enhanced-adapter>, ["~> 1.3.1"])
|
90
|
+
else
|
91
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
92
|
+
s.add_dependency(%q<activerecord>, ["= 2.3.8"])
|
93
|
+
s.add_dependency(%q<activerecord-oracle_enhanced-adapter>, ["~> 1.3.1"])
|
94
|
+
end
|
95
|
+
else
|
96
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
97
|
+
s.add_dependency(%q<activerecord>, ["= 2.3.8"])
|
98
|
+
s.add_dependency(%q<activerecord-oracle_enhanced-adapter>, ["~> 1.3.1"])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'spec_helper'
|
4
4
|
|
5
5
|
describe "Connection" do
|
6
6
|
|
@@ -407,7 +407,7 @@ describe "Connection" do
|
|
407
407
|
describe "session information" do
|
408
408
|
it "should get database version" do
|
409
409
|
# using Oracle version 10.2.0.4 for unit tests
|
410
|
-
@conn.database_version.should ==
|
410
|
+
@conn.database_version.should == DATABASE_VERSION.split('.').map{|n| n.to_i}
|
411
411
|
end
|
412
412
|
|
413
413
|
it "should get session ID" do
|
data/spec/plsql/package_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'spec_helper'
|
4
4
|
|
5
5
|
describe "Parameter type mapping /" do
|
6
6
|
before(:all) do
|
7
|
-
plsql.
|
7
|
+
plsql.connect! CONNECTION_PARAMS
|
8
8
|
end
|
9
9
|
|
10
10
|
after(:all) do
|
@@ -1503,12 +1503,75 @@ describe "Parameter type mapping /" do
|
|
1503
1503
|
end
|
1504
1504
|
|
1505
1505
|
end
|
1506
|
+
|
1507
|
+
describe "Function with typed ref cursor return value" do
|
1508
|
+
|
1509
|
+
before(:all) do
|
1510
|
+
plsql.execute "DROP TABLE typed_ref_cursor_table" rescue nil
|
1511
|
+
|
1512
|
+
plsql.execute <<-SQL
|
1513
|
+
CREATE TABLE typed_ref_cursor_table
|
1514
|
+
( col1 VARCHAR2(10), col2 NUMBER )
|
1515
|
+
SQL
|
1516
|
+
|
1517
|
+
plsql.execute <<-SQL
|
1518
|
+
CREATE OR REPLACE PACKAGE typed_ref_cursor_test IS
|
1519
|
+
TYPE test_rec IS RECORD ( col1 VARCHAR2(10), col2 NUMBER ) ;
|
1520
|
+
TYPE test_rec_ref IS REF CURSOR RETURN test_rec ;
|
1521
|
+
|
1522
|
+
function get_all RETURN test_rec_ref ;
|
1523
|
+
END typed_ref_cursor_test ;
|
1524
|
+
SQL
|
1525
|
+
|
1526
|
+
plsql.execute <<-SQL
|
1527
|
+
CREATE OR REPLACE PACKAGE BODY typed_ref_cursor_test IS
|
1528
|
+
FUNCTION get_all RETURN test_rec_ref IS
|
1529
|
+
rc test_rec_ref ;
|
1530
|
+
BEGIN
|
1531
|
+
OPEN rc FOR SELECT * FROM typed_ref_cursor_table ;
|
1532
|
+
RETURN rc ;
|
1533
|
+
END get_all ;
|
1534
|
+
END typed_ref_cursor_test ;
|
1535
|
+
SQL
|
1536
|
+
|
1537
|
+
@fields = [:col1, :col2 ]
|
1538
|
+
@rows = (1..3).map{|i| ["row #{i}", i]}
|
1539
|
+
plsql.typed_ref_cursor_table.insert_values *@rows
|
1540
|
+
plsql.commit
|
1541
|
+
|
1542
|
+
end
|
1543
|
+
|
1544
|
+
after(:all) do
|
1545
|
+
plsql.execute "DROP PACKAGE typed_ref_cursor_test"
|
1546
|
+
plsql.execute "DROP TABLE typed_ref_cursor_table"
|
1547
|
+
end
|
1548
|
+
|
1549
|
+
it "should return cursor and fetch first row" do
|
1550
|
+
plsql.typed_ref_cursor_test.get_all do |cursor|
|
1551
|
+
cursor.fetch.should == @rows[0]
|
1552
|
+
end.should be_nil
|
1553
|
+
end
|
1554
|
+
|
1555
|
+
it "should fetch hash from returned cursor" do
|
1556
|
+
plsql.typed_ref_cursor_test.get_all do |cursor|
|
1557
|
+
cursor.fetch_hash.should == Hash[*@fields.zip(@rows[0]).flatten]
|
1558
|
+
end
|
1559
|
+
end
|
1560
|
+
|
1561
|
+
it "should fetch all rows from returned cursor" do
|
1562
|
+
plsql.typed_ref_cursor_test.get_all do |cursor|
|
1563
|
+
cursor.fetch_all.should == @rows
|
1564
|
+
end
|
1565
|
+
end
|
1566
|
+
|
1567
|
+
end
|
1568
|
+
|
1506
1569
|
end
|
1507
1570
|
|
1508
1571
|
describe "Synonyms /" do
|
1509
1572
|
|
1510
1573
|
before(:all) do
|
1511
|
-
plsql.
|
1574
|
+
plsql.connect! CONNECTION_PARAMS
|
1512
1575
|
end
|
1513
1576
|
|
1514
1577
|
after(:all) do
|
@@ -1636,7 +1699,7 @@ end
|
|
1636
1699
|
describe "SYS.STANDARD procedures /" do
|
1637
1700
|
|
1638
1701
|
before(:all) do
|
1639
|
-
plsql.
|
1702
|
+
plsql.connect! CONNECTION_PARAMS
|
1640
1703
|
end
|
1641
1704
|
|
1642
1705
|
after(:all) do
|
data/spec/plsql/schema_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Schema" do
|
4
4
|
|
@@ -94,6 +94,16 @@ describe "Connection with connect!" do
|
|
94
94
|
plsql.schema_name.should == @username.upcase
|
95
95
|
end
|
96
96
|
|
97
|
+
it "should set session time zone from TZ environment variable" do
|
98
|
+
plsql.connect! @username, @password, @database
|
99
|
+
plsql.connection.time_zone.should == ENV['TZ']
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should set session time zone from :time_zone parameter" do
|
103
|
+
plsql.connect! :username => @username, :password => @password, :database => @database, :time_zone => 'EET'
|
104
|
+
plsql.connection.time_zone.should == 'EET'
|
105
|
+
end
|
106
|
+
|
97
107
|
end
|
98
108
|
|
99
109
|
describe "Named Schema" do
|
data/spec/plsql/sequence_spec.rb
CHANGED
data/spec/plsql/table_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Table" do
|
4
4
|
before(:all) do
|
5
|
-
plsql.
|
5
|
+
plsql.connect! CONNECTION_PARAMS
|
6
6
|
plsql.connection.autocommit = false
|
7
7
|
plsql.execute <<-SQL
|
8
8
|
CREATE TABLE test_employees (
|
data/spec/plsql/type_spec.rb
CHANGED
data/spec/plsql/variable_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'spec_helper'
|
4
4
|
|
5
5
|
describe "Package variables /" do
|
6
6
|
|
7
7
|
before(:all) do
|
8
|
-
plsql.
|
8
|
+
plsql.connect! CONNECTION_PARAMS
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:all) do
|
data/spec/plsql/version_spec.rb
CHANGED
data/spec/plsql/view_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "View" do
|
4
4
|
before(:all) do
|
5
|
-
plsql.
|
5
|
+
plsql.connect! CONNECTION_PARAMS
|
6
6
|
plsql.connection.autocommit = false
|
7
7
|
plsql.execute <<-SQL
|
8
8
|
CREATE TABLE test_employees (
|
data/spec/spec_helper.rb
CHANGED
@@ -1,23 +1,28 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
begin
|
6
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
+
require 'bundler'
|
8
|
+
Bundler.setup
|
9
|
+
rescue Bundler::GemNotFound => e
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Try running `bundle install`."
|
12
|
+
exit!
|
13
|
+
end if File.exist?(gemfile)
|
14
|
+
|
15
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
16
|
+
|
17
|
+
require 'spec'
|
4
18
|
|
5
19
|
unless ENV['NO_ACTIVERECORD']
|
6
|
-
|
7
|
-
gem "activerecord", "= 2.3.5"
|
8
|
-
require "active_record"
|
9
|
-
gem "activerecord-oracle_enhanced-adapter", "= 1.2.4"
|
20
|
+
require 'active_record'
|
10
21
|
else
|
11
|
-
puts
|
22
|
+
puts 'Without ActiveRecord'
|
12
23
|
end
|
13
24
|
|
14
|
-
|
15
|
-
gem "ruby-oci8", ">=2.0.3"
|
16
|
-
end
|
17
|
-
|
18
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
19
|
-
|
20
|
-
require "ruby-plsql"
|
25
|
+
require 'ruby-plsql'
|
21
26
|
|
22
27
|
DATABASE_NAME = ENV['DATABASE_NAME'] || 'orcl'
|
23
28
|
DATABASE_HOST = ENV['DATABASE_HOST'] || 'localhost'
|
@@ -26,6 +31,8 @@ DATABASE_USERS_AND_PASSWORDS = [
|
|
26
31
|
[ENV['DATABASE_USER'] || 'hr', ENV['DATABASE_PASSWORD'] || 'hr'],
|
27
32
|
[ENV['DATABASE_USER2'] || 'arunit', ENV['DATABASE_PASSWORD2'] || 'arunit']
|
28
33
|
]
|
34
|
+
# specify which database version is used (will be verified in one test)
|
35
|
+
DATABASE_VERSION = ENV['DATABASE_VERSION'] || '10.2.0.4'
|
29
36
|
|
30
37
|
def get_connection(user_number = 0)
|
31
38
|
database_user, database_password = DATABASE_USERS_AND_PASSWORDS[user_number]
|
@@ -68,3 +75,8 @@ class Hash
|
|
68
75
|
self.reject {|key, value| !whitelist.include?(key) }
|
69
76
|
end unless method_defined?(:only)
|
70
77
|
end
|
78
|
+
|
79
|
+
# set default time zone in TZ environment variable
|
80
|
+
# which will be used to set session time zone
|
81
|
+
ENV['TZ'] ||= 'Europe/Riga'
|
82
|
+
# ENV['TZ'] ||= 'UTC'
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-plsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 4
|
10
|
+
version: 0.4.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Raimonds Simanovskis
|
@@ -14,49 +15,55 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-06 00:00:00 +03:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
|
-
- -
|
27
|
+
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
27
30
|
segments:
|
28
31
|
- 1
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 1.
|
32
|
+
- 3
|
33
|
+
- 0
|
34
|
+
version: 1.3.0
|
32
35
|
type: :development
|
33
36
|
version_requirements: *id001
|
34
37
|
- !ruby/object:Gem::Dependency
|
35
38
|
name: activerecord
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - "="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 19
|
41
46
|
segments:
|
42
47
|
- 2
|
43
48
|
- 3
|
44
|
-
-
|
45
|
-
version: 2.3.
|
49
|
+
- 8
|
50
|
+
version: 2.3.8
|
46
51
|
type: :development
|
47
52
|
version_requirements: *id002
|
48
53
|
- !ruby/object:Gem::Dependency
|
49
54
|
name: activerecord-oracle_enhanced-adapter
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
|
-
- -
|
59
|
+
- - ~>
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 25
|
55
62
|
segments:
|
56
63
|
- 1
|
57
|
-
-
|
58
|
-
-
|
59
|
-
version: 1.
|
64
|
+
- 3
|
65
|
+
- 1
|
66
|
+
version: 1.3.1
|
60
67
|
type: :development
|
61
68
|
version_requirements: *id003
|
62
69
|
description: |
|
@@ -73,6 +80,7 @@ extra_rdoc_files:
|
|
73
80
|
- README.rdoc
|
74
81
|
files:
|
75
82
|
- .gitignore
|
83
|
+
- Gemfile
|
76
84
|
- History.txt
|
77
85
|
- License.txt
|
78
86
|
- README.rdoc
|
@@ -96,6 +104,7 @@ files:
|
|
96
104
|
- lib/plsql/view.rb
|
97
105
|
- lib/ruby-plsql.rb
|
98
106
|
- lib/ruby_plsql.rb
|
107
|
+
- ruby-plsql.gemspec
|
99
108
|
- spec/plsql/connection_spec.rb
|
100
109
|
- spec/plsql/package_spec.rb
|
101
110
|
- spec/plsql/procedure_spec.rb
|
@@ -119,23 +128,27 @@ rdoc_options:
|
|
119
128
|
require_paths:
|
120
129
|
- lib
|
121
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
122
132
|
requirements:
|
123
133
|
- - ">="
|
124
134
|
- !ruby/object:Gem::Version
|
135
|
+
hash: 3
|
125
136
|
segments:
|
126
137
|
- 0
|
127
138
|
version: "0"
|
128
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
129
141
|
requirements:
|
130
142
|
- - ">="
|
131
143
|
- !ruby/object:Gem::Version
|
144
|
+
hash: 3
|
132
145
|
segments:
|
133
146
|
- 0
|
134
147
|
version: "0"
|
135
148
|
requirements: []
|
136
149
|
|
137
150
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.3.
|
151
|
+
rubygems_version: 1.3.7
|
139
152
|
signing_key:
|
140
153
|
specification_version: 3
|
141
154
|
summary: Ruby API for calling Oracle PL/SQL procedures.
|