activerecord-jdbc-alt-adapter 70.2.0-java → 71.0.0.alpha2-java
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.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +141 -24
- data/.github/workflows/ruby.yml +12 -12
- data/.gitignore +7 -3
- data/.solargraph.yml +15 -0
- data/Gemfile +17 -4
- data/README.md +7 -3
- data/RUNNING_TESTS.md +36 -0
- data/activerecord-jdbc-adapter.gemspec +2 -2
- data/activerecord-jdbc-alt-adapter.gemspec +1 -1
- data/lib/arjdbc/abstract/connection_management.rb +26 -10
- data/lib/arjdbc/abstract/core.rb +5 -12
- data/lib/arjdbc/abstract/database_statements.rb +35 -25
- data/lib/arjdbc/abstract/statement_cache.rb +2 -7
- data/lib/arjdbc/abstract/transaction_support.rb +37 -22
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/column.rb +0 -34
- data/lib/arjdbc/jdbc/connection_methods.rb +1 -1
- data/lib/arjdbc/mssql/adapter.rb +101 -79
- data/lib/arjdbc/mssql/column.rb +1 -0
- data/lib/arjdbc/mssql/connection_methods.rb +7 -55
- data/lib/arjdbc/mssql/database_statements.rb +182 -71
- data/lib/arjdbc/mssql/explain_support.rb +8 -5
- data/lib/arjdbc/mssql/schema_creation.rb +1 -1
- data/lib/arjdbc/mssql/schema_definitions.rb +10 -0
- data/lib/arjdbc/mssql/schema_statements.rb +25 -14
- data/lib/arjdbc/mssql/server_version.rb +56 -0
- data/lib/arjdbc/mssql/utils.rb +23 -9
- data/lib/arjdbc/mysql/adapter.rb +104 -27
- data/lib/arjdbc/postgresql/adapter.rb +71 -44
- data/lib/arjdbc/postgresql/oid_types.rb +8 -27
- data/lib/arjdbc/postgresql/schema_statements.rb +57 -0
- data/lib/arjdbc/sqlite3/adapter.rb +205 -147
- data/lib/arjdbc/sqlite3/column.rb +103 -0
- data/lib/arjdbc/sqlite3/connection_methods.rb +7 -2
- data/lib/arjdbc/tasks/mssql_database_tasks.rb +9 -5
- data/lib/arjdbc/version.rb +1 -1
- data/rakelib/02-test.rake +1 -1
- data/rakelib/rails.rake +2 -0
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +3 -1
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +11 -0
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +2 -1
- metadata +10 -12
- data/lib/arel/visitors/sql_server/ng42.rb +0 -294
- data/lib/arel/visitors/sql_server.rb +0 -124
- data/lib/arjdbc/mssql/limit_helpers.rb +0 -231
- data/lib/arjdbc/mssql/lock_methods.rb +0 -77
- data/lib/arjdbc/mssql/old_adapter.rb +0 -804
- data/lib/arjdbc/mssql/old_column.rb +0 -200
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6590c4d705c35e5a4849e4ef0bb076efba93509b8bcd8b4c2db49a4bc84b0f31
         | 
| 4 | 
            +
              data.tar.gz: cb87d9f9f2763b178f990359efecb6b1199cbe15866460bb837232fcdd8b75e1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 511e55410d149724a0765b5494a15ca4fe493bbd36b969a587d7bab23458cb32a45d34c01f79ca8b170b7f1e86fdf58e81bc4ba3ea15d464fe954a8266c41743
         | 
| 7 | 
            +
              data.tar.gz: 9fdfe69ab63373f8e31cd2d60f5ae88fd3f4499250010aab4ffbeabb9c9345f017bb012932598a84297bd63d8b28f5bc38d18213f95b19b3307a93f38ecfc775
         | 
    
        data/.github/workflows/main.yml
    CHANGED
    
    | @@ -27,13 +27,16 @@ jobs: | |
| 27 27 | 
             
                strategy:
         | 
| 28 28 | 
             
                  fail-fast: false
         | 
| 29 29 | 
             
                  matrix:
         | 
| 30 | 
            -
                    ruby-version: ['jruby-9.4. | 
| 30 | 
            +
                    ruby-version: ['jruby-9.4.8.0']
         | 
| 31 31 | 
             
                    db: ['mssql']
         | 
| 32 32 | 
             
                    test_targets: ['test_mssql']
         | 
| 33 33 |  | 
| 34 | 
            +
                # NOTE: using a specific tag, it fails with 2019-latest.
         | 
| 35 | 
            +
                # it seems the issue is related to some changes in mssql tools
         | 
| 36 | 
            +
                # https://learn.microsoft.com/en-au/answers/questions/1853144/error-failed-to-initialize-container-mcr-microsoft
         | 
| 34 37 | 
             
                services:
         | 
| 35 38 | 
             
                  mssql:
         | 
| 36 | 
            -
                    image: mcr.microsoft.com/mssql/server:2019- | 
| 39 | 
            +
                    image: mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04
         | 
| 37 40 | 
             
                    env:
         | 
| 38 41 | 
             
                      ACCEPT_EULA: Y
         | 
| 39 42 | 
             
                      MSSQL_SA_PASSWORD: Password12!
         | 
| @@ -68,22 +71,51 @@ jobs: | |
| 68 71 | 
             
                    run: |
         | 
| 69 72 | 
             
                      bundle exec rake ${{ matrix.test_targets }}
         | 
| 70 73 |  | 
| 71 | 
            -
              test- | 
| 74 | 
            +
              test-arjdbc-sqlite:
         | 
| 72 75 |  | 
| 73 | 
            -
                name:  | 
| 76 | 
            +
                name: ARJDBC Tests (SQLite)
         | 
| 74 77 | 
             
                runs-on: ubuntu-latest
         | 
| 75 78 | 
             
                strategy:
         | 
| 76 79 | 
             
                  fail-fast: false
         | 
| 77 80 | 
             
                  matrix:
         | 
| 78 | 
            -
                    ruby-version: [ | 
| 79 | 
            -
                    db: [ | 
| 80 | 
            -
                    test_targets: [ | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 81 | 
            +
                    ruby-version: ['jruby-9.4.8.0']
         | 
| 82 | 
            +
                    db: ['sqlite3']
         | 
| 83 | 
            +
                    test_targets: ['test_sqlite3']
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                env:
         | 
| 86 | 
            +
                  DB: ${{ matrix.db }}
         | 
| 87 | 
            +
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                steps:
         | 
| 90 | 
            +
                  - uses: actions/checkout@v4
         | 
| 91 | 
            +
                  - name: Set up Ruby
         | 
| 92 | 
            +
                    uses: ruby/setup-ruby@v1
         | 
| 93 | 
            +
                    with:
         | 
| 94 | 
            +
                      ruby-version: ${{ matrix.ruby-version }}
         | 
| 95 | 
            +
                      bundler-cache: true # runs 'bundle install' and caches installed gems automatically
         | 
| 96 | 
            +
                  - name: Build
         | 
| 97 | 
            +
                    run: |
         | 
| 98 | 
            +
                      rake jar
         | 
| 99 | 
            +
                  - name: Run tests
         | 
| 100 | 
            +
                    run: |
         | 
| 101 | 
            +
                      bundle exec rake ${{ matrix.test_targets }}
         | 
| 102 | 
            +
             | 
| 103 | 
            +
              test-arjdbc-pgsql:
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                name: ARJDBC Tests (Postgres)
         | 
| 106 | 
            +
                runs-on: ubuntu-latest
         | 
| 107 | 
            +
                strategy:
         | 
| 108 | 
            +
                  fail-fast: false
         | 
| 109 | 
            +
                  matrix:
         | 
| 110 | 
            +
                    ruby-version: ['jruby-9.4.8.0']
         | 
| 111 | 
            +
                    db: ['postgresql']
         | 
| 112 | 
            +
                    test_targets: ["db:postgresql test_postgresql"]
         | 
| 113 | 
            +
                    prepared_statements: ['false', 'true']
         | 
| 114 | 
            +
                    insert_returning: ['false', 'true']
         | 
| 83 115 |  | 
| 84 116 | 
             
                services:
         | 
| 85 117 | 
             
                  postgres:
         | 
| 86 | 
            -
                    image: postgres: | 
| 118 | 
            +
                    image: postgres:11
         | 
| 87 119 | 
             
                    env:
         | 
| 88 120 | 
             
                      POSTGRES_PASSWORD: postgres
         | 
| 89 121 | 
             
                      POSTGRES_HOST_AUTH_METHOD: trust
         | 
| @@ -93,16 +125,64 @@ jobs: | |
| 93 125 |  | 
| 94 126 | 
             
                env:
         | 
| 95 127 | 
             
                  DB: ${{ matrix.db }}
         | 
| 96 | 
            -
                  AR_VERSION: ${{ matrix.ar_version }}
         | 
| 97 128 | 
             
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
         | 
| 98 129 | 
             
                  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
         | 
| 99 | 
            -
                   | 
| 130 | 
            +
                  INSERT_RETURNING: ${{ matrix.insert_returning }}
         | 
| 100 131 | 
             
                  PGHOST: localhost
         | 
| 101 132 | 
             
                  PGPORT: 5432
         | 
| 102 133 | 
             
                  PGUSER: postgres
         | 
| 103 134 |  | 
| 104 135 | 
             
                steps:
         | 
| 105 136 | 
             
                  - uses: actions/checkout@v3
         | 
| 137 | 
            +
                  - name: Set up Ruby
         | 
| 138 | 
            +
                    uses: ruby/setup-ruby@v1
         | 
| 139 | 
            +
                    with:
         | 
| 140 | 
            +
                      ruby-version: ${{ matrix.ruby-version }}
         | 
| 141 | 
            +
                      bundler-cache: true # runs 'bundle install' and caches installed gems automatically
         | 
| 142 | 
            +
                  - name: Build
         | 
| 143 | 
            +
                    run: |
         | 
| 144 | 
            +
                      rake jar
         | 
| 145 | 
            +
                  - name: Run tests
         | 
| 146 | 
            +
                    run: |
         | 
| 147 | 
            +
                      bundle exec rake ${{ matrix.test_targets }}
         | 
| 148 | 
            +
             | 
| 149 | 
            +
              test-rails-mssql:
         | 
| 150 | 
            +
             | 
| 151 | 
            +
                name: Rails Tests (mssql)
         | 
| 152 | 
            +
                runs-on: ubuntu-latest
         | 
| 153 | 
            +
                strategy:
         | 
| 154 | 
            +
                  fail-fast: false
         | 
| 155 | 
            +
                  matrix:
         | 
| 156 | 
            +
                    ruby-version: [ 'jruby-9.4.8.0' ]
         | 
| 157 | 
            +
                    db: [ 'mssql' ]
         | 
| 158 | 
            +
                    test_targets: [ "rails:test_mssql" ]
         | 
| 159 | 
            +
                    ar_version: ["7-1-stable-dev"]
         | 
| 160 | 
            +
             | 
| 161 | 
            +
                services:
         | 
| 162 | 
            +
                  mssql:
         | 
| 163 | 
            +
                    image: mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04
         | 
| 164 | 
            +
                    env:
         | 
| 165 | 
            +
                      ACCEPT_EULA: Y
         | 
| 166 | 
            +
                      MSSQL_SA_PASSWORD: Password12!
         | 
| 167 | 
            +
                    ports:
         | 
| 168 | 
            +
                      - 1433:1433
         | 
| 169 | 
            +
                    options: >-
         | 
| 170 | 
            +
                      --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P \"Password12!\" -l 30 -Q \"SELECT 1\""
         | 
| 171 | 
            +
                      --health-start-period 10s
         | 
| 172 | 
            +
                      --health-interval 10s
         | 
| 173 | 
            +
                      --health-timeout 5s
         | 
| 174 | 
            +
                      --health-retries 10
         | 
| 175 | 
            +
             | 
| 176 | 
            +
                env:
         | 
| 177 | 
            +
                  DB: ${{ matrix.db }}
         | 
| 178 | 
            +
                  AR_VERSION: ${{ matrix.ar_version }}
         | 
| 179 | 
            +
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
         | 
| 180 | 
            +
                  JDBC_SQLITE_VERSION: "3.32.3.3"
         | 
| 181 | 
            +
                  SQLUSER: SA
         | 
| 182 | 
            +
                  SQLPASS: Password12!
         | 
| 183 | 
            +
             | 
| 184 | 
            +
                steps:
         | 
| 185 | 
            +
                  - uses: actions/checkout@v4
         | 
| 106 186 | 
             
                  - name: Set up Ruby
         | 
| 107 187 | 
             
                    uses: ruby/setup-ruby@v1
         | 
| 108 188 | 
             
                    with:
         | 
| @@ -110,8 +190,8 @@ jobs: | |
| 110 190 | 
             
                      bundler-cache: true # runs 'bundle install' and caches installed gems automatically
         | 
| 111 191 | 
             
                  - name: Setup database
         | 
| 112 192 | 
             
                    run: |
         | 
| 113 | 
            -
                       | 
| 114 | 
            -
                       | 
| 193 | 
            +
                      /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE jdbc_arunit;"
         | 
| 194 | 
            +
                      /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE jdbc_arunit2;"
         | 
| 115 195 | 
             
                  - name: Build
         | 
| 116 196 | 
             
                    run: |
         | 
| 117 197 | 
             
                      rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
         | 
| @@ -119,22 +199,54 @@ jobs: | |
| 119 199 | 
             
                    run: |
         | 
| 120 200 | 
             
                      bundle exec rake ${{ matrix.test_targets }}
         | 
| 121 201 |  | 
| 122 | 
            -
              test- | 
| 202 | 
            +
              test-rails-sqlite:
         | 
| 123 203 |  | 
| 124 | 
            -
                name:  | 
| 204 | 
            +
                name: Rails Tests (SQLite)
         | 
| 125 205 | 
             
                runs-on: ubuntu-latest
         | 
| 126 206 | 
             
                strategy:
         | 
| 127 207 | 
             
                  fail-fast: false
         | 
| 128 208 | 
             
                  matrix:
         | 
| 129 | 
            -
                    ruby-version: ['jruby-9.4. | 
| 130 | 
            -
                    db: [' | 
| 131 | 
            -
                    test_targets: [" | 
| 132 | 
            -
                     | 
| 133 | 
            -
             | 
| 209 | 
            +
                    ruby-version: ['jruby-9.4.8.0']
         | 
| 210 | 
            +
                    db: ['sqlite3']
         | 
| 211 | 
            +
                    test_targets: ["rails:test_sqlite3"]
         | 
| 212 | 
            +
                    ar_version: ["7-1-stable"]
         | 
| 213 | 
            +
             | 
| 214 | 
            +
                env:
         | 
| 215 | 
            +
                  DB: ${{ matrix.db }}
         | 
| 216 | 
            +
                  AR_VERSION: ${{ matrix.ar_version }}
         | 
| 217 | 
            +
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
         | 
| 218 | 
            +
             | 
| 219 | 
            +
                steps:
         | 
| 220 | 
            +
                  - uses: actions/checkout@v4
         | 
| 221 | 
            +
                  - name: Set up Ruby
         | 
| 222 | 
            +
                    uses: ruby/setup-ruby@v1
         | 
| 223 | 
            +
                    with:
         | 
| 224 | 
            +
                      ruby-version: ${{ matrix.ruby-version }}
         | 
| 225 | 
            +
                      bundler-cache: true # runs 'bundle install' and caches installed gems automatically
         | 
| 226 | 
            +
                  - name: Build
         | 
| 227 | 
            +
                    run: |
         | 
| 228 | 
            +
                      echo "JAVA_OPTS=$JAVA_OPTS"
         | 
| 229 | 
            +
                      rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
         | 
| 230 | 
            +
                  - name: Run tests
         | 
| 231 | 
            +
                    run: |
         | 
| 232 | 
            +
                      bundle exec rake ${{ matrix.test_targets }}
         | 
| 233 | 
            +
             | 
| 234 | 
            +
              test-rails-pgsql:
         | 
| 235 | 
            +
             | 
| 236 | 
            +
                name: Rails Tests (Postgres)
         | 
| 237 | 
            +
                runs-on: ubuntu-latest
         | 
| 238 | 
            +
                strategy:
         | 
| 239 | 
            +
                  fail-fast: false
         | 
| 240 | 
            +
                  matrix:
         | 
| 241 | 
            +
                    ruby-version: [ 'jruby-9.4.8.0' ]
         | 
| 242 | 
            +
                    db: [ 'postgresql' ]
         | 
| 243 | 
            +
                    test_targets: [ "rails:test_postgresql" ]
         | 
| 244 | 
            +
                    ar_version: ["7-1-stable"]
         | 
| 245 | 
            +
                    prepared_statements: [ 'false', 'true' ]
         | 
| 134 246 |  | 
| 135 247 | 
             
                services:
         | 
| 136 248 | 
             
                  postgres:
         | 
| 137 | 
            -
                    image: postgres: | 
| 249 | 
            +
                    image: postgres:11
         | 
| 138 250 | 
             
                    env:
         | 
| 139 251 | 
             
                      POSTGRES_PASSWORD: postgres
         | 
| 140 252 | 
             
                      POSTGRES_HOST_AUTH_METHOD: trust
         | 
| @@ -144,9 +256,10 @@ jobs: | |
| 144 256 |  | 
| 145 257 | 
             
                env:
         | 
| 146 258 | 
             
                  DB: ${{ matrix.db }}
         | 
| 259 | 
            +
                  AR_VERSION: ${{ matrix.ar_version }}
         | 
| 147 260 | 
             
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
         | 
| 148 261 | 
             
                  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
         | 
| 149 | 
            -
                   | 
| 262 | 
            +
                  JDBC_SQLITE_VERSION: "3.32.3.3"
         | 
| 150 263 | 
             
                  PGHOST: localhost
         | 
| 151 264 | 
             
                  PGPORT: 5432
         | 
| 152 265 | 
             
                  PGUSER: postgres
         | 
| @@ -158,9 +271,13 @@ jobs: | |
| 158 271 | 
             
                    with:
         | 
| 159 272 | 
             
                      ruby-version: ${{ matrix.ruby-version }}
         | 
| 160 273 | 
             
                      bundler-cache: true # runs 'bundle install' and caches installed gems automatically
         | 
| 274 | 
            +
                  - name: Setup database
         | 
| 275 | 
            +
                    run: |
         | 
| 276 | 
            +
                      psql -c "create database activerecord_unittest;" -U postgres
         | 
| 277 | 
            +
                      psql -c "create database activerecord_unittest2;" -U postgres
         | 
| 161 278 | 
             
                  - name: Build
         | 
| 162 279 | 
             
                    run: |
         | 
| 163 | 
            -
                      rake jar
         | 
| 280 | 
            +
                      rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
         | 
| 164 281 | 
             
                  - name: Run tests
         | 
| 165 282 | 
             
                    run: |
         | 
| 166 283 | 
             
                      bundle exec rake ${{ matrix.test_targets }}
         | 
    
        data/.github/workflows/ruby.yml
    CHANGED
    
    | @@ -27,7 +27,7 @@ jobs: | |
| 27 27 | 
             
                    ruby-version: ['jruby-head']
         | 
| 28 28 | 
             
                    db: ['mysql2']
         | 
| 29 29 | 
             
                    test_targets: ["rails:test_mysql2"]
         | 
| 30 | 
            -
                    ar_version: ["7- | 
| 30 | 
            +
                    ar_version: ["7-1-stable"]
         | 
| 31 31 | 
             
                    prepared_statements: ['false', 'true']
         | 
| 32 32 | 
             
                    driver: ['MySQL']
         | 
| 33 33 |  | 
| @@ -45,7 +45,7 @@ jobs: | |
| 45 45 | 
             
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
         | 
| 46 46 |  | 
| 47 47 | 
             
                steps:
         | 
| 48 | 
            -
                  - uses: actions/checkout@ | 
| 48 | 
            +
                  - uses: actions/checkout@v4
         | 
| 49 49 | 
             
                  - name: Set up Ruby
         | 
| 50 50 | 
             
                    uses: ruby/setup-ruby@v1
         | 
| 51 51 | 
             
                    with:
         | 
| @@ -79,12 +79,12 @@ jobs: | |
| 79 79 | 
             
                    ruby-version: [ 'jruby-head' ]
         | 
| 80 80 | 
             
                    db: [ 'postgresql' ]
         | 
| 81 81 | 
             
                    test_targets: [ "rails:test_postgresql" ]
         | 
| 82 | 
            -
                    ar_version: ["7- | 
| 82 | 
            +
                    ar_version: ["7-1-stable"]
         | 
| 83 83 | 
             
                    prepared_statements: [ 'false', 'true' ]
         | 
| 84 84 |  | 
| 85 85 | 
             
                services:
         | 
| 86 86 | 
             
                  postgres:
         | 
| 87 | 
            -
                    image: postgres: | 
| 87 | 
            +
                    image: postgres:11
         | 
| 88 88 | 
             
                    env:
         | 
| 89 89 | 
             
                      POSTGRES_PASSWORD: postgres
         | 
| 90 90 | 
             
                      POSTGRES_HOST_AUTH_METHOD: trust
         | 
| @@ -102,7 +102,7 @@ jobs: | |
| 102 102 | 
             
                  PGUSER: postgres
         | 
| 103 103 |  | 
| 104 104 | 
             
                steps:
         | 
| 105 | 
            -
                  - uses: actions/checkout@ | 
| 105 | 
            +
                  - uses: actions/checkout@v4
         | 
| 106 106 | 
             
                  - name: Set up Ruby
         | 
| 107 107 | 
             
                    uses: ruby/setup-ruby@v1
         | 
| 108 108 | 
             
                    with:
         | 
| @@ -129,7 +129,7 @@ jobs: | |
| 129 129 | 
             
                    ruby-version: ['jruby-head']
         | 
| 130 130 | 
             
                    db: ['sqlite3']
         | 
| 131 131 | 
             
                    test_targets: ["rails:test_sqlite3"]
         | 
| 132 | 
            -
                    ar_version: ["7- | 
| 132 | 
            +
                    ar_version: ["7-1-stable", "main"]
         | 
| 133 133 |  | 
| 134 134 | 
             
                env:
         | 
| 135 135 | 
             
                  DB: ${{ matrix.db }}
         | 
| @@ -137,7 +137,7 @@ jobs: | |
| 137 137 | 
             
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
         | 
| 138 138 |  | 
| 139 139 | 
             
                steps:
         | 
| 140 | 
            -
                  - uses: actions/checkout@ | 
| 140 | 
            +
                  - uses: actions/checkout@v4
         | 
| 141 141 | 
             
                  - name: Set up Ruby
         | 
| 142 142 | 
             
                    uses: ruby/setup-ruby@v1
         | 
| 143 143 | 
             
                    with:
         | 
| @@ -179,7 +179,7 @@ jobs: | |
| 179 179 | 
             
                  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
         | 
| 180 180 |  | 
| 181 181 | 
             
                steps:
         | 
| 182 | 
            -
                  - uses: actions/checkout@ | 
| 182 | 
            +
                  - uses: actions/checkout@v4
         | 
| 183 183 | 
             
                  - name: Set up Ruby
         | 
| 184 184 | 
             
                    uses: ruby/setup-ruby@v1
         | 
| 185 185 | 
             
                    with:
         | 
| @@ -211,7 +211,7 @@ jobs: | |
| 211 211 |  | 
| 212 212 | 
             
                services:
         | 
| 213 213 | 
             
                  postgres:
         | 
| 214 | 
            -
                    image: postgres: | 
| 214 | 
            +
                    image: postgres:11
         | 
| 215 215 | 
             
                    env:
         | 
| 216 216 | 
             
                      POSTGRES_PASSWORD: postgres
         | 
| 217 217 | 
             
                      POSTGRES_HOST_AUTH_METHOD: trust
         | 
| @@ -230,7 +230,7 @@ jobs: | |
| 230 230 | 
             
                  PGUSER: postgres
         | 
| 231 231 |  | 
| 232 232 | 
             
                steps:
         | 
| 233 | 
            -
                  - uses: actions/checkout@ | 
| 233 | 
            +
                  - uses: actions/checkout@v4
         | 
| 234 234 | 
             
                  - name: Set up Ruby
         | 
| 235 235 | 
             
                    uses: ruby/setup-ruby@v1
         | 
| 236 236 | 
             
                    with:
         | 
| @@ -256,10 +256,10 @@ jobs: | |
| 256 256 |  | 
| 257 257 | 
             
                env:
         | 
| 258 258 | 
             
                  DB: ${{ matrix.db }}
         | 
| 259 | 
            -
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
         | 
| 259 | 
            +
                  JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
         | 
| 260 260 |  | 
| 261 261 | 
             
                steps:
         | 
| 262 | 
            -
                  - uses: actions/checkout@ | 
| 262 | 
            +
                  - uses: actions/checkout@v4
         | 
| 263 263 | 
             
                  - name: Set up Ruby
         | 
| 264 264 | 
             
                    uses: ruby/setup-ruby@v1
         | 
| 265 265 | 
             
                    with:
         | 
    
        data/.gitignore
    CHANGED
    
    | @@ -15,9 +15,12 @@ coverage | |
| 15 15 | 
             
            build.xml
         | 
| 16 16 | 
             
            nbproject
         | 
| 17 17 | 
             
            .classpath
         | 
| 18 | 
            +
            .ruby-version
         | 
| 18 19 | 
             
            .project
         | 
| 19 20 | 
             
            *.sqlite
         | 
| 20 21 | 
             
            *.sqlite3
         | 
| 22 | 
            +
            *.sqlite3-shm
         | 
| 23 | 
            +
            *.sqlite3-wal
         | 
| 21 24 | 
             
            *.derby
         | 
| 22 25 | 
             
            derby.log
         | 
| 23 26 | 
             
            test.hsqldb*
         | 
| @@ -32,8 +35,9 @@ Gemfile.lock | |
| 32 35 | 
             
            .settings
         | 
| 33 36 | 
             
            activerecord-jdbc.iml
         | 
| 34 37 | 
             
            lib/arjdbc/jdbc/adapter_java.jar
         | 
| 35 | 
            -
            .jrubyrc
         | 
| 36 38 | 
             
            tags
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            .ruby-version
         | 
| 39 | 
            +
            .jrubyrc
         | 
| 39 40 | 
             
            .rubocop.yml
         | 
| 41 | 
            +
            .solargraph.yml
         | 
| 42 | 
            +
            pik.sh
         | 
| 43 | 
            +
            .tool-versions
         | 
    
        data/.solargraph.yml
    ADDED
    
    
    
        data/Gemfile
    CHANGED
    
    | @@ -34,17 +34,24 @@ elsif ENV['AR_VERSION'] # Use specific version of AR and not .gemspec version | |
| 34 34 | 
             
                    opts = {branch: version}
         | 
| 35 35 | 
             
                  end
         | 
| 36 36 |  | 
| 37 | 
            -
                  git 'https://github.com/ | 
| 37 | 
            +
                  git 'https://github.com/JesseChavez/rails.git', **opts do
         | 
| 38 38 | 
             
                    gem 'activerecord', require: false
         | 
| 39 39 | 
             
                    gem 'activemodel', require: false
         | 
| 40 40 | 
             
                    gem 'activesupport', require: false
         | 
| 41 41 | 
             
                    gem 'actionpack', require: false
         | 
| 42 42 | 
             
                    gem 'actionview', require: false
         | 
| 43 43 | 
             
                  end
         | 
| 44 | 
            +
                  
         | 
| 44 45 | 
             
                end
         | 
| 45 46 | 
             
              end
         | 
| 46 47 | 
             
            else
         | 
| 47 | 
            -
               | 
| 48 | 
            +
              if defined? JRUBY_VERSION
         | 
| 49 | 
            +
                gemspec name: 'activerecord-jdbc-alt-adapter' # Use versiom from .gemspec
         | 
| 50 | 
            +
              else # read add_dependency 'activerecord', '~> 7.0' and use the same requirement on MRI
         | 
| 51 | 
            +
                ar_req = File.read('activerecord-jdbc-adapter.gemspec').match(/add_dependency.*?activerecord.*['"](.*?)['"]/)[1]
         | 
| 52 | 
            +
                raise "add_dependency 'activerecord', ... line not detected in gemspec" unless ar_req
         | 
| 53 | 
            +
                gem 'activerecord', ar_req
         | 
| 54 | 
            +
              end
         | 
| 48 55 | 
             
            end
         | 
| 49 56 |  | 
| 50 57 | 
             
            gem 'rake', require: nil
         | 
| @@ -72,6 +79,10 @@ group :rails do | |
| 72 79 | 
             
              gem 'builder', require: nil
         | 
| 73 80 |  | 
| 74 81 | 
             
              gem 'erubis', require: nil # "~> 2.7.0"
         | 
| 82 | 
            +
             | 
| 83 | 
            +
              # Due to rails/activesupport/lib/active_support/message_pack.rb
         | 
| 84 | 
            +
              gem 'msgpack', '>= 1.7.0', require: false
         | 
| 85 | 
            +
             | 
| 75 86 | 
             
              # NOTE: due rails/activerecord/test/cases/connection_management_test.rb
         | 
| 76 87 | 
             
              gem 'rack', require: nil
         | 
| 77 88 |  | 
| @@ -79,7 +90,7 @@ group :rails do | |
| 79 90 | 
             
            end
         | 
| 80 91 |  | 
| 81 92 | 
             
            group :development do
         | 
| 82 | 
            -
              gem 'ruby-debug', require: nil # if ENV['DEBUG']
         | 
| 93 | 
            +
              #gem 'ruby-debug', require: nil # if ENV['DEBUG']
         | 
| 83 94 | 
             
              group :doc do
         | 
| 84 95 | 
             
                gem 'yard', require: nil
         | 
| 85 96 | 
             
                gem 'kramdown', require: nil
         | 
| @@ -94,10 +105,12 @@ group :test do | |
| 94 105 |  | 
| 95 106 | 
             
              gem 'mysql2', '>= 0.4.4', require: nil, platform: :mri
         | 
| 96 107 | 
             
              gem 'pg', '>= 0.18.0', require: nil, platform: :mri
         | 
| 97 | 
            -
              gem 'sqlite3', '~> 1. | 
| 108 | 
            +
              gem 'sqlite3', '~> 1.4', require: nil, platform: :mri
         | 
| 98 109 |  | 
| 99 110 | 
             
              # group :mssql do
         | 
| 100 111 | 
             
              #   gem 'tiny_tds', require: nil, platform: :mri
         | 
| 101 112 | 
             
              #   gem 'activerecord-sqlserver-adapter', require: nil, platform: :mri
         | 
| 102 113 | 
             
              # end
         | 
| 103 114 | 
             
            end
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            gem 'pry-nav'
         | 
    
        data/README.md
    CHANGED
    
    | @@ -143,10 +143,14 @@ Versions are targeted at certain versions of Rails and live on their own branche | |
| 143 143 | 
             
            | 51.x        | 5.1.x         | 51-stable | 9.1.x     | 7        |
         | 
| 144 144 | 
             
            | 52.x        | 5.2.x         | 52-stable | 9.1.x     | 7        |
         | 
| 145 145 | 
             
            | 60.x        | 6.0.x         | 60-stable | 9.2.7     | 8        |
         | 
| 146 | 
            -
            | 61.x        | 6.1.x         |  | 
| 146 | 
            +
            | 61.x        | 6.1.x         | 61-stable | 9.2.7     | 8        |
         | 
| 147 | 
            +
            | 70.x        | 7.0.x         | 70-stable | 9.3.0     | 8        |
         | 
| 148 | 
            +
            | 71.x        | 7.1.x         | master    | 9.4.3     | 8        |
         | 
| 147 149 |  | 
| 148 | 
            -
            Note  | 
| 149 | 
            -
             | 
| 150 | 
            +
            Note: 71.x is still under development and not supported yet.
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            Note that JRuby 9.1.x and JRuby 9.2.x are at end-of-life. We recommend Java 8
         | 
| 153 | 
            +
            at a minimum for all versions.
         | 
| 150 154 |  | 
| 151 155 | 
             
            ## Using ActiveRecord JDBC
         | 
| 152 156 |  | 
    
        data/RUNNING_TESTS.md
    CHANGED
    
    | @@ -16,6 +16,8 @@ Rake tasks are loaded from **rakelib/02-test-rake**, most adapters have a | |
| 16 16 | 
             
            corresponding test_[adapter] task e.g. `rake test_sqlite3` that run against DB.
         | 
| 17 17 | 
             
            To check all available (test related) tasks simply `rake -T | grep test`.
         | 
| 18 18 |  | 
| 19 | 
            +
            ### Database Setup
         | 
| 20 | 
            +
             | 
| 19 21 | 
             
            If the adapter supports creating a database it will try to do so automatically
         | 
| 20 22 | 
             
            (most embed databases such as SQLite3) for some adapters (MySQL, PostgreSQL) we
         | 
| 21 23 | 
             
            do this auto-magically (see the `rake db:create` tasks), but otherwise you'll
         | 
| @@ -48,6 +50,40 @@ but one can easily run tests with prepared statements disabled using env vars : | |
| 48 50 |  | 
| 49 51 | 
             
                rake test_derby PREPARED_STATEMENTS=false
         | 
| 50 52 |  | 
| 53 | 
            +
            #### MySQL with Docker
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            The standard Docker MySQL image can be used for testing and development. Depending on your environment these commands
         | 
| 56 | 
            +
            may need to be run as root.
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            Pull the image:
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            ```
         | 
| 61 | 
            +
            sudo docker pull mysql
         | 
| 62 | 
            +
            ```
         | 
| 63 | 
            +
             | 
| 64 | 
            +
            Start up the database with a root password (we show a simple one here but pick one no one else knows):
         | 
| 65 | 
            +
             | 
| 66 | 
            +
            ```
         | 
| 67 | 
            +
            docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=testtest9 -d mysql
         | 
| 68 | 
            +
            ```
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            The `mysql` client can be run through Docker as well:
         | 
| 71 | 
            +
             | 
| 72 | 
            +
            ```sh
         | 
| 73 | 
            +
            docker run -it --link mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
         | 
| 74 | 
            +
            ```
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            Set up the database for the unit tests (you may need to replace 'localhost' with your container's IP):
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            ```sql
         | 
| 79 | 
            +
            CREATE USER 'rails'@'localhost' IDENTIFIED BY 'testtest9';
         | 
| 80 | 
            +
            CREATE DATABASE activerecord_unittest;
         | 
| 81 | 
            +
            GRANT ALL PRIVILEGES ON activerecord_unittest.* TO 'rails'@'localhost';
         | 
| 82 | 
            +
            CREATE DATABASE activerecord_unittest2;
         | 
| 83 | 
            +
            GRANT ALL PRIVILEGES ON activerecord_unittest2.* TO 'rails'@'localhost';
         | 
| 84 | 
            +
            ```
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            Then edit test/rails/config.yml for the appropriate configuration credentials.
         | 
| 51 87 |  | 
| 52 88 | 
             
            ### ActiveRecord (Rails) Tests
         | 
| 53 89 |  | 
| @@ -14,7 +14,7 @@ Gem::Specification.new do |gem| | |
| 14 14 | 
             
                "AR-JDBC is a database adapter for Rails' ActiveRecord component " <<
         | 
| 15 15 | 
             
                "designed to be used with JRuby built upon Java's JDBC API for " <<
         | 
| 16 16 | 
             
                "database access. Provides (ActiveRecord) built-in adapters: MySQL,  " <<
         | 
| 17 | 
            -
                "PostgreSQL,  | 
| 17 | 
            +
                "PostgreSQL, and SQLite3."
         | 
| 18 18 |  | 
| 19 19 | 
             
              gem.require_paths = ["lib"]
         | 
| 20 20 |  | 
| @@ -41,7 +41,7 @@ Gem::Specification.new do |gem| | |
| 41 41 | 
             
              gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
         | 
| 42 42 | 
             
              gem.test_files = gem.files.grep(%r{^test/})
         | 
| 43 43 |  | 
| 44 | 
            -
              gem.add_dependency 'activerecord', '~> 7. | 
| 44 | 
            +
              gem.add_dependency 'activerecord', '~> 7.1.3'
         | 
| 45 45 |  | 
| 46 46 | 
             
              #gem.add_development_dependency 'test-unit', '2.5.4'
         | 
| 47 47 | 
             
              #gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
         | 
| @@ -43,7 +43,7 @@ Gem::Specification.new do |gem| | |
| 43 43 | 
             
              gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
         | 
| 44 44 | 
             
              gem.test_files = gem.files.grep(%r{^test/})
         | 
| 45 45 |  | 
| 46 | 
            -
              gem.add_dependency 'activerecord', '~> 7. | 
| 46 | 
            +
              gem.add_dependency 'activerecord', '~> 7.1.3'
         | 
| 47 47 |  | 
| 48 48 | 
             
              #gem.add_development_dependency 'test-unit', '2.5.4'
         | 
| 49 49 | 
             
              #gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
         | 
| @@ -6,29 +6,28 @@ module ArJdbc | |
| 6 6 |  | 
| 7 7 | 
             
                  # @override
         | 
| 8 8 | 
             
                  def active?
         | 
| 9 | 
            -
                     | 
| 10 | 
            -
                    @connection.active?
         | 
| 9 | 
            +
                    @raw_connection&.active?
         | 
| 11 10 | 
             
                  end
         | 
| 12 11 |  | 
| 13 12 | 
             
                  def really_valid?
         | 
| 14 | 
            -
                     | 
| 15 | 
            -
                    @connection.really_valid?
         | 
| 13 | 
            +
                    @raw_connection&.really_valid?
         | 
| 16 14 | 
             
                  end
         | 
| 17 15 |  | 
| 18 16 | 
             
                  # @override
         | 
| 19 | 
            -
                   | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
                   | 
| 17 | 
            +
                  # Removed to fix sqlite adapter, may be needed for others
         | 
| 18 | 
            +
                  # def reconnect!
         | 
| 19 | 
            +
                  #   super # clear_cache! && reset_transaction
         | 
| 20 | 
            +
                  #   @connection.reconnect! # handles adapter.configure_connection
         | 
| 21 | 
            +
                  # end
         | 
| 23 22 |  | 
| 24 23 | 
             
                  # @override
         | 
| 25 24 | 
             
                  def disconnect!
         | 
| 26 25 | 
             
                    super # clear_cache! && reset_transaction
         | 
| 27 | 
            -
                     | 
| 28 | 
            -
                    @connection.disconnect!
         | 
| 26 | 
            +
                    @raw_connection&.disconnect!
         | 
| 29 27 | 
             
                  end
         | 
| 30 28 |  | 
| 31 29 | 
             
                  # @override
         | 
| 30 | 
            +
                  # Removed to fix sqlite adapter, may be needed for others
         | 
| 32 31 | 
             
                  # def verify!(*ignored)
         | 
| 33 32 | 
             
                  #  if @connection && @connection.jndi?
         | 
| 34 33 | 
             
                  #    # checkout call-back does #reconnect!
         | 
| @@ -37,6 +36,23 @@ module ArJdbc | |
| 37 36 | 
             
                  #  end
         | 
| 38 37 | 
             
                  # end
         | 
| 39 38 |  | 
| 39 | 
            +
                  private
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  # DIFFERENCE: we delve into jdbc shared code and this does self.class.new_client.
         | 
| 42 | 
            +
                  def connect
         | 
| 43 | 
            +
                    @raw_connection = self.class.new_client(@connection_parameters, self)
         | 
| 44 | 
            +
                  rescue ActiveRecord::ConnectionNotEstablished => ex
         | 
| 45 | 
            +
                    raise ex.set_pool(@pool)
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                  def reconnect
         | 
| 49 | 
            +
                    if active?
         | 
| 50 | 
            +
                      @raw_connection.rollback rescue nil
         | 
| 51 | 
            +
                    else
         | 
| 52 | 
            +
                      connect
         | 
| 53 | 
            +
                    end
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
             | 
| 40 56 | 
             
                end
         | 
| 41 57 | 
             
              end
         | 
| 42 58 | 
             
            end
         | 
    
        data/lib/arjdbc/abstract/core.rb
    CHANGED
    
    | @@ -2,27 +2,17 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module ArJdbc
         | 
| 4 4 | 
             
              module Abstract
         | 
| 5 | 
            -
             | 
| 6 5 | 
             
                # This is minimum amount of code needed from base JDBC Adapter class to make common adapters
         | 
| 7 6 | 
             
                # work.  This replaces using jdbc/adapter as a base class for all adapters.
         | 
| 8 7 | 
             
                module Core
         | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
                  def initialize(connection, logger = nil, config = {})
         | 
| 13 | 
            -
                    @config = config
         | 
| 8 | 
            +
                  def initialize(...)
         | 
| 9 | 
            +
                    super
         | 
| 14 10 |  | 
| 15 11 | 
             
                    if self.class.equal? ActiveRecord::ConnectionAdapters::JdbcAdapter
         | 
| 16 12 | 
             
                      spec = @config.key?(:adapter_spec) ? @config[:adapter_spec] :
         | 
| 17 13 | 
             
                                 ( @config[:adapter_spec] = adapter_spec(@config) ) # due resolving visitor
         | 
| 18 14 | 
             
                      extend spec if spec
         | 
| 19 15 | 
             
                    end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                    connection ||= jdbc_connection_class(config[:adapter_spec]).new(config, self)
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                    super(connection, logger, config) # AbstractAdapter
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                    connection.configure_connection # will call us (maybe)
         | 
| 26 16 | 
             
                  end
         | 
| 27 17 |  | 
| 28 18 | 
             
                  # Retrieve the raw `java.sql.Connection` object.
         | 
| @@ -56,6 +46,9 @@ module ArJdbc | |
| 56 46 | 
             
                    # swallow an ArJdbc / driver bug into an AR::StatementInvalid !
         | 
| 57 47 | 
             
                    return exception if exception.is_a?(Throwable)
         | 
| 58 48 |  | 
| 49 | 
            +
                    # We create this exception in Java where we do not have access to the pool
         | 
| 50 | 
            +
                    exception.instance_variable_set(:@connection_pool, @pool) if exception.kind_of?(::ActiveRecord::JDBCError)
         | 
| 51 | 
            +
             | 
| 59 52 | 
             
                    case exception
         | 
| 60 53 | 
             
                      when SystemExit, SignalException, NoMemoryError then exception
         | 
| 61 54 | 
             
                      when ActiveModel::RangeError, TypeError, RuntimeError then exception
         |