ruby-plsql 0.5.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/.github/stale.yml +37 -0
  3. data/.github/workflows/rubocop.yml +37 -0
  4. data/.github/workflows/test.yml +69 -0
  5. data/.rubocop.yml +147 -0
  6. data/.travis.yml +88 -0
  7. data/.travis/oracle/download.sh +15 -0
  8. data/.travis/oracle/install.sh +32 -0
  9. data/.travis/setup_accounts.sh +9 -0
  10. data/Gemfile +17 -9
  11. data/History.txt +76 -0
  12. data/README.md +29 -6
  13. data/Rakefile +31 -26
  14. data/VERSION +1 -1
  15. data/Vagrantfile +4 -4
  16. data/ci/network/admin/tnsnames.ora +7 -0
  17. data/ci/setup_accounts.sh +9 -0
  18. data/gemfiles/Gemfile.activerecord-5.0 +21 -0
  19. data/gemfiles/Gemfile.activerecord-5.1 +21 -0
  20. data/gemfiles/Gemfile.activerecord-5.2 +21 -0
  21. data/gemfiles/Gemfile.activerecord-6.0 +21 -0
  22. data/gemfiles/Gemfile.activerecord-6.1 +21 -0
  23. data/gemfiles/Gemfile.activerecord-main +21 -0
  24. data/lib/plsql/connection.rb +19 -22
  25. data/lib/plsql/helpers.rb +1 -3
  26. data/lib/plsql/jdbc_connection.rb +70 -68
  27. data/lib/plsql/oci8_patches.rb +2 -2
  28. data/lib/plsql/oci_connection.rb +62 -77
  29. data/lib/plsql/package.rb +61 -46
  30. data/lib/plsql/procedure.rb +358 -78
  31. data/lib/plsql/procedure_call.rb +508 -463
  32. data/lib/plsql/schema.rb +96 -101
  33. data/lib/plsql/sequence.rb +10 -13
  34. data/lib/plsql/sql_statements.rb +9 -11
  35. data/lib/plsql/table.rb +60 -63
  36. data/lib/plsql/type.rb +71 -76
  37. data/lib/plsql/variable.rb +90 -94
  38. data/lib/plsql/version.rb +1 -1
  39. data/lib/plsql/view.rb +16 -19
  40. data/ruby-plsql.gemspec +55 -35
  41. data/spec/plsql/connection_spec.rb +72 -66
  42. data/spec/plsql/package_spec.rb +63 -14
  43. data/spec/plsql/procedure_spec.rb +603 -261
  44. data/spec/plsql/schema_spec.rb +47 -23
  45. data/spec/plsql/sequence_spec.rb +2 -2
  46. data/spec/plsql/sql_statements_spec.rb +6 -6
  47. data/spec/plsql/table_spec.rb +84 -79
  48. data/spec/plsql/type_spec.rb +24 -30
  49. data/spec/plsql/variable_spec.rb +80 -88
  50. data/spec/plsql/version_spec.rb +4 -4
  51. data/spec/plsql/view_spec.rb +42 -42
  52. data/spec/spec_helper.rb +38 -35
  53. data/spec/support/create_arunit_user.sql +2 -0
  54. data/spec/support/custom_config.rb.sample +14 -0
  55. data/spec/support/test_db.rb +12 -13
  56. data/spec/support/unlock_and_setup_hr_user.sql +2 -0
  57. metadata +111 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f9c79fd3f97babd3bfa0f5a54b0830a12a6510c9
4
- data.tar.gz: b3ec4ad1f9db5aa761fc751b1db9a1263c2dd6f1
2
+ SHA256:
3
+ metadata.gz: 786698aedb4dff545a44a91fda4b7529d392b6d3afaee1e5a4447ee3be81a9d6
4
+ data.tar.gz: fa71bb0ec3ad558ab6805b077069401225fb1d8e949f4dc00360ecd085bae81b
5
5
  SHA512:
6
- metadata.gz: 88a0bf576dd829b0cbd7102a72a7a9d8bdfe3aee2e8771353756887f292c5c364ea9b24004c41e4cb14882cfd82c4d8ef7a9cd3709e04ab4693236dd163011c7
7
- data.tar.gz: ac9bde40f6690697c63acb443a8a9f02afa9fc1bb1670e477c09b21f6c4aa368c61326047ae8733860d337dd862efe4432fba81f3eee35d9a9affc72c60e32ff
6
+ metadata.gz: f814a2f6b9b2b0784e41f861f0ed0965cb814aaf4e8687293f8285e4758810fd4979e1ef96d7f7b0a305e701f0426fb81d3be0ece725abdf1888270a91131691
7
+ data.tar.gz: c17b7330167301d53715b4d43441acb67697a53a0b0378ea51f65824b96215ece3730db3af01be4e7442a2c3c632dc9fc14109425cfda73cfa535997d77444ba
data/.github/stale.yml ADDED
@@ -0,0 +1,37 @@
1
+ # Configuration for probot-stale - https://github.com/probot/stale
2
+
3
+ # Number of days of inactivity before an Issue or Pull Request becomes stale
4
+ daysUntilStale: 60
5
+ # Number of days of inactivity before a stale Issue or Pull Request is closed
6
+ daysUntilClose: 7
7
+ # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
8
+ exemptLabels:
9
+ - pinned
10
+ - security
11
+ - "[Status] Maybe Later"
12
+ # Label to use when marking as stale
13
+ staleLabel: wontfix
14
+ # Comment to post when marking as stale. Set to `false` to disable
15
+ markComment: >
16
+ This issue has been automatically marked as stale because it has not had
17
+ recent activity. It will be closed if no further activity occurs. Thank you
18
+ for your contributions.
19
+ # Comment to post when removing the stale label. Set to `false` to disable
20
+ unmarkComment: false
21
+ # Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
22
+ closeComment: false
23
+ # Limit the number of actions per hour, from 1-30. Default is 30
24
+ limitPerRun: 30
25
+ # Limit to only `issues` or `pulls`
26
+ # only: issues
27
+ #
28
+ # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
29
+ # pulls:
30
+ # daysUntilStale: 30
31
+ # markComment: >
32
+ # This pull request has been automatically marked as stale because it has not had
33
+ # recent activity. It will be closed if no further activity occurs. Thank you
34
+ # for your contributions.
35
+ # issues:
36
+ # exemptLabels:
37
+ # - confirmed
@@ -0,0 +1,37 @@
1
+ name: RuboCop
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ schedule:
7
+ - cron: "0 0 * * *"
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v1
16
+ - name: Set up Ruby 2.6
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.6.x
20
+ - name: Install required package
21
+ run: |
22
+ sudo apt-get install alien
23
+ - name: Download Oracle instant client
24
+ run: |
25
+ wget -q https://download.oracle.com/otn_software/linux/instantclient/193000/oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm
26
+ wget -q https://download.oracle.com/otn_software/linux/instantclient/193000/oracle-instantclient19.3-sqlplus-19.3.0.0.0-1.x86_64.rpm
27
+ wget -q https://download.oracle.com/otn_software/linux/instantclient/193000/oracle-instantclient19.3-devel-19.3.0.0.0-1.x86_64.rpm
28
+ - name: Install Oracle instant client
29
+ run: |
30
+ sudo alien -i oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm
31
+ sudo alien -i oracle-instantclient19.3-sqlplus-19.3.0.0.0-1.x86_64.rpm
32
+ sudo alien -i oracle-instantclient19.3-devel-19.3.0.0.0-1.x86_64.rpm
33
+
34
+ - name: Build and run RuboCop
35
+ run: |
36
+ bundle install --jobs 4 --retry 3
37
+ bundle exec rubocop --parallel
@@ -0,0 +1,69 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ build:
9
+
10
+ runs-on: ubuntu-20.04
11
+ continue-on-error: true
12
+ strategy:
13
+ matrix:
14
+ ruby: [
15
+ 3.0,
16
+ 2.7,
17
+ 2.6,
18
+ 2.5,
19
+ ruby-head,
20
+ ruby-debug
21
+ ]
22
+ env:
23
+ ORACLE_HOME: /usr/lib/oracle/18.5/client64
24
+ LD_LIBRARY_PATH: /usr/lib/oracle/18.5/client64/lib
25
+ NLS_LANG: AMERICAN_AMERICA.AL32UTF8
26
+ TNS_ADMIN: ./ci/network/admin
27
+ DATABASE_NAME: XEPDB1
28
+ TZ: Europe/Riga
29
+ DATABASE_SYS_PASSWORD: Oracle18
30
+ DATABASE_VERSION: 18.4.0.0
31
+
32
+ services:
33
+ oracle:
34
+ image: quillbuilduser/oracle-18-xe
35
+ ports:
36
+ - 1521:1521
37
+ env:
38
+ TZ: Europe/Riga
39
+ steps:
40
+ - uses: actions/checkout@v2
41
+ - name: Set up Ruby
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ - name: Install required package
46
+ run: |
47
+ sudo apt-get install alien
48
+ - name: Download Oracle client
49
+ run: |
50
+ wget -q https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
51
+ wget -q https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
52
+ wget -q https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
53
+ - name: Install Oracle client
54
+ run: |
55
+ sudo alien -i oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
56
+ sudo alien -i oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
57
+ sudo alien -i oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
58
+ - name: Install JDBC Driver
59
+ run: |
60
+ cp $ORACLE_HOME/lib/ojdbc8.jar lib/.
61
+ - name: Create database user
62
+ run: |
63
+ ./ci/setup_accounts.sh
64
+ - name: Bundle install
65
+ run: |
66
+ bundle install --jobs 4 --retry 3
67
+ - name: Run RSpec
68
+ run: |
69
+ bundle exec rspec
data/.rubocop.yml ADDED
@@ -0,0 +1,147 @@
1
+ # rubocop 0.51.0 requires Ruby 2.1
2
+ # We should not use cops only available for Ruby 2.1 or later
3
+ # since ruby-plsql itself supports Ruby 1.9.3
4
+ AllCops:
5
+ TargetRubyVersion: 2.3
6
+ DisabledByDefault: true
7
+
8
+ # Prefer &&/|| over and/or.
9
+ Style/AndOr:
10
+ Enabled: true
11
+
12
+ # Align `when` with `case`.
13
+ Layout/CaseIndentation:
14
+ Enabled: true
15
+
16
+ # Align comments with method definitions.
17
+ Layout/CommentIndentation:
18
+ Enabled: true
19
+
20
+ Layout/ElseAlignment:
21
+ Enabled: true
22
+
23
+ Layout/EmptyLineAfterMagicComment:
24
+ Enabled: true
25
+
26
+ # No extra empty lines.
27
+ Layout/EmptyLines:
28
+ Enabled: true
29
+
30
+ # In a regular class definition, no empty lines around the body.
31
+ Layout/EmptyLinesAroundClassBody:
32
+ Enabled: true
33
+
34
+ # In a regular method definition, no empty lines around the body.
35
+ Layout/EmptyLinesAroundMethodBody:
36
+ Enabled: true
37
+
38
+ # In a regular module definition, no empty lines around the body.
39
+ Layout/EmptyLinesAroundModuleBody:
40
+ Enabled: true
41
+
42
+ Layout/FirstArgumentIndentation:
43
+ Enabled: true
44
+
45
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
46
+ Style/HashSyntax:
47
+ Enabled: true
48
+
49
+ # Method definitions after `private` or `protected` isolated calls need one
50
+ # extra level of indentation.
51
+ Layout/IndentationConsistency:
52
+ Enabled: true
53
+ EnforcedStyle: indented_internal_methods
54
+
55
+ # Two spaces, no tabs (for indentation).
56
+ Layout/IndentationWidth:
57
+ Enabled: true
58
+
59
+ Layout/LeadingCommentSpace:
60
+ Enabled: true
61
+
62
+ Layout/SpaceAfterColon:
63
+ Enabled: true
64
+
65
+ Layout/SpaceAfterComma:
66
+ Enabled: true
67
+
68
+ Layout/SpaceAroundEqualsInParameterDefault:
69
+ Enabled: true
70
+
71
+ Layout/SpaceAroundKeyword:
72
+ Enabled: true
73
+
74
+ Layout/SpaceAroundOperators:
75
+ Enabled: true
76
+
77
+ Layout/SpaceBeforeComma:
78
+ Enabled: true
79
+
80
+ Layout/SpaceBeforeFirstArg:
81
+ Enabled: true
82
+
83
+ Style/DefWithParentheses:
84
+ Enabled: true
85
+
86
+ # Defining a method with parameters needs parentheses.
87
+ Style/MethodDefParentheses:
88
+ Enabled: true
89
+
90
+ Style/FrozenStringLiteralComment:
91
+ Enabled: false
92
+ EnforcedStyle: always
93
+
94
+ # Use `foo {}` not `foo{}`.
95
+ Layout/SpaceBeforeBlockBraces:
96
+ Enabled: true
97
+
98
+ # Use `foo { bar }` not `foo {bar}`.
99
+ Layout/SpaceInsideBlockBraces:
100
+ Enabled: true
101
+
102
+ # Use `{ a: 1 }` not `{a:1}`.
103
+ Layout/SpaceInsideHashLiteralBraces:
104
+ Enabled: true
105
+
106
+ Layout/SpaceInsideParens:
107
+ Enabled: true
108
+
109
+ # Check quotes usage according to lint rule below.
110
+ Style/StringLiterals:
111
+ Enabled: true
112
+ EnforcedStyle: double_quotes
113
+
114
+ # Detect hard tabs, no hard tabs.
115
+ Layout/Tab:
116
+ Enabled: true
117
+
118
+ # Blank lines should not have any spaces.
119
+ Layout/TrailingEmptyLines:
120
+ Enabled: true
121
+
122
+ # No trailing whitespace.
123
+ Layout/TrailingWhitespace:
124
+ Enabled: true
125
+
126
+ # Use quotes for string literals when they are enough.
127
+ Style/RedundantPercentQ:
128
+ Enabled: true
129
+
130
+ # Align `end` with the matching keyword or starting expression except for
131
+ # assignments, where it should be aligned with the LHS.
132
+ Layout/EndAlignment:
133
+ Enabled: true
134
+ EnforcedStyleAlignWith: variable
135
+ AutoCorrect: true
136
+
137
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
138
+ Lint/RequireParentheses:
139
+ Enabled: true
140
+
141
+ Style/RedundantReturn:
142
+ Enabled: true
143
+ AllowMultipleReturnValues: true
144
+
145
+ Style/Semicolon:
146
+ Enabled: true
147
+ AllowAsExpressionSeparator: true
data/.travis.yml ADDED
@@ -0,0 +1,88 @@
1
+ dist: xenial
2
+ sudo: required
3
+
4
+ jdk:
5
+ - openjdk8
6
+ env:
7
+ global:
8
+ - ORACLE_COOKIE=sqldev
9
+ - ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
10
+ - ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
11
+ - NLS_LANG=AMERICAN_AMERICA.AL32UTF8
12
+ - ORACLE_BASE=/u01/app/oracle
13
+ - LD_LIBRARY_PATH=$ORACLE_HOME/lib
14
+ - PATH=$PATH:$ORACLE_HOME/jdbc/lib
15
+ - DATABASE_VERSION=11.2.0.2
16
+ - ORACLE_SID=XE
17
+ - DATABASE_NAME=XE
18
+ - ORA_SDTZ='Europe/London' #Needed as a client parameter
19
+ - TZ='Europe/London' #Needed as a DB Server parameter
20
+
21
+ before_install:
22
+ - chmod +x .travis/oracle/download.sh
23
+ - chmod +x .travis/oracle/install.sh
24
+ - chmod +x .travis/setup_accounts.sh
25
+ - 'gem install bundler || gem install bundler -v 1.17.3'
26
+
27
+ install:
28
+ - .travis/oracle/download.sh
29
+ - .travis/oracle/install.sh
30
+ - .travis/setup_accounts.sh
31
+ - bundle install --without=development
32
+
33
+ language: ruby
34
+ rvm:
35
+ - 3.0.2
36
+ - 2.7.4
37
+ - 2.6.8
38
+ - 2.5.9
39
+ - 2.4.10
40
+ - 2.3.8
41
+ - jruby-9.2.17.0
42
+ - ruby-head
43
+ - jruby-head
44
+
45
+ gemfile:
46
+ - Gemfile
47
+ - gemfiles/Gemfile.activerecord-5.0
48
+ - gemfiles/Gemfile.activerecord-5.1
49
+ - gemfiles/Gemfile.activerecord-5.2
50
+ - gemfiles/Gemfile.activerecord-6.0
51
+ - gemfiles/Gemfile.activerecord-6.1
52
+ - gemfiles/Gemfile.activerecord-main
53
+
54
+ matrix:
55
+ exclude:
56
+ - gemfile: gemfiles/Gemfile.activerecord-main
57
+ rvm: jruby-head
58
+ - gemfile: gemfiles/Gemfile.activerecord-main
59
+ rvm: jruby-9.2.17.0
60
+ - gemfile: gemfiles/Gemfile.activerecord-main
61
+ rvm: 2.6.8
62
+ - gemfile: gemfiles/Gemfile.activerecord-main
63
+ rvm: 2.5.9
64
+ - gemfile: gemfiles/Gemfile.activerecord-main
65
+ rvm: 2.4.10
66
+ - gemfile: gemfiles/Gemfile.activerecord-main
67
+ rvm: 2.3.8
68
+ - gemfile: gemfiles/Gemfile.activerecord-main
69
+ rvm: 2.2.10
70
+ - gemfile: gemfiles/Gemfile.activerecord-6.0
71
+ rvm: 2.4.10
72
+ - gemfile: gemfiles/Gemfile.activerecord-6.0
73
+ rvm: 2.3.8
74
+ - gemfile: gemfiles/Gemfile.activerecord-6.0
75
+ rvm: 2.2.10
76
+ - gemfile: gemfiles/Gemfile.activerecord-6.1
77
+ rvm: 2.4.10
78
+ - gemfile: gemfiles/Gemfile.activerecord-6.1
79
+ rvm: 2.3.8
80
+ - gemfile: gemfiles/Gemfile.activerecord-6.1
81
+ rvm: 2.2.10
82
+ allow_failures:
83
+ - rvm: ruby-head
84
+ - rvm: jruby-head
85
+ - gemfile: gemfiles/Gemfile.activerecord-main
86
+ rvm: 3.0.2
87
+ - gemfile: gemfiles/Gemfile.activerecord-main
88
+ rvm: 2.7.4
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env bash
2
+
3
+ cd "$(dirname "$(readlink -f "$0")")"
4
+
5
+ deb_file=oracle-xe_11.2.0-1.0_amd64.deb
6
+
7
+ git clone https://github.com/wnameless/docker-oracle-xe-11g.git
8
+
9
+ cd docker-oracle-xe-11g/assets &&
10
+ cat "${deb_file}aa" "${deb_file}ab" "${deb_file}ac" > "${deb_file}"
11
+
12
+ pwd
13
+
14
+ ls -lAh "${deb_file}"
15
+
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+
3
+ [ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
4
+ [ -n "$ORACLE_HOME" ] || { echo "Missing ORACLE_HOME environment variable!"; exit 1; }
5
+
6
+ cd "$(dirname "$(readlink -f "$0")")"
7
+
8
+ ORACLE_DEB=docker-oracle-xe-11g/assets/oracle-xe_11.2.0-1.0_amd64.deb
9
+
10
+ sudo apt-get -qq update
11
+ sudo apt-get --no-install-recommends -qq install bc libaio1
12
+
13
+ df -B1 /dev/shm | awk 'END { if ($1 != "shmfs" && $1 != "tmpfs" || $2 < 2147483648) exit 1 }' ||
14
+ ( sudo rm -r /dev/shm && sudo mkdir /dev/shm && sudo mount -t tmpfs shmfs -o size=2G /dev/shm )
15
+
16
+ test -f /sbin/chkconfig ||
17
+ ( echo '#!/bin/sh' | sudo tee /sbin/chkconfig > /dev/null && sudo chmod u+x /sbin/chkconfig )
18
+
19
+ test -d /var/lock/subsys || sudo mkdir /var/lock/subsys
20
+
21
+ sudo dpkg -i "${ORACLE_DEB}"
22
+
23
+ echo 'OS_AUTHENT_PREFIX=""' | sudo tee -a "$ORACLE_HOME/config/scripts/init.ora" > /dev/null
24
+ echo 'disk_asynch_io=false' | sudo tee -a "$ORACLE_HOME/config/scripts/init.ora" > /dev/null
25
+ sudo usermod -aG dba $USER
26
+
27
+ ( echo ; echo ; echo travis ; echo travis ; echo n ) | sudo AWK='/usr/bin/awk' /etc/init.d/oracle-xe configure
28
+
29
+ "$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
30
+ CREATE USER $USER IDENTIFIED EXTERNALLY;
31
+ GRANT CONNECT, RESOURCE TO $USER;
32
+ SQL