activerecord-jdbc-adapter 60.0.rc1-java → 60.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.travis.yml +42 -30
  4. data/README.md +36 -18
  5. data/Rakefile +30 -4
  6. data/Rakefile.jdbc +8 -1
  7. data/activerecord-jdbc-adapter.gemspec +6 -9
  8. data/lib/arjdbc/abstract/connection_management.rb +5 -0
  9. data/lib/arjdbc/abstract/core.rb +1 -1
  10. data/lib/arjdbc/abstract/database_statements.rb +8 -21
  11. data/lib/arjdbc/db2/adapter.rb +11 -0
  12. data/lib/arjdbc/db2/column.rb +0 -39
  13. data/lib/arjdbc/derby/adapter.rb +1 -20
  14. data/lib/arjdbc/firebird/adapter.rb +0 -21
  15. data/lib/arjdbc/h2/adapter.rb +0 -15
  16. data/lib/arjdbc/hsqldb/adapter.rb +0 -14
  17. data/lib/arjdbc/informix/adapter.rb +0 -23
  18. data/lib/arjdbc/jdbc.rb +0 -4
  19. data/lib/arjdbc/jdbc/adapter.rb +4 -0
  20. data/lib/arjdbc/jdbc/column.rb +1 -5
  21. data/lib/arjdbc/mysql/adapter.rb +12 -1
  22. data/lib/arjdbc/mysql/connection_methods.rb +13 -7
  23. data/lib/arjdbc/postgresql/adapter.rb +10 -19
  24. data/lib/arjdbc/postgresql/column.rb +6 -3
  25. data/lib/arjdbc/postgresql/connection_methods.rb +3 -1
  26. data/lib/arjdbc/sqlite3/adapter.rb +14 -21
  27. data/lib/arjdbc/sqlite3/connection_methods.rb +1 -0
  28. data/lib/arjdbc/tasks/databases.rake +3 -1
  29. data/lib/arjdbc/version.rb +1 -1
  30. data/rakelib/02-test.rake +0 -3
  31. data/rakelib/rails.rake +1 -1
  32. data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +103 -33
  33. data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +259 -14
  34. data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +1 -13
  35. data/src/java/arjdbc/util/DateTimeUtils.java +34 -12
  36. metadata +8 -22
  37. data/lib/active_record/connection_adapters/mssql_adapter.rb +0 -1
  38. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +0 -1
  39. data/lib/arjdbc/mssql.rb +0 -7
  40. data/lib/arjdbc/mssql/adapter.rb +0 -804
  41. data/lib/arjdbc/mssql/column.rb +0 -200
  42. data/lib/arjdbc/mssql/connection_methods.rb +0 -79
  43. data/lib/arjdbc/mssql/explain_support.rb +0 -99
  44. data/lib/arjdbc/mssql/limit_helpers.rb +0 -231
  45. data/lib/arjdbc/mssql/lock_methods.rb +0 -77
  46. data/lib/arjdbc/mssql/types.rb +0 -343
  47. data/lib/arjdbc/mssql/utils.rb +0 -82
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4e64a303bc353b9633ce0f10e3fd20bb8688b37151a1730562fbeaddb0f35d9
4
- data.tar.gz: f25ac879568e2c07c7699716ed6d82900d6cd1c2ef86814f8702f49b87dfff2c
3
+ metadata.gz: e2483f430b747553967113a2fd1640d9b18fefe0691f469d5354866e22f90366
4
+ data.tar.gz: f777663ca67b683292712b44ce2999f1067d5c0ee964665b513e5aee48e38602
5
5
  SHA512:
6
- metadata.gz: 07ba52dda6e804feacee1f5e00efe87c078b8e2a104f1d772b4dfa192994db7322a2f1b7e3a6ea08360b39d7d27b01d8f359880147ae197164e0beaeff15bbe0
7
- data.tar.gz: 76cd40a5cf5d65e545319f4603e310c6422e342d16419b95bf0b60ab7591a2edb7153fe5c78e499b0cbf1b5650f30493dba388ba85143df38c9cae40d8aa5ec8
6
+ metadata.gz: c1775e6f11af7145b7224b4f0f9a56b18f545a74202e31cb41a6fae6325c10df97f106caaf6937d659e89acf33d3288744f60a961e4f488e8cf559e87c804a2e
7
+ data.tar.gz: 4cc0292d069ff57c01ce7d9a844bcfe64d32d07aeb47ba664a74fbdfc851af2bbbd34c30ab2219950b49e75edf215e0a3aefb98bd995c5b89648db7532ed1a89
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.tgz
3
3
  *~
4
4
  *.log
5
+ /log/
5
6
  patches*
6
7
  *#
7
8
  TAGS
@@ -30,4 +31,4 @@ Gemfile.lock
30
31
  .idea
31
32
  .settings
32
33
  activerecord-jdbc.iml
33
- lib/arjdbc/jdbc/adapter_java.jar
34
+ lib/arjdbc/jdbc/adapter_java.jar
data/.travis.yml CHANGED
@@ -1,16 +1,25 @@
1
- language: ruby
2
1
  sudo: false
3
- branches:
4
- only:
5
- - master
6
- - /.*-stable$/
7
- - /^test-.*/
8
- - /maintenance|support/
9
- - /.*dev$/
10
- bundler_args: --without development
11
- script: bundle exec rake ${TEST_PREFIX}test_$DB
2
+ dist: xenial
3
+
4
+ services:
5
+ - mysql
6
+
12
7
  before_install:
13
8
  - unset _JAVA_OPTIONS
9
+ - rvm @default,@global do gem uninstall bundler -a -x -I || true
10
+ - gem install bundler -v "~>1.17.3"
11
+ install:
12
+ - bundle install --retry 3 --without development
13
+ # to fix this issue: https://travis-ci.community/t/mariadb-10-1-fails-to-install-on-xenial/3151/3
14
+ - mysql -u root -e 'CREATE USER IF NOT EXISTS travis@localhost; GRANT ALL ON *.* TO travis@localhost;' || true
15
+
16
+ language: ruby
17
+ rvm:
18
+ - jruby-9.2.7.0
19
+ jdk:
20
+ - openjdk8
21
+
22
+ script: bundle exec rake ${TEST_PREFIX}test_$DB
14
23
  before_script:
15
24
  - echo "JAVA_OPTS=$JAVA_OPTS"
16
25
  - export JRUBY_OPTS="-J-Xms64M -J-Xmx1024M"
@@ -36,13 +45,10 @@ before_script:
36
45
  psql -c "create database activerecord_unittest;" -U postgres && \
37
46
  psql -c "create database activerecord_unittest2;" -U postgres \
38
47
  || true
39
- rvm:
40
- - jruby-9.2.7.0
41
- jdk:
42
- - openjdk8
48
+
43
49
  env:
44
50
  global:
45
- - AR_VERSION="master"
51
+ - AR_VERSION="6-0-stable"
46
52
  matrix:
47
53
  allow_failures:
48
54
  - rvm: jruby-head
@@ -52,17 +58,20 @@ matrix:
52
58
  - env: DB=mysql2 DRIVER=MariaDB
53
59
 
54
60
  - addons:
55
- postgresql: "9.4"
61
+ postgresql: "10"
56
62
  env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=false
57
63
  - addons:
58
- postgresql: "9.4"
64
+ postgresql: "10"
59
65
  env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=true
60
66
  - addons:
61
- postgresql: "9.4"
67
+ postgresql: "10"
62
68
  env: DB=postgresql PREPARED_STATEMENTS=true
63
69
  - addons:
64
- postgresql: "9.4"
70
+ postgresql: "10"
65
71
  env: DB=postgresql PREPARED_STATEMENTS=true INSERT_RETURNING=true
72
+ - addons:
73
+ postgresql: "9.4"
74
+ env: DB=postgresql PREPARED_STATEMENTS=true
66
75
 
67
76
  - env: DB=sqlite3 PREPARED_STATEMENTS=false
68
77
  - env: DB=sqlite3 PREPARED_STATEMENTS=true
@@ -76,7 +85,7 @@ matrix:
76
85
  - env: DB=postgresql
77
86
  jdk: oraclejdk11
78
87
  addons:
79
- postgresql: "9.4"
88
+ postgresql: "10"
80
89
  - env: DB=sqlite3
81
90
  jdk: oraclejdk11
82
91
 
@@ -86,28 +95,31 @@ matrix:
86
95
  - rvm: jruby-head
87
96
  env: DB=postgresql
88
97
  addons:
89
- postgresql: "9.4"
98
+ postgresql: "10"
90
99
  - rvm: jruby-head
91
100
  env: DB=sqlite3
92
101
 
93
102
  # testing against MariaDB
94
103
  - addons:
95
- mariadb: '10.0'
104
+ mariadb: 10.2
96
105
  env: DB=mariadb PREPARED_STATEMENTS=false
97
106
  - addons:
98
- mariadb: '10.1'
107
+ mariadb: 10.3
99
108
  env: DB=mariadb PREPARED_STATEMENTS=true
100
109
 
101
110
  # Rails test-suite :
102
- - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="master" # PS off by default
103
- - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="master" PREPARED_STATEMENTS=true
104
- - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="master" DRIVER=MariaDB
111
+ - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS off by default
112
+ - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-0-stable" PREPARED_STATEMENTS=true
113
+ - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-0-stable" DRIVER=MariaDB
105
114
 
106
115
  - addons:
107
- postgresql: "9.4"
108
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="master" # PS on by default
116
+ postgresql: "10"
117
+ env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS on by default
118
+ - addons:
119
+ postgresql: "10"
120
+ env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" PREPARED_STATEMENTS=false
109
121
  - addons:
110
122
  postgresql: "9.4"
111
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="master" PREPARED_STATEMENTS=false
123
+ env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS on by default
112
124
 
113
- - env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="master"
125
+ - env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="6-0-stable"
data/README.md CHANGED
@@ -5,27 +5,28 @@
5
5
  ActiveRecord-JDBC-Adapter (AR-JDBC) is the main database adapter for Rails'
6
6
  *ActiveRecord* component that can be used with [JRuby][0].
7
7
  ActiveRecord-JDBC-Adapter provides full or nearly full support for:
8
- **MySQL**, **PostgreSQL**, **SQLite3**. In the near future there are plans to
9
- add support **MSSQL**. Unless we get more contributions we will not be going
10
- beyond these four adapters. Note that the amount of work needed to get
11
- another adapter is not huge but the amount of testing required to make sure
12
- that adapter continues to work is not something we can do with the resources
13
- we currently have.
8
+ **MySQL**, **PostgreSQL**, **SQLite3** and **MSSQL*** (SQLServer).
14
9
 
15
- For Oracle database users you are encouraged to use
16
- https://github.com/rsim/oracle-enhanced.
10
+ Unless we get more contributions we will not be supporting more adapters.
11
+ Note that the amount of work needed to get another adapter is not huge but
12
+ the amount of testing required to make sure that adapter continues to work
13
+ is not something we can do with the resources we currently have.
14
+
15
+ - for **Oracle** database users you are encouraged to use
16
+ https://github.com/rsim/oracle-enhanced
17
+ - **MSSQL** adapter's gem parts reside in a [separate repository][8]
17
18
 
18
19
  Versions are targeted at certain versions of Rails and live on their own branches.
19
20
 
20
- | Gem Version | Rails Version | Branch |
21
- | ----------- | ------------- | ------ |
22
- | 50.x | 5.0.x | 50-stable |
23
- | 51.x | 5.1.x | 51-stable |
24
- | 52.x | 5.2.x | 52-stable |
25
- | future | latest | master |
21
+ | Gem Version | Rails Version | Branch | min JRuby | min Java |
22
+ | ----------- | ------------- | --------- | --------- | -------- |
23
+ | 50.x | 5.0.x | 50-stable | 9.1.x | 7 |
24
+ | 51.x | 5.1.x | 51-stable | 9.1.x | 7 |
25
+ | 52.x | 5.2.x | 52-stable | 9.1.x | 7 |
26
+ | 60.x | 6.0.x | master | 9.2.7 | 8 |
26
27
 
27
- The minimum version of JRuby for 50+ is JRuby **9.1.x** and
28
- JRuby 9.1+ requires Java 7 or newer (we recommend Java 8 at minimum).
28
+ Note that JRuby 9.1.x is end-of-life. We recommend Java 8 at a minimum for all
29
+ versions.
29
30
 
30
31
  ## Using ActiveRecord JDBC
31
32
 
@@ -39,6 +40,7 @@ adapters are available:
39
40
  - MySQL (`activerecord-jdbcmysql-adapter`)
40
41
  - PostgreSQL (`activerecord-jdbcpostgresql-adapter`)
41
42
  - SQLite3 (`activerecord-jdbcsqlite3-adapter`)
43
+ - MSSQL (`activerecord-jdbcsqlserver-adapter`)
42
44
 
43
45
  2. If you're generating a new Rails application, use the following command:
44
46
 
@@ -81,6 +83,21 @@ production:
81
83
  connectTimeout: 60000
82
84
  ```
83
85
 
86
+ #### MySQL specific notes
87
+
88
+ Depending on the MySQL server configuration, it might be required to set
89
+ additional connection properties for date/time support to work correctly. If you
90
+ encounter problems, try adding this to your database configuration:
91
+
92
+ ```yml
93
+ properties:
94
+ serverTimezone: <%= java.util.TimeZone.getDefault.getID %>
95
+ ```
96
+
97
+ The correct timezone depends on the system setup, but the one shown is a good
98
+ place to start and is actually the correct setting for many systems.
99
+
100
+
84
101
  ### Standalone with ActiveRecord
85
102
 
86
103
  Once the setup is made (see below) you can establish a JDBC connection like this
@@ -155,7 +172,8 @@ ask on the #JRuby IRC channel on http://freenode.net/ (try [web-chat][6]).
155
172
  This project was originally written by [Nick Sieger](http://github.com/nicksieger)
156
173
  and [Ola Bini](http://github.com/olabini) with lots of help from the JRuby community.
157
174
  Polished 3.x compatibility and 4.x support (for AR-JDBC >= 1.3.0) was managed by
158
- [Karol Bucek](http://github.com/kares) among others.
175
+ [Karol Bucek](http://github.com/kares) among others. Support for Rails 6 was
176
+ contributed by [shellyBits GmbH](https://shellybits.ch/)
159
177
 
160
178
  ## License
161
179
 
@@ -173,4 +191,4 @@ license the database's drivers are licensed. See each driver gem's LICENSE.txt.
173
191
  [5]: https://github.com/jruby/activerecord-jdbc-adapter/wiki
174
192
  [6]: https://webchat.freenode.net/?channels=#jruby
175
193
  [7]: http://badge.fury.io/rb/activerecord-jdbc-adapter
176
- [8]: https://github.com/jruby/activerecord-jdbc-adapter/wiki/Migrating-from-1.2.x-to-1.3.0
194
+ [8]: https://github.com/jruby/activerecord-jdbcsqlserver-adapter
data/Rakefile CHANGED
@@ -1,3 +1,29 @@
1
+ # Common usage
2
+ #
3
+ # rake build:adapters - to build all specific adapter gems and the base gem
4
+ # rake release:do - build:adapters + git tag + push gems
5
+ #
6
+ # Environment variables used by this Rakefile:
7
+ #
8
+ # INCLUDE_JAR_IN_GEM [default task - false, other taks - true]:
9
+ # Note: This is something you should not normally have to set.
10
+ # For local development we always will end up including the jar file
11
+ # in any task which generates our main gem. The wrinkle to this
12
+ # is when we do a custom github link in bundler:
13
+ #
14
+ # gem 'ar-jdbc', github: '...'
15
+ #
16
+ # Because we stopped committing a .jar file for every change and so when
17
+ # we include a gem like this it clones the repository and does a default
18
+ # build in rake. This in turn will end up forcing a compile to generate
19
+ # that jar (similar to how c-extensions compile at the time of install).
20
+ # For shipped gems we do include the jar so that people do not require
21
+ # this compile step.
22
+ #
23
+ # NOOP [release:do - false]
24
+ #
25
+ # No commands or gem pushing during a release.
26
+
1
27
  require 'rake/clean'
2
28
 
3
29
  CLEAN.include 'derby*', 'test.db.*', '*test.sqlite3', 'test/reports'
@@ -38,7 +64,8 @@ rake = lambda { |task| ruby "-S", "rake", task }
38
64
 
39
65
  desc "Build #{gem_name} gem into the pkg directory."
40
66
  task :build => :jar do
41
- sh("RELEASE=#{ENV['RELEASE']} gem build -V '#{gemspec_path}'") do
67
+ include_jar = ENV['INCLUDE_JAR_IN_GEM'] || 'true'
68
+ sh("INCLUDE_JAR_IN_GEM=#{include_jar} gem build -V '#{gemspec_path}'") do
42
69
  gem_path = built_gem_path.call
43
70
  file_name = File.basename(gem_path)
44
71
  FileUtils.mkdir_p(File.join(base_dir, 'pkg'))
@@ -58,7 +85,6 @@ end
58
85
 
59
86
  desc "Releasing AR-JDBC gems (use NOOP=true to disable gem pushing)"
60
87
  task 'release:do' do
61
- ENV['RELEASE'] = 'true' # so that .gemspec is built with adapter_java.jar
62
88
  Rake::Task['build'].invoke
63
89
  Rake::Task['build:adapters'].invoke
64
90
 
@@ -257,7 +283,7 @@ if defined? JRUBY_VERSION
257
283
  begin
258
284
  require 'arjdbc/version'
259
285
  rescue LoadError
260
- path = File.expand_path('../lib', File.dirname(__FILE__))
286
+ path = File.expand_path('lib', File.dirname(__FILE__))
261
287
  unless $LOAD_PATH.include?(path)
262
288
  $LOAD_PATH << path; retry
263
289
  end
@@ -297,7 +323,7 @@ if defined? JRUBY_VERSION
297
323
  # class_files.gsub!('$', '\$') unless windows?
298
324
  # args = class_files.map { |path| [ "-C #{classes_dir}", path ] }.flatten
299
325
 
300
- if ENV['RELEASE'] == 'true'; require 'tempfile'
326
+ if ENV['INCLUDE_JAR_IN_GEM'] == 'true'; require 'tempfile'
301
327
  manifest = "Built-Time: #{Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')}\n"
302
328
  manifest += "Built-JRuby: #{JRUBY_VERSION}\n"
303
329
  manifest += "Specification-Title: ActiveRecord-JDBC\n"
data/Rakefile.jdbc CHANGED
@@ -17,4 +17,11 @@ desc "Build and install #{name}-#{version} gem into system gems"
17
17
  task('install') { gem_helper.install_gem }
18
18
 
19
19
  desc "Create tag #{version_tag} build and push #{name}-#{version} gem to Rubygems"
20
- task('release') { gem_helper.release_gem }
20
+ task('release') do
21
+ gem_helper.instance_eval do
22
+ guard_clean
23
+ built_gem_path = build_gem
24
+ tag_version unless already_tagged?
25
+ rubygem_push(built_gem_path) if gem_push?
26
+ end
27
+ end
@@ -11,13 +11,10 @@ Gem::Specification.new do |gem|
11
11
  gem.license = 'BSD-2-Clause'
12
12
  gem.summary = 'JDBC adapter for ActiveRecord, for use within JRuby on Rails.'
13
13
  gem.description = "" <<
14
- "AR-JDBC is a database adapter for Rails' ActiveRecord component designed " <<
15
- "to be used with JRuby built upon Java's JDBC API for database access. " <<
16
- "Provides (ActiveRecord) built-in adapters: MySQL, PostgreSQL and SQLite3 " <<
17
- "as well as adapters for popular databases such as Oracle, SQLServer, " <<
18
- "DB2, FireBird and even Java (embed) databases: Derby, HSQLDB and H2. " <<
19
- "It allows to connect to virtually any JDBC-compliant database with your " <<
20
- "JRuby on Rails application."
14
+ "AR-JDBC is a database adapter for Rails' ActiveRecord component " <<
15
+ "designed to be used with JRuby built upon Java's JDBC API for " <<
16
+ "database access. Provides (ActiveRecord) built-in adapters: MySQL, " <<
17
+ "PostgreSQL, SQLite3, and SQLServer."
21
18
 
22
19
  gem.require_paths = ["lib"]
23
20
 
@@ -27,7 +24,7 @@ Gem::Specification.new do |gem|
27
24
  reject { |f| f =~ /^(gemfiles)/ } # no tests - no Gemfile_s appraised ...
28
25
  gem.files += ['lib/arjdbc/jdbc/adapter_java.jar'] #if ENV['RELEASE'].eql?('true')
29
26
 
30
- if ENV['RELEASE'] != 'true' # @see Rakefile
27
+ if ENV['INCLUDE_JAR_IN_GEM'] != 'true' # @see Rakefile
31
28
  gem.extensions << 'Rakefile' # to support auto-building .jar with :git paths
32
29
 
33
30
  #gem.add_runtime_dependency 'jar-dependencies', '~> 0.1' # development not enough!
@@ -44,7 +41,7 @@ Gem::Specification.new do |gem|
44
41
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
45
42
  gem.test_files = gem.files.grep(%r{^test/})
46
43
 
47
- gem.add_dependency 'activerecord', '~> 6.0.0.rc1'
44
+ gem.add_dependency 'activerecord', '~> 6.0.0'
48
45
 
49
46
  #gem.add_development_dependency 'test-unit', '2.5.4'
50
47
  #gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
@@ -10,6 +10,11 @@ module ArJdbc
10
10
  @connection.active?
11
11
  end
12
12
 
13
+ def really_valid?
14
+ return unless @connection
15
+ @connection.really_valid?
16
+ end
17
+
13
18
  # @override
14
19
  def reconnect!
15
20
  super # clear_cache! && reset_transaction
@@ -56,7 +56,7 @@ module ArJdbc
56
56
  case exception
57
57
  when SystemExit, SignalException, NoMemoryError then exception
58
58
  when ActiveModel::RangeError, TypeError, RuntimeError then exception
59
- else ActiveRecord::StatementInvalid.new(message, sql: sql, binds: binds)
59
+ else super
60
60
  end
61
61
  end
62
62
 
@@ -16,11 +16,13 @@ module ArJdbc
16
16
 
17
17
  materialize_transactions
18
18
 
19
+ binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
20
+
19
21
  if without_prepared_statement?(binds)
20
- log(sql, name) { @connection.execute_insert(sql) }
22
+ log(sql, name) { @connection.execute_insert_pk(sql, pk) }
21
23
  else
22
24
  log(sql, name, binds) do
23
- @connection.execute_insert(sql, binds)
25
+ @connection.execute_insert_pk(sql, binds, pk)
24
26
  end
25
27
  end
26
28
  end
@@ -34,6 +36,8 @@ module ArJdbc
34
36
 
35
37
  materialize_transactions
36
38
 
39
+ binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
40
+
37
41
  if without_prepared_statement?(binds)
38
42
  log(sql, name) { @connection.execute_query(sql) }
39
43
  else
@@ -52,6 +56,8 @@ module ArJdbc
52
56
 
53
57
  materialize_transactions
54
58
 
59
+ binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
60
+
55
61
  if without_prepared_statement?(binds)
56
62
  log(sql, name) { @connection.execute_update(sql) }
57
63
  else
@@ -60,25 +66,6 @@ module ArJdbc
60
66
  end
61
67
  alias :exec_delete :exec_update
62
68
 
63
- # overridden to support legacy binds
64
- def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
65
- binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
66
- super
67
- end
68
- alias create insert
69
-
70
- # overridden to support legacy binds
71
- def update(arel, name = nil, binds = [])
72
- binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
73
- super
74
- end
75
-
76
- # overridden to support legacy binds
77
- def delete(arel, name = nil, binds = [])
78
- binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
79
- super
80
- end
81
-
82
69
  def execute(sql, name = nil)
83
70
  if preventing_writes? && write_query?(sql)
84
71
  raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
@@ -328,6 +328,17 @@ module ArJdbc
328
328
  select_one(sql).nil?
329
329
  end
330
330
 
331
+ # @override
332
+ def primary_keys(table)
333
+ # If no schema in table name is given but present in URL parameter. Use the URL parameter one
334
+ # This avoids issues if the table is present in multiple schemas
335
+ if table.split(".").size == 1 && schema
336
+ table = "#{schema}.#{table}"
337
+ end
338
+
339
+ super
340
+ end
341
+
331
342
  def next_sequence_value(sequence_name)
332
343
  select_value("SELECT NEXT VALUE FOR #{sequence_name} FROM sysibm.sysdummy1")
333
344
  end