activerecord-oracle_enhanced-adapter 6.0.6 → 6.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +128 -4
  3. data/README.md +12 -1
  4. data/VERSION +1 -1
  5. data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +2 -3
  6. data/lib/active_record/connection_adapters/oracle_enhanced/context_index.rb +0 -1
  7. data/lib/active_record/connection_adapters/oracle_enhanced/database_limits.rb +0 -9
  8. data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +6 -6
  9. data/lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb +8 -9
  10. data/lib/active_record/connection_adapters/oracle_enhanced/dbms_output.rb +0 -1
  11. data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +7 -5
  12. data/lib/active_record/connection_adapters/oracle_enhanced/lob.rb +1 -2
  13. data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +2 -3
  14. data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +0 -1
  15. data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +7 -11
  16. data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +2 -3
  17. data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +15 -3
  18. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +42 -39
  19. data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +16 -17
  20. data/lib/active_record/connection_adapters/oracle_enhanced/type_metadata.rb +2 -1
  21. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +52 -33
  22. data/lib/active_record/type/oracle_enhanced/boolean.rb +0 -1
  23. data/lib/active_record/type/oracle_enhanced/integer.rb +0 -1
  24. data/lib/arel/visitors/oracle.rb +217 -0
  25. data/lib/arel/visitors/oracle12.rb +124 -0
  26. data/spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb +9 -3
  27. data/spec/active_record/connection_adapters/oracle_enhanced/database_tasks_spec.rb +5 -0
  28. data/spec/active_record/connection_adapters/oracle_enhanced/procedures_spec.rb +0 -1
  29. data/spec/active_record/connection_adapters/oracle_enhanced/schema_dumper_spec.rb +27 -0
  30. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +83 -0
  31. data/spec/active_record/oracle_enhanced/type/national_character_string_spec.rb +4 -2
  32. data/spec/spec_config.yaml.template +2 -2
  33. data/spec/spec_helper.rb +13 -2
  34. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1410c7eb8f55a7b4c96b8016f31c573512699978498ee6effae6d4875b1e3f31
4
- data.tar.gz: 36cbc570c5c5a1c6d074353f1de0d8d6ce07c90fd5b906727d7ee2e78a473a1e
3
+ metadata.gz: 0a0830e05dfb361ea469742a3642461cbd839ea4ca40b3c1f1bb3ec0d8443657
4
+ data.tar.gz: 46c6a959835694b0a6f38dcddbba03cb23ae1b20fef66c13c53ed3eac9a1fd8d
5
5
  SHA512:
6
- metadata.gz: 1f1ba2aed7eef1fa08e31c4fe7f43762eb077b10e412f9db61228589d1387f440b64b17db05fd3fd796e0eb4ebc8ca00f91f767f0ea6402e079783265cb583a6
7
- data.tar.gz: 700df5182daf9a04a67dcc478aa378d9deb8d09fba726ccf2ce9878b8c1dc70f56a5a135048e00438e5078b9916467f8b356e6a3a4bc5bc8897fb874a8a686c3
6
+ metadata.gz: 2561b2089a74bb3f4e3cb0d30a7597fe2491a41b52dfaaa68e6d8055b4c9d0e80044a6f8b720f7d40d8b5fdb9697396e29a29d2025424edb6ab178fb3612812d
7
+ data.tar.gz: cff42212affbc978b55dd3683ec939b8b2381ed0fcd09e1d1c597d06c695e68bc14dbb486680fd19abfd1ced46d014a3e65b931500483554b20a0d87fb59921a
data/History.md CHANGED
@@ -1,9 +1,133 @@
1
- ## 6.0.5 / 2020-12-17
1
+ ## 6.1.4 / 2021-04-01
2
2
 
3
3
  * Changes and bug fixes
4
- * Address `next_sequence_value` ArgumentError syntax [#2048 #2050]
5
- * Add /*+ OPTIMIZER_FEATURES_ENABLE('11.2.0.2') */ hint to address slow SCHEMA queries [#2055, #2069]
6
- * `build_subselect` does not have ordering [#2023, #2070, #2073]
4
+ * Support use of ojdbc11.jar [#2155, #2168]
5
+ * Add missing default granted permission "ulimited tablespace" [#2156, #2167]
6
+ * Prevent from including ojdbc8.jar file to gem file [#2163, #2164, #2165]
7
+ * Oracle enhanced adapter 6.1.3 has been yanked since #2163
8
+
9
+ * CI
10
+ * Allow-failure CI against jruby-head for release61 branch [#2166]
11
+
12
+ ## 6.1.3 / 2021-03-31
13
+
14
+ * Changes and bug fixes
15
+ * Address FrozenError (can't modify frozen Hash): error [#2139 #2151 #2160]
16
+
17
+ * CI
18
+ * CI against JRuby 9.2.15.0 [#2150]
19
+
20
+ ## 6.1.2 / 2021-02-10
21
+ * Changes and bug fixes
22
+ * Fixed ORA-01935: missing user or role name with config read issue [#1943 #2135, #2142]
23
+
24
+ ## 6.1.1 / 2021-01-14
25
+
26
+ * Changes and bug fixes
27
+ * Remove /*+ OPTIMIZER_FEATURES_ENABLE('11.2.0.2') */ hint for all_synonyms [#2110, #2119]
28
+ * Fix write_lobs Invalid byte sequence in UTF-8 [#2097, #2111]
29
+ * Ensure FKs are properly included in structure dumps [#2109, #2113]
30
+
31
+ * CI
32
+ * CI against JRuby 9.2.14.0 [#2085]
33
+ * CI against Ruby 3.0.0 [#2091, #2092]
34
+ * Address Travis CI warnings and bump Ubuntu version to 20.04 [#2086]
35
+ * Exclude `ruby-head` and `ruby-debug` until minitest allows Ruby 3.1 #2094, #2095
36
+ * CI against Ruby 3.0.0 at Travis CI [#2093]
37
+
38
+ ## 6.1.0 / 2020-12-15
39
+
40
+ * Changes and bug fixes
41
+ * Support Rails 6.1.0
42
+ * Update bug report templates for Oracle enhanced adapter 6.1 [#2063]
43
+ * Use released version of rake [#2065 #2066]
44
+ * Add /*+ OPTIMIZER_FEATURES_ENABLE('11.2.0.2') */ hint to address slow SCHEMA queries [#2055, #2068]
45
+ * `build_subselect` does not have ordering [#2070]
46
+ * Remove `visit_Arel_Nodes_NotIn` and `visit_Arel_Nodes_In` visitors [#2075, #2077]
47
+ * `NOT IN` clause needs separated by `AND` [#2079, #2081]
48
+
49
+ ## 6.1.0.rc1 / 2020-11-03
50
+
51
+ * Changes and bug fixes
52
+ * Support Rails 6.1.0.rc1
53
+ * Add support to change the permissions granted when creating DB [#1885]
54
+ * Refactor `create_table`'s options separation [#1886]
55
+ * Move schema cache to pool [#1888]
56
+ * Clear schema cache when a table is created/dropped/renamed [#1891]
57
+ * Deduplicate various Active Record schema cache structures [#1897]
58
+ * Support SQLCounter change to ignore "SCHEMA" and "TRANSACTION" log [#1892]
59
+ * Share the column and table name quote cache between connections [#1901]
60
+ * Add database_exists? method to connection adapters [#1906]
61
+ * Accept columns passed with options in remove_index [#1930]
62
+ * Fix `NameError` for `SchemaCreation` [#1933]
63
+ * Add `supports_common_table_expressions?` for CTE testing [#1946]
64
+ * create_table_definition and add_column take keyword arguments [#1942]
65
+ * Address `uninitialized constant ActiveRecord::ConnectionAdapters::AbstractAdapter::Quoting (NameError) [#1950]
66
+ * Fix an error when writing lobs [#1962]
67
+ * Uninstall SimpleCov [#1968]
68
+ * fix: Auto retry only works for connection.exec() [#1976]
69
+ * Fix keyword arguments errors for Ruby 2.8.0-dev [#1977]
70
+ * Fix a build errors when using Ruby 2.8.0-dev [#1983]
71
+ * Include sync option when dumping a context index [#1988]
72
+ * Use `build_result` instead of `ActiveRecord::Result.new` [#1994]
73
+ * Use the new API for build_results [#1995]
74
+ * Merge Arel visitors [#2002]
75
+ * Enable `Rails/IndexBy` and `Rails/IndexWith` cops [#2006]
76
+ * Don't refer `allowed_index_name_length` directly [#2009]
77
+ * Should not rely on the global `Arel::Table.engine` in the framework [#2010]
78
+ * Suppress `warning: already initialized constant` [#2011]
79
+ * Deprecate passing a column to `type_cast` [#2012]
80
+ * Limit number of expressions in a list during a "homogenous in" operation [#2013]
81
+ * Allow column name with function (e.g. `length(title)`) as safe SQL string [#2017]
82
+ * Default engine `ENGINE=InnoDB` is no longer dumped to make schema more agnostic [#2019]
83
+ * Separate primary key column options from table options [#2019]
84
+ * Make index options to kwargs [#2022]
85
+ * Make remaining migration options to kwargs [#2024]
86
+ * Allow TruffleRuby RUBY_ENGINE [#2046]
87
+ * Restore Schema Dumper behavior changed by #2019 [#2047]
88
+ * Support JDBC service name syntax [#2035]
89
+ * Use Rake 13.0.0.pre.1 [#1924]
90
+ * Bump RuboCop version to 0.71 [#1887]
91
+ * Bump RuboCop to 0.74.0 [#1914]
92
+ * Bump RuboCop to 0.76.0 [#1947]
93
+ * Use RuboCop 0.77 [#1959]
94
+ * Bump RuboCop to 0.82.0 [#2005]
95
+ * Suppress RuboCop's offenses [#2020]
96
+ * Enable `Layout/EmptyLinesAroundAccessModifier` cop [#1890]
97
+ * Disable `Style/BracesAroundHashParameters` cop [#1923]
98
+ * Enable `Layout/ClosingHeredocIndentation` cop [#1958]
99
+ * Unlock RuboCop gem versions [#1926]
100
+ * Enable `Rails/IndexBy` and `Rails/IndexWith` cops [#2006]
101
+ * Enable `Performance/DeletePrefix` and `Performance/DeleteSuffix` cops [#2021]
102
+ * Enable `Layout/SpaceAroundOperators` cop [#2057]
103
+ * Fix links to rails-dev-box running on docker [#1883]
104
+ * Fix spec config template copy instructions [#1884]
105
+ * Update UPGRADE section for Rails 5.2 [#1993]
106
+
107
+ * CI
108
+ * Enable GitHub Actions and run RuboCop [#1925]
109
+ * Run CI with GitHub Actions [#2015]
110
+ * Enabled Dependabot by creating .dependabot/config.yml [#1931]
111
+ * Disable Code Climate #1938
112
+ * CI against JRuby 9.2.8.0 [#1911]
113
+ * CI against JRuby 9.2.9.0 #1948
114
+ * CI against Ruby 2.6.4 and Ruby 2.5.6 [#1921]
115
+ * CI against Ruby 2.5.7 and Ruby 2.6.5 [#1949]
116
+ * CI against Ruby 2.7.0 [#1975]
117
+ * CI against JRuby 9.2.10.0 [#1989]
118
+ * CI against JRuby 9.2.11.0 [#1992]
119
+ * CI against JRuby 9.2.11.1 [#1997]
120
+ * CI againt Ruby 2.7.1, 2.6.6 and 2.5.8 #1998
121
+ * CI against JRuby 9.2.12.0 [#2034]
122
+ * Use Oracle Instant Client 18.5 [#2036]
123
+ * Support `jruby-head` again [#2037]
124
+ * CI against JRuby 9.2.13.0 [#2041]
125
+ * CI against Ruby 2.7.2 [#2052]
126
+ * Remove unnecessary PATH and LD_LIBRARY_PATH environment variables [#1927]
127
+ * Use Ubuntu 18.04 (Bionic Beaver) at Travis CI [#1937]
128
+ * Run bug report template at CI [#1936]
129
+ * Skip known failures until #1943 is resolved [#1961]
130
+ * Migrate to `ruby/setup-ruby` to use Ruby 2.7 [#2026]
7
131
 
8
132
  ## 6.0.4 / 2020-08-18
9
133
 
data/README.md CHANGED
@@ -10,6 +10,17 @@ Oracle enhanced ActiveRecord adapter provides Oracle database access from Ruby o
10
10
 
11
11
  INSTALLATION
12
12
  ------------
13
+ ### Rails 6.1
14
+
15
+ Oracle enhanced adapter version 6.1 supports Rails 6.1.
16
+ When using Ruby on Rails version 6.1 then in Gemfile include
17
+
18
+ ```ruby
19
+ # Use oracle as the database for Active Record
20
+ gem 'activerecord-oracle_enhanced-adapter', '~> 6.1.0'
21
+ gem 'ruby-oci8' # only for CRuby users
22
+ ```
23
+
13
24
  ### Rails 6.0
14
25
 
15
26
  Oracle enhanced adapter version 6.0 supports Rails 6.0.
@@ -663,7 +674,7 @@ if any database structure changed by migrations, execute `rails db:schema:cache:
663
674
 
664
675
  UPGRADE
665
676
  ---------------
666
- ### Upgrade Rails 5.0 or older version to Rails 5.2
677
+ ### Upgrade Rails 5.1 or older version to Rails 5.2
667
678
 
668
679
  * `emulate_booleans_from_strings = true` change
669
680
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.0.6
1
+ 6.1.4
@@ -19,7 +19,6 @@ module ActiveRecord
19
19
  attr_reader :raw_connection
20
20
 
21
21
  private
22
-
23
22
  # Used always by JDBC connection as well by OCI connection when describing tables over database link
24
23
  def describe(name)
25
24
  name = name.to_s
@@ -116,8 +115,8 @@ module ActiveRecord
116
115
  end
117
116
  end
118
117
 
119
- # if MRI or YARV
120
- if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
118
+ # if MRI or YARV or TruffleRuby
119
+ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "truffleruby"
121
120
  ORACLE_ENHANCED_CONNECTION = :oci
122
121
  require "active_record/connection_adapters/oracle_enhanced/oci_connection"
123
122
  # if JRuby
@@ -142,7 +142,6 @@ module ActiveRecord
142
142
  end
143
143
 
144
144
  private
145
-
146
145
  def create_datastore_procedure(table_name, procedure_name, column_names, options)
147
146
  quoted_table_name = quote_table_name(table_name)
148
147
  select_queries, column_names = column_names.partition { |c| c.to_s =~ /^\s*SELECT\s+/i }
@@ -25,15 +25,6 @@ module ActiveRecord
25
25
  end
26
26
  deprecate :column_name_length
27
27
 
28
- # Returns the maximum allowed length for an index name. This
29
- # limit is enforced by rails and Is less than or equal to
30
- # <tt>index_name_length</tt>. The gap between
31
- # <tt>index_name_length</tt> is to allow internal rails
32
- # opreations to use prefixes in temporary opreations.
33
- def allowed_index_name_length
34
- index_name_length
35
- end
36
-
37
28
  # the maximum length of an index name
38
29
  # supported by this database
39
30
  def index_name_length
@@ -42,7 +42,7 @@ module ActiveRecord
42
42
  cursor.exec
43
43
  end
44
44
 
45
- if (name == "EXPLAIN") && sql =~ /^EXPLAIN/
45
+ if (name == "EXPLAIN") && sql.start_with?("EXPLAIN")
46
46
  res = true
47
47
  else
48
48
  columns = cursor.get_col_names.map do |col_name|
@@ -53,7 +53,7 @@ module ActiveRecord
53
53
  while row = cursor.fetch(fetch_options)
54
54
  rows << row
55
55
  end
56
- res = ActiveRecord::Result.new(columns, rows)
56
+ res = build_result(columns: columns, rows: rows)
57
57
  end
58
58
 
59
59
  cursor.close unless cached
@@ -67,7 +67,7 @@ module ActiveRecord
67
67
 
68
68
  def explain(arel, binds = [])
69
69
  sql = "EXPLAIN PLAN FOR #{to_sql(arel, binds)}"
70
- return if sql =~ /FROM all_/
70
+ return if /FROM all_/.match?(sql)
71
71
  if ORACLE_ENHANCED_CONNECTION == :jdbc
72
72
  exec_query(sql, "EXPLAIN", binds)
73
73
  else
@@ -130,7 +130,7 @@ module ActiveRecord
130
130
  rows << [returning_id]
131
131
  end
132
132
  cursor.close unless cached
133
- ActiveRecord::Result.new(returning_id_col || [], rows)
133
+ build_result(columns: returning_id_col || [], rows: rows)
134
134
  end
135
135
  end
136
136
 
@@ -196,11 +196,11 @@ module ActiveRecord
196
196
  end
197
197
 
198
198
  def create_savepoint(name = current_savepoint_name) #:nodoc:
199
- execute("SAVEPOINT #{name}")
199
+ execute("SAVEPOINT #{name}", "TRANSACTION")
200
200
  end
201
201
 
202
202
  def exec_rollback_to_savepoint(name = current_savepoint_name) #:nodoc:
203
- execute("ROLLBACK TO #{name}")
203
+ execute("ROLLBACK TO #{name}", "TRANSACTION")
204
204
  end
205
205
 
206
206
  def release_savepoint(name = current_savepoint_name) #:nodoc:
@@ -17,21 +17,20 @@ module ActiveRecord
17
17
  print "Please provide the SYSTEM password for your Oracle installation (set ORACLE_SYSTEM_PASSWORD to avoid this prompt)\n>"
18
18
  $stdin.gets.strip
19
19
  }
20
- establish_connection(@config.merge("username" => "SYSTEM", "password" => system_password))
20
+ establish_connection(@config.merge(username: "SYSTEM", password: system_password))
21
21
  begin
22
- connection.execute "CREATE USER #{@config['username']} IDENTIFIED BY #{@config['password']}"
22
+ connection.execute "CREATE USER #{@config[:username]} IDENTIFIED BY #{@config[:password]}"
23
23
  rescue => e
24
24
  if /ORA-01920/.match?(e.message) # user name conflicts with another user or role name
25
- connection.execute "ALTER USER #{@config['username']} IDENTIFIED BY #{@config['password']}"
25
+ connection.execute "ALTER USER #{@config[:username]} IDENTIFIED BY #{@config[:password]}"
26
26
  else
27
27
  raise e
28
28
  end
29
29
  end
30
- connection.execute "GRANT unlimited tablespace TO #{@config['username']}"
31
- connection.execute "GRANT create session TO #{@config['username']}"
32
- connection.execute "GRANT create table TO #{@config['username']}"
33
- connection.execute "GRANT create view TO #{@config['username']}"
34
- connection.execute "GRANT create sequence TO #{@config['username']}"
30
+
31
+ OracleEnhancedAdapter.permissions.each do |permission|
32
+ connection.execute "GRANT #{permission} TO #{@config[:username]}"
33
+ end
35
34
  end
36
35
 
37
36
  def drop
@@ -47,7 +46,7 @@ module ActiveRecord
47
46
  def structure_dump(filename, extra_flags)
48
47
  establish_connection(@config)
49
48
  File.open(filename, "w:utf-8") { |f| f << connection.structure_dump }
50
- if @config["structure_dump"] == "db_stored_code"
49
+ if @config[:structure_dump] == "db_stored_code"
51
50
  File.open(filename, "a") { |f| f << connection.structure_dump_db_stored_code }
52
51
  end
53
52
  end
@@ -31,7 +31,6 @@ module ActiveRecord
31
31
  end
32
32
 
33
33
  private
34
-
35
34
  def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil)
36
35
  super
37
36
  ensure
@@ -16,7 +16,8 @@ begin
16
16
  # Oracle 11g client ojdbc6.jar is also compatible with Java 1.7
17
17
  # Oracle 12c Release 1 client provides ojdbc7.jar
18
18
  # Oracle 12c Release 2 client provides ojdbc8.jar
19
- ojdbc_jars = %w(ojdbc8.jar ojdbc7.jar ojdbc6.jar)
19
+ # Oracle 21c provides ojdbc11.jar for Java 11 and above
20
+ ojdbc_jars = %w(ojdbc11.jar ojdbc8.jar ojdbc7.jar ojdbc6.jar)
20
21
 
21
22
  if !ENV_JAVA["java.class.path"]&.match?(Regexp.new(ojdbc_jars.join("|")))
22
23
  # On Unix environment variable should be PATH, on Windows it is sometimes Path
@@ -98,6 +99,8 @@ module ActiveRecord
98
99
  @raw_connection = @raw_connection.underlying_connection
99
100
  end
100
101
 
102
+ # Workaround FrozenError (can't modify frozen Hash):
103
+ config = config.dup
101
104
  config[:driver] ||= @raw_connection.meta_data.connection.java_class.name
102
105
  username = @raw_connection.meta_data.user_name
103
106
  else
@@ -115,9 +118,9 @@ module ActiveRecord
115
118
  else
116
119
  unless database.match?(/^(\:|\/)/)
117
120
  # assume database is a SID if no colon or slash are supplied (backward-compatibility)
118
- database = ":#{database}"
121
+ database = "/#{database}"
119
122
  end
120
- url = config[:url] || "jdbc:oracle:thin:@#{host || 'localhost'}:#{port || 1521}#{database}"
123
+ url = config[:url] || "jdbc:oracle:thin:@//#{host || 'localhost'}:#{port || 1521}#{database}"
121
124
  end
122
125
 
123
126
  prefetch_rows = config[:prefetch_rows] || 100
@@ -238,7 +241,7 @@ module ActiveRecord
238
241
  begin
239
242
  yield if block_given?
240
243
  rescue Java::JavaSql::SQLException => e
241
- raise unless e.message =~ /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/
244
+ raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)
242
245
  @active = false
243
246
  raise unless should_retry
244
247
  should_retry = false
@@ -512,7 +515,6 @@ module ActiveRecord
512
515
  end
513
516
 
514
517
  private
515
-
516
518
  def lob_to_ruby_value(val)
517
519
  case val
518
520
  when ::Java::OracleSql::CLOB
@@ -18,13 +18,12 @@ module ActiveRecord #:nodoc:
18
18
  module ClassMethods
19
19
  def lob_columns
20
20
  columns.select do |column|
21
- column.sql_type_metadata.sql_type =~ /LOB$/
21
+ column.sql_type_metadata.sql_type.end_with?("LOB")
22
22
  end
23
23
  end
24
24
  end
25
25
 
26
26
  private
27
-
28
27
  def enhanced_write_lobs
29
28
  if self.class.connection.is_a?(ConnectionAdapters::OracleEnhancedAdapter) &&
30
29
  !(self.class.custom_create_method || self.class.custom_update_method)
@@ -269,7 +269,6 @@ module ActiveRecord
269
269
  end
270
270
 
271
271
  private
272
-
273
272
  def date_without_time?(value)
274
273
  case value
275
274
  when OraDate
@@ -323,9 +322,9 @@ module ActiveRecord
323
322
  # connection using host, port and database name
324
323
  elsif host || port
325
324
  host ||= "localhost"
326
- host = "[#{host}]" if host =~ /^[^\[].*:/ # IPv6
325
+ host = "[#{host}]" if /^[^\[].*:/.match?(host) # IPv6
327
326
  port ||= 1521
328
- database = "/#{database}" unless database.match(/^\//)
327
+ database = "/#{database}" unless database.start_with?("/")
329
328
  "//#{host}:#{port}#{database}"
330
329
  # if no host is specified then assume that
331
330
  # database parameter is TNS alias or TNS connection string
@@ -97,7 +97,6 @@ module ActiveRecord #:nodoc:
97
97
  end
98
98
 
99
99
  private
100
-
101
100
  # Creates a record with custom create method
102
101
  # and returns its id.
103
102
  def _create_record
@@ -10,14 +10,11 @@ module ActiveRecord
10
10
 
11
11
  def quote_column_name(name) #:nodoc:
12
12
  name = name.to_s
13
- self.class.quoted_column_names[name] ||= begin
14
- # if only valid lowercase column characters in name
15
- if /\A[a-z][a-z_0-9\$#]*\Z/.match?(name)
16
- "\"#{name.upcase}\""
17
- else
18
- # remove double quotes which cannot be used inside quoted identifier
19
- "\"#{name.gsub('"', '')}\""
20
- end
13
+ self.class.quoted_column_names[name] ||= if /\A[a-z][a-z_0-9\$#]*\Z/.match?(name)
14
+ "\"#{name.upcase}\""
15
+ else
16
+ # remove double quotes which cannot be used inside quoted identifier
17
+ "\"#{name.gsub('"', '')}\""
21
18
  end
22
19
  end
23
20
 
@@ -169,7 +166,6 @@ module ActiveRecord
169
166
  private_constant :COLUMN_NAME, :COLUMN_NAME_WITH_ORDER
170
167
 
171
168
  private
172
-
173
169
  def oracle_downcase(column_name)
174
170
  return nil if column_name.nil?
175
171
  /[a-z]/.match?(column_name) ? column_name : column_name.downcase
@@ -179,8 +175,8 @@ module ActiveRecord
179
175
  end
180
176
  end
181
177
 
182
- # if MRI or YARV
183
- if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
178
+ # if MRI or YARV or TruffleRuby
179
+ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "truffleruby"
184
180
  require "active_record/connection_adapters/oracle_enhanced/oci_quoting"
185
181
  # if JRuby
186
182
  elsif RUBY_ENGINE == "jruby"