ruby-plsql 0.8.0 → 0.9.9

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +2 -0
  3. data/README.md +19 -3
  4. data/VERSION +1 -1
  5. data/lib/plsql/connection.rb +14 -14
  6. data/lib/plsql/helpers.rb +3 -3
  7. data/lib/plsql/jdbc_connection.rb +62 -22
  8. data/lib/plsql/oci_connection.rb +10 -10
  9. data/lib/plsql/package.rb +3 -3
  10. data/lib/plsql/procedure.rb +57 -22
  11. data/lib/plsql/procedure_call.rb +15 -15
  12. data/lib/plsql/schema.rb +17 -10
  13. data/lib/plsql/sequence.rb +2 -2
  14. data/lib/plsql/table.rb +6 -6
  15. data/lib/plsql/type.rb +7 -7
  16. data/lib/plsql/variable.rb +6 -5
  17. data/lib/plsql/version.rb +1 -1
  18. data/lib/plsql/view.rb +2 -2
  19. metadata +14 -140
  20. data/.github/stale.yml +0 -37
  21. data/.github/workflows/rubocop.yml +0 -37
  22. data/.github/workflows/test.yml +0 -69
  23. data/.rubocop.yml +0 -147
  24. data/.travis/oracle/download.sh +0 -15
  25. data/.travis/oracle/install.sh +0 -32
  26. data/.travis/setup_accounts.sh +0 -9
  27. data/.travis.yml +0 -88
  28. data/Gemfile +0 -24
  29. data/Rakefile +0 -53
  30. data/Vagrantfile +0 -38
  31. data/ci/network/admin/tnsnames.ora +0 -7
  32. data/ci/setup_accounts.sh +0 -9
  33. data/gemfiles/Gemfile.activerecord-5.0 +0 -21
  34. data/gemfiles/Gemfile.activerecord-5.1 +0 -21
  35. data/gemfiles/Gemfile.activerecord-5.2 +0 -21
  36. data/gemfiles/Gemfile.activerecord-6.0 +0 -21
  37. data/gemfiles/Gemfile.activerecord-6.1 +0 -21
  38. data/gemfiles/Gemfile.activerecord-main +0 -21
  39. data/lib/plsql/oci8_patches.rb +0 -25
  40. data/ruby-plsql.gemspec +0 -114
  41. data/spec/plsql/connection_spec.rb +0 -505
  42. data/spec/plsql/package_spec.rb +0 -172
  43. data/spec/plsql/procedure_spec.rb +0 -2390
  44. data/spec/plsql/schema_spec.rb +0 -364
  45. data/spec/plsql/sequence_spec.rb +0 -67
  46. data/spec/plsql/sql_statements_spec.rb +0 -91
  47. data/spec/plsql/table_spec.rb +0 -376
  48. data/spec/plsql/type_spec.rb +0 -299
  49. data/spec/plsql/variable_spec.rb +0 -497
  50. data/spec/plsql/version_spec.rb +0 -8
  51. data/spec/plsql/view_spec.rb +0 -264
  52. data/spec/spec.opts +0 -6
  53. data/spec/spec_helper.rb +0 -121
  54. data/spec/support/create_arunit_user.sql +0 -2
  55. data/spec/support/custom_config.rb.sample +0 -14
  56. data/spec/support/file_check_script.sh +0 -9
  57. data/spec/support/test_db.rb +0 -149
  58. data/spec/support/unlock_and_setup_hr_user.sql +0 -2
@@ -1,172 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Package" do
4
- before(:all) do
5
- plsql.connection = get_connection
6
- plsql.execute <<-SQL
7
- CREATE OR REPLACE PACKAGE test_package IS
8
- test_variable NUMBER;
9
- FUNCTION test_procedure ( p_string VARCHAR2 )
10
- RETURN VARCHAR2;
11
- END;
12
- SQL
13
- plsql.execute <<-SQL
14
- CREATE OR REPLACE PACKAGE BODY test_package IS
15
- FUNCTION test_procedure ( p_string VARCHAR2 )
16
- RETURN VARCHAR2
17
- IS
18
- BEGIN
19
- RETURN UPPER(p_string);
20
- END test_procedure;
21
- END;
22
- SQL
23
- end
24
-
25
- after(:all) do
26
- plsql.execute "DROP PACKAGE test_package"
27
- plsql.logoff
28
- end
29
-
30
- before(:each) do
31
- end
32
-
33
- it "should find existing package" do
34
- expect(PLSQL::Package.find(plsql, :test_package)).not_to be_nil
35
- end
36
-
37
- it "should not find nonexisting package" do
38
- expect(PLSQL::Package.find(plsql, :qwerty123456)).to be_nil
39
- end
40
-
41
- it "should find existing package in schema" do
42
- expect(plsql.test_package.class).to eq(PLSQL::Package)
43
- end
44
-
45
- it "should execute package function and return correct value" do
46
- expect(plsql.test_package.test_procedure("xxx")).to eq("XXX")
47
- end
48
-
49
- it "should report an existing procedure as existing" do
50
- expect(plsql.test_package.procedure_defined?(:test_procedure)).to be_truthy
51
- end
52
-
53
- it "should report an inexistent procedure as not existing" do
54
- expect(plsql.test_package.procedure_defined?(:inexistent_procedure)).to be_falsey
55
- end
56
-
57
- it "should search objects via []" do
58
- package = PLSQL::Package.find(plsql, :test_package)
59
-
60
- [:Test_Procedure, :test_procedure, "test_procedure", "TEST_PROCEDURE"].each do |name_variant|
61
- expect(package[name_variant]).to be_a PLSQL::Procedure
62
- end
63
-
64
- [:Test_Variable, :test_variable, "test_variable", "TEST_VARIABLE"].each do |name_variant|
65
- expect(package[name_variant]).to be_a PLSQL::Variable
66
- end
67
- end
68
-
69
- context "with a user with execute privilege who is not the package owner" do
70
- before(:all) do
71
- plsql.execute("grant execute on TEST_PACKAGE to #{DATABASE_USERS_AND_PASSWORDS[1][0]}")
72
- @original_connection = plsql.connection
73
- @conn = get_connection(1)
74
- end
75
-
76
- before(:each) do
77
- # resetting connection clears cached package objects and schema name
78
- plsql.connection = @conn
79
- end
80
-
81
- after(:all) do
82
- plsql.logoff
83
- plsql.connection = @original_connection
84
- end
85
-
86
- it "should not find existing package" do
87
- expect(PLSQL::Package.find(plsql, :test_package)).to be_nil
88
- end
89
-
90
- context "who sets current_schema to match the package owner" do
91
- before(:all) do
92
- plsql.execute "ALTER SESSION set current_schema=#{DATABASE_USERS_AND_PASSWORDS[0][0]}"
93
- end
94
-
95
- it "should find existing package" do
96
- expect(PLSQL::Package.find(plsql, :test_package)).not_to be_nil
97
- end
98
-
99
- it "should report an existing procedure as existing" do
100
- expect(plsql.test_package.procedure_defined?(:test_procedure)).to be_truthy
101
- end
102
-
103
- end
104
-
105
- end
106
-
107
- describe "variables" do
108
- it "should set and get package variable value" do
109
- plsql.test_package.test_variable = 1
110
- expect(plsql.test_package.test_variable).to eq(1)
111
- end
112
- end
113
-
114
- end
115
-
116
- describe "Synonym to package" do
117
-
118
- before(:all) do
119
- plsql.connection = get_connection
120
- plsql.execute <<-SQL
121
- CREATE OR REPLACE PACKAGE hr.test_package IS
122
- FUNCTION test_procedure ( p_string VARCHAR2 )
123
- RETURN VARCHAR2;
124
- END;
125
- SQL
126
- plsql.execute <<-SQL
127
- CREATE OR REPLACE PACKAGE BODY hr.test_package IS
128
- FUNCTION test_procedure ( p_string VARCHAR2 )
129
- RETURN VARCHAR2
130
- IS
131
- BEGIN
132
- RETURN UPPER(p_string);
133
- END test_procedure;
134
- END;
135
- SQL
136
- plsql.execute "CREATE SYNONYM test_pkg_synonym FOR hr.test_package"
137
- end
138
-
139
- after(:all) do
140
- plsql.execute "DROP SYNONYM test_pkg_synonym" rescue nil
141
- plsql.logoff
142
- end
143
-
144
- it "should find synonym to package" do
145
- expect(PLSQL::Package.find(plsql, :test_pkg_synonym)).not_to be_nil
146
- end
147
-
148
- it "should execute package function using synonym and return correct value" do
149
- expect(plsql.test_pkg_synonym.test_procedure("xxx")).to eq("XXX")
150
- end
151
-
152
- end
153
-
154
- describe "Public synonym to package" do
155
-
156
- before(:all) do
157
- plsql.connection = get_connection
158
- end
159
-
160
- after(:all) do
161
- plsql.logoff
162
- end
163
-
164
- it "should find public synonym to package" do
165
- expect(PLSQL::Package.find(plsql, :utl_encode)).not_to be_nil
166
- end
167
-
168
- it "should execute package function using public synonym and return correct value" do
169
- expect(plsql.utl_encode.base64_encode("abc")).to eq("4372773D")
170
- end
171
-
172
- end