activerecord-oracle_enhanced-adapter 1.7.7 → 1.7.11
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/History.md +45 -0
- data/README.md +3 -0
- data/VERSION +1 -1
- data/activerecord-oracle_enhanced-adapter.gemspec +2 -3
- data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +2 -6
- data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +0 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +2 -5
- data/lib/active_record/connection_adapters/oracle_enhanced/context_index.rb +0 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/cpk.rb +1 -3
- data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +0 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +2 -6
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +3 -0
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +0 -10
- data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +2 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +1 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +1 -5
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +0 -2
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +22 -4
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +0 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +4 -7
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +3 -7
- data/lib/active_record/oracle_enhanced/type/boolean.rb +0 -1
- data/lib/active_record/oracle_enhanced/type/integer.rb +1 -1
- data/lib/active_record/oracle_enhanced/type/national_character_string.rb +0 -1
- data/lib/active_record/oracle_enhanced/type/raw.rb +0 -1
- data/lib/active_record/oracle_enhanced/type/string.rb +0 -1
- data/lib/active_record/oracle_enhanced/type/text.rb +0 -2
- data/lib/activerecord-oracle_enhanced-adapter.rb +0 -1
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +28 -1
- data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +3 -1
- data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +4 -4
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +20 -8
- data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +0 -1
- data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +2 -2
- data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +3 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +5 -5
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +4 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +40 -0
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +86 -29
- data/spec/spec_helper.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecf7fafba601af5f9f8fb575e5b969d3a182b7ea
|
|
4
|
+
data.tar.gz: 2f4e070cb162a4be21eb45dc747603683ef0c0bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5357a8e895491e97b631594d594ec3c37c73a4a983864780df23ff7f906bd26dd8b916c94b986fdff881c17729b63abc0c230dbeea38ca8df725e0b8ea645ee2
|
|
7
|
+
data.tar.gz: f1081e23da7dc9423c85c083de163841bd73c56e77c496e87d65ad970ceb927076e0e5884aad2412315cc0ea66c4a261e3047153be4ef8bd0e7933081655e4b7
|
data/History.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
## 1.7.11 / 2017-03-29
|
|
2
|
+
|
|
3
|
+
* Changes and bug fixes
|
|
4
|
+
* Bump JRuby to 9.1.8.0 and add JRUBY_OPTS [#1233]
|
|
5
|
+
* Fix the BINARY_FLOAT column type returns nil in JRuby [#1256]
|
|
6
|
+
|
|
7
|
+
* Known issues
|
|
8
|
+
* No changes since 1.7.7
|
|
9
|
+
|
|
10
|
+
## 1.7.10 / 2017-02-03
|
|
11
|
+
|
|
12
|
+
* Changes and bug fixes
|
|
13
|
+
* Address `TypeError: can't cast Java::JavaSql::Timestamp` [#1147, 1153]
|
|
14
|
+
* Use docker-oracle-xe-11g for Travis CI for release17 branch [#1150]
|
|
15
|
+
* Use JRuby 9.1.7.0 for release17 branch [#1154]
|
|
16
|
+
* Pending until further investigation made for #908 for release17 branch [#1151]
|
|
17
|
+
|
|
18
|
+
* Known issues
|
|
19
|
+
* No changes since 1.7.7
|
|
20
|
+
|
|
21
|
+
## 1.7.9 / 2016-12-26
|
|
22
|
+
|
|
23
|
+
* Changes and bug fixes
|
|
24
|
+
|
|
25
|
+
* Fix ORA-00933 error when executing `rails db:schema:load` [#1084]
|
|
26
|
+
* Quoting booleans should return a frozen string [#1083]
|
|
27
|
+
* CI against ruby 2.4.0 [#1096, #1086]
|
|
28
|
+
|
|
29
|
+
* Known issues
|
|
30
|
+
* No changes since 1.7.7
|
|
31
|
+
|
|
32
|
+
## 1.7.8 / 2016-12-06
|
|
33
|
+
|
|
34
|
+
* Changes and bug fixes
|
|
35
|
+
* Separate schema migration insert statements correctly [#1074]
|
|
36
|
+
* Add `use_old_oracle_visitor` example [#1068]
|
|
37
|
+
* `supports_fetch_first_n_rows_and_offset?` returns `false` when `use_old_oracle_visitor` is true {1070, #1075]
|
|
38
|
+
* Suppress `create_table(:posts, {:force=>true})` message [#1067, #1072]
|
|
39
|
+
* Enable rubocop and Code Climate [#1056, #1057, #1060, #1062, #1071]
|
|
40
|
+
* Bump MRI version for travis [#1054, #1059]
|
|
41
|
+
* Drop `ActiveRecord::InternalMetadata.table_name` after each spec [#1073]
|
|
42
|
+
|
|
43
|
+
* Known issues
|
|
44
|
+
* No changes since 1.7.7
|
|
45
|
+
|
|
1
46
|
## 1.7.7 / 2016-11-15
|
|
2
47
|
|
|
3
48
|
* Changes and bug fixes
|
data/README.md
CHANGED
|
@@ -240,6 +240,9 @@ ActiveSupport.on_load(:active_record) do
|
|
|
240
240
|
# start primary key sequences from 1 (and not 10000) and take just one next value in each session
|
|
241
241
|
self.default_sequence_start_value = "1 NOCACHE INCREMENT BY 1"
|
|
242
242
|
|
|
243
|
+
# Use old visitor for Oracle 12c database
|
|
244
|
+
self.use_old_oracle_visitor = true
|
|
245
|
+
|
|
243
246
|
# other settings ...
|
|
244
247
|
end
|
|
245
248
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.7.
|
|
1
|
+
1.7.11
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = %q{activerecord-oracle_enhanced-adapter}
|
|
3
|
-
s.version = "1.7.
|
|
3
|
+
s.version = "1.7.11"
|
|
4
4
|
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
6
6
|
s.required_ruby_version = '>= 2.2.2'
|
|
7
7
|
s.license = 'MIT'
|
|
8
8
|
s.authors = [%q{Raimonds Simanovskis}]
|
|
9
|
-
s.date = %q{
|
|
9
|
+
s.date = %q{2017-03-29}
|
|
10
10
|
s.description = %q{Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
|
|
11
11
|
This adapter is superset of original ActiveRecord Oracle adapter.
|
|
12
12
|
}
|
|
@@ -92,4 +92,3 @@ This adapter is superset of original ActiveRecord Oracle adapter.
|
|
|
92
92
|
s.add_runtime_dependency(%q<ruby-plsql>, [">= 0.5.0"])
|
|
93
93
|
s.license = 'MIT'
|
|
94
94
|
end
|
|
95
|
-
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module ActiveRecord
|
|
2
2
|
module ConnectionAdapters #:nodoc:
|
|
3
3
|
class OracleEnhancedColumn < Column
|
|
4
|
-
|
|
5
4
|
attr_reader :table_name, :nchar, :virtual_column_data_default, :returning_id #:nodoc:
|
|
6
5
|
|
|
7
6
|
def initialize(name, default, sql_type_metadata = nil, null = true, table_name = nil, virtual = false, returning_id = nil, comment = nil) #:nodoc:
|
|
@@ -69,7 +68,7 @@ module ActiveRecord
|
|
|
69
68
|
# #TODO: may be deprecated due to conflict with variable
|
|
70
69
|
# ActiveRecord::Base.connection.column_comment(@table_name, name)
|
|
71
70
|
# end
|
|
72
|
-
|
|
71
|
+
|
|
73
72
|
private
|
|
74
73
|
|
|
75
74
|
def self.extract_value_from_default(default)
|
|
@@ -85,7 +84,7 @@ module ActiveRecord
|
|
|
85
84
|
value.respond_to?(:hour) && (value.hour == 0 and value.min == 0 and value.sec == 0) ?
|
|
86
85
|
Date.new(value.year, value.month, value.day) : value
|
|
87
86
|
end
|
|
88
|
-
|
|
87
|
+
|
|
89
88
|
class << self
|
|
90
89
|
protected
|
|
91
90
|
|
|
@@ -128,10 +127,7 @@ module ActiveRecord
|
|
|
128
127
|
end
|
|
129
128
|
DateTime.strptime(string, OracleEnhancedAdapter.string_to_date_format).to_date
|
|
130
129
|
end
|
|
131
|
-
|
|
132
130
|
end
|
|
133
131
|
end
|
|
134
|
-
|
|
135
132
|
end
|
|
136
|
-
|
|
137
133
|
end
|
|
@@ -2,7 +2,6 @@ module ActiveRecord #:nodoc:
|
|
|
2
2
|
module ConnectionAdapters #:nodoc:
|
|
3
3
|
module OracleEnhanced #:nodoc:
|
|
4
4
|
module ColumnDumper #:nodoc:
|
|
5
|
-
|
|
6
5
|
def column_spec(column)
|
|
7
6
|
spec = Hash[prepare_column_options(column).map { |k, v| [k, "#{k}: #{v}"] }]
|
|
8
7
|
spec[:name] = column.name.inspect
|
|
@@ -63,7 +62,6 @@ module ActiveRecord #:nodoc:
|
|
|
63
62
|
column.type.inspect if column.virtual?
|
|
64
63
|
end
|
|
65
64
|
end
|
|
66
|
-
|
|
67
65
|
end
|
|
68
66
|
end
|
|
69
67
|
end
|
|
@@ -2,7 +2,6 @@ module ActiveRecord
|
|
|
2
2
|
module ConnectionAdapters
|
|
3
3
|
# interface independent methods
|
|
4
4
|
class OracleEnhancedConnection #:nodoc:
|
|
5
|
-
|
|
6
5
|
def self.create(config)
|
|
7
6
|
case ORACLE_ENHANCED_CONNECTION
|
|
8
7
|
when :oci
|
|
@@ -97,17 +96,15 @@ module ActiveRecord
|
|
|
97
96
|
result = select(sql, name = nil)
|
|
98
97
|
result.map { |r| r.values.first }
|
|
99
98
|
end
|
|
100
|
-
|
|
101
99
|
end
|
|
102
100
|
|
|
103
101
|
# Returns array with major and minor version of database (e.g. [12, 1])
|
|
104
102
|
def database_version
|
|
105
103
|
raise NoMethodError, "Not implemented for this raw driver"
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
class OracleEnhancedConnectionException < StandardError #:nodoc:
|
|
109
104
|
end
|
|
110
105
|
|
|
106
|
+
class OracleEnhancedConnectionException < StandardError #:nodoc:
|
|
107
|
+
end
|
|
111
108
|
end
|
|
112
109
|
end
|
|
113
110
|
|
|
@@ -2,7 +2,6 @@ module ActiveRecord
|
|
|
2
2
|
module ConnectionAdapters
|
|
3
3
|
module OracleEnhanced
|
|
4
4
|
module ContextIndex
|
|
5
|
-
|
|
6
5
|
# Define full text index with Oracle specific CONTEXT index type
|
|
7
6
|
#
|
|
8
7
|
# Oracle CONTEXT index by default supports full text indexing of one column.
|
|
@@ -336,7 +335,6 @@ module ActiveRecord
|
|
|
336
335
|
order("SCORE(#{score_label}) DESC")
|
|
337
336
|
end
|
|
338
337
|
end
|
|
339
|
-
|
|
340
338
|
end
|
|
341
339
|
end
|
|
342
340
|
end
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
module ActiveRecord #:nodoc:
|
|
2
2
|
module ConnectionAdapters #:nodoc:
|
|
3
3
|
module OracleEnhancedCpk #:nodoc:
|
|
4
|
-
|
|
5
4
|
# This mightn't be in Core, but count(distinct x,y) doesn't work for me.
|
|
6
5
|
# Return that not supported if composite_primary_keys gem is required.
|
|
7
6
|
def supports_count_distinct? #:nodoc:
|
|
8
7
|
@supports_count_distinct ||= ! defined?(CompositePrimaryKeys)
|
|
9
8
|
end
|
|
10
|
-
|
|
9
|
+
|
|
11
10
|
def concat(*columns) #:nodoc:
|
|
12
11
|
"(#{columns.join('||')})"
|
|
13
12
|
end
|
|
14
|
-
|
|
15
13
|
end
|
|
16
14
|
end
|
|
17
15
|
end
|
|
@@ -46,13 +46,10 @@ rescue LoadError, NameError
|
|
|
46
46
|
raise LoadError, "ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install #{ojdbc_jars ? ojdbc_jars.join(' or ') : "Oracle JDBC"} library."
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
|
|
50
49
|
module ActiveRecord
|
|
51
50
|
module ConnectionAdapters
|
|
52
|
-
|
|
53
51
|
# JDBC database interface for JRuby
|
|
54
52
|
class OracleEnhancedJDBCConnection < OracleEnhancedConnection #:nodoc:
|
|
55
|
-
|
|
56
53
|
attr_accessor :active
|
|
57
54
|
alias :active? :active
|
|
58
55
|
|
|
@@ -452,7 +449,6 @@ module ActiveRecord
|
|
|
452
449
|
def close
|
|
453
450
|
@raw_statement.close
|
|
454
451
|
end
|
|
455
|
-
|
|
456
452
|
end
|
|
457
453
|
|
|
458
454
|
def select(sql, name = nil, return_column_names = false)
|
|
@@ -525,6 +521,8 @@ module ActiveRecord
|
|
|
525
521
|
else
|
|
526
522
|
BigDecimal.new(d.stringValue)
|
|
527
523
|
end
|
|
524
|
+
when :BINARY_FLOAT
|
|
525
|
+
rset.getFloat(i)
|
|
528
526
|
when :VARCHAR2, :CHAR, :LONG, :NVARCHAR2, :NCHAR
|
|
529
527
|
rset.getString(i)
|
|
530
528
|
when :DATE
|
|
@@ -573,8 +571,6 @@ module ActiveRecord
|
|
|
573
571
|
end
|
|
574
572
|
end
|
|
575
573
|
end
|
|
576
|
-
|
|
577
574
|
end
|
|
578
|
-
|
|
579
575
|
end
|
|
580
576
|
end
|
|
@@ -16,6 +16,9 @@ module ActiveRecord
|
|
|
16
16
|
Java::oracle.sql.DATE.new(value.strftime("%Y-%m-%d %H:%M:%S"))
|
|
17
17
|
when Time
|
|
18
18
|
Java::java.sql.Timestamp.new(value.year-1900, value.month-1, value.day, value.hour, value.min, value.sec, value.usec * 1000)
|
|
19
|
+
when Java::JavaSql::Timestamp
|
|
20
|
+
# Returning value as it is likely this value was already type casted from Time to Java::JavaSql::Timestamp
|
|
21
|
+
value
|
|
19
22
|
else
|
|
20
23
|
super
|
|
21
24
|
end
|
|
@@ -18,10 +18,8 @@ end
|
|
|
18
18
|
|
|
19
19
|
module ActiveRecord
|
|
20
20
|
module ConnectionAdapters
|
|
21
|
-
|
|
22
21
|
# OCI database interface for MRI
|
|
23
22
|
class OracleEnhancedOCIConnection < OracleEnhancedConnection #:nodoc:
|
|
24
|
-
|
|
25
23
|
def initialize(config)
|
|
26
24
|
@raw_connection = OCI8EnhancedAutoRecover.new(config, OracleEnhancedOCIFactory)
|
|
27
25
|
# default schema owner
|
|
@@ -188,7 +186,6 @@ module ActiveRecord
|
|
|
188
186
|
def close
|
|
189
187
|
@raw_cursor.close
|
|
190
188
|
end
|
|
191
|
-
|
|
192
189
|
end
|
|
193
190
|
|
|
194
191
|
def select(sql, name = nil, return_column_names = false)
|
|
@@ -312,7 +309,6 @@ module ActiveRecord
|
|
|
312
309
|
::DateTime.civil(year, month, day, hour, min, sec, offset)
|
|
313
310
|
end
|
|
314
311
|
end
|
|
315
|
-
|
|
316
312
|
end
|
|
317
313
|
|
|
318
314
|
# The OracleEnhancedOCIFactory factors out the code necessary to connect and
|
|
@@ -369,15 +365,10 @@ module ActiveRecord
|
|
|
369
365
|
conn
|
|
370
366
|
end
|
|
371
367
|
end
|
|
372
|
-
|
|
373
|
-
|
|
374
368
|
end
|
|
375
369
|
end
|
|
376
370
|
|
|
377
|
-
|
|
378
|
-
|
|
379
371
|
class OCI8 #:nodoc:
|
|
380
|
-
|
|
381
372
|
def describe(name)
|
|
382
373
|
info = describe_table(name.to_s)
|
|
383
374
|
raise %Q{"DESC #{name}" failed} if info.nil?
|
|
@@ -463,6 +454,5 @@ class OCI8EnhancedAutoRecover < DelegateClass(OCI8) #:nodoc:
|
|
|
463
454
|
retry
|
|
464
455
|
end
|
|
465
456
|
end
|
|
466
|
-
|
|
467
457
|
end
|
|
468
458
|
#:startdoc:
|
|
@@ -103,7 +103,7 @@ module ActiveRecord
|
|
|
103
103
|
|
|
104
104
|
def quoted_true #:nodoc:
|
|
105
105
|
return "'#{self.class.boolean_to_string(true)}'" if emulate_booleans_from_strings
|
|
106
|
-
"1"
|
|
106
|
+
"1".freeze
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def unquoted_true #:nodoc:
|
|
@@ -113,7 +113,7 @@ module ActiveRecord
|
|
|
113
113
|
|
|
114
114
|
def quoted_false #:nodoc:
|
|
115
115
|
return "'#{self.class.boolean_to_string(false)}'" if emulate_booleans_from_strings
|
|
116
|
-
"0"
|
|
116
|
+
"0".freeze
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
def unquoted_false #:nodoc:
|
|
@@ -44,7 +44,7 @@ module ActiveRecord
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def default_tablespace_for(type)
|
|
47
|
-
(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.default_tablespaces[type] ||
|
|
47
|
+
(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.default_tablespaces[type] ||
|
|
48
48
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.default_tablespaces[native_database_types[type][:name]]) rescue nil
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -90,7 +90,6 @@ module ActiveRecord
|
|
|
90
90
|
MSG
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
|
-
|
|
94
93
|
end
|
|
95
94
|
end
|
|
96
95
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module ActiveRecord
|
|
2
2
|
module ConnectionAdapters
|
|
3
3
|
module OracleEnhanced
|
|
4
|
-
|
|
5
4
|
class ForeignKeyDefinition < ActiveRecord::ConnectionAdapters::ForeignKeyDefinition
|
|
6
5
|
def name
|
|
7
6
|
if options[:name].length > OracleEnhancedAdapter::IDENTIFIER_MAX_LENGTH
|
|
@@ -18,7 +17,7 @@ module ActiveRecord
|
|
|
18
17
|
|
|
19
18
|
class IndexDefinition < ActiveRecord::ConnectionAdapters::IndexDefinition
|
|
20
19
|
attr_accessor :parameters, :statement_parameters, :tablespace
|
|
21
|
-
|
|
20
|
+
|
|
22
21
|
def initialize(table, name, unique, columns, lengths, orders, where, type, using, parameters, statement_parameters, tablespace)
|
|
23
22
|
@parameters = parameters
|
|
24
23
|
@statement_parameters = statement_parameters
|
|
@@ -28,7 +27,6 @@ module ActiveRecord
|
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
class ColumnDefinition < ActiveRecord::ConnectionAdapters::ColumnDefinition
|
|
31
|
-
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
|
|
@@ -65,7 +63,6 @@ module ActiveRecord
|
|
|
65
63
|
def create_column_definition(name, type)
|
|
66
64
|
OracleEnhanced::ColumnDefinition.new name, type
|
|
67
65
|
end
|
|
68
|
-
|
|
69
66
|
end
|
|
70
67
|
|
|
71
68
|
class AlterTable < ActiveRecord::ConnectionAdapters::AlterTable
|
|
@@ -86,7 +83,6 @@ module ActiveRecord
|
|
|
86
83
|
@base.remove_foreign_key(@name, options)
|
|
87
84
|
end
|
|
88
85
|
end
|
|
89
|
-
|
|
90
86
|
end
|
|
91
87
|
end
|
|
92
88
|
end
|
|
@@ -2,7 +2,6 @@ module ActiveRecord #:nodoc:
|
|
|
2
2
|
module ConnectionAdapters #:nodoc:
|
|
3
3
|
module OracleEnhanced #:nodoc:
|
|
4
4
|
module SchemaDumper #:nodoc:
|
|
5
|
-
|
|
6
5
|
private
|
|
7
6
|
|
|
8
7
|
def tables(stream)
|
|
@@ -198,7 +197,6 @@ module ActiveRecord #:nodoc:
|
|
|
198
197
|
end
|
|
199
198
|
end
|
|
200
199
|
end
|
|
201
|
-
|
|
202
200
|
end
|
|
203
201
|
end
|
|
204
202
|
end
|
|
@@ -117,6 +117,26 @@ module ActiveRecord
|
|
|
117
117
|
super
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
+
def insert_versions_sql(versions) # :nodoc:
|
|
121
|
+
sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
|
|
122
|
+
|
|
123
|
+
if supports_multi_insert?
|
|
124
|
+
versions.inject("INSERT ALL\n") { |sql, version|
|
|
125
|
+
sql << "INTO #{sm_table} (version) VALUES (#{quote(version)})\n"
|
|
126
|
+
} << "SELECT * FROM DUAL\n"
|
|
127
|
+
else
|
|
128
|
+
if versions.is_a?(Array)
|
|
129
|
+
# called from ActiveRecord::Base.connection#dump_schema_information
|
|
130
|
+
versions.map { |version|
|
|
131
|
+
"INSERT INTO #{sm_table} (version) VALUES (#{quote(version)})"
|
|
132
|
+
}.join("\n\n/\n\n")
|
|
133
|
+
else
|
|
134
|
+
# called from ActiveRecord::Base.connection#assume_migrated_upto_version
|
|
135
|
+
"INSERT INTO #{sm_table} (version) VALUES (#{quote(versions)})"
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
120
140
|
def initialize_schema_migrations_table
|
|
121
141
|
super
|
|
122
142
|
end
|
|
@@ -366,7 +386,7 @@ module ActiveRecord
|
|
|
366
386
|
if options[:dependent]
|
|
367
387
|
ActiveSupport::Deprecation.warn "`:dependent` option will be deprecated. Please use `:on_delete` option"
|
|
368
388
|
end
|
|
369
|
-
case options[:dependent]
|
|
389
|
+
case options[:dependent]
|
|
370
390
|
when :delete then options[:on_delete] = :cascade
|
|
371
391
|
when :nullify then options[:on_delete] = :nullify
|
|
372
392
|
else
|
|
@@ -449,7 +469,7 @@ module ActiveRecord
|
|
|
449
469
|
|
|
450
470
|
def create_alter_table(name)
|
|
451
471
|
OracleEnhanced::AlterTable.new create_table_definition(name, false, {})
|
|
452
|
-
end
|
|
472
|
+
end
|
|
453
473
|
|
|
454
474
|
def tablespace_for(obj_type, tablespace_option, table_name=nil, column_name=nil)
|
|
455
475
|
tablespace_sql = ''
|
|
@@ -467,7 +487,6 @@ module ActiveRecord
|
|
|
467
487
|
(default_tablespaces[type] || default_tablespaces[native_database_types[type][:name]]) rescue nil
|
|
468
488
|
end
|
|
469
489
|
|
|
470
|
-
|
|
471
490
|
def column_for(table_name, column_name)
|
|
472
491
|
unless column = columns(table_name).find { |c| c.name == column_name.to_s }
|
|
473
492
|
raise "No such column: #{table_name}.#{column_name}"
|
|
@@ -520,7 +539,6 @@ module ActiveRecord
|
|
|
520
539
|
|
|
521
540
|
execute("ALTER INDEX #{quote_column_name(index_name)} REBUILD TABLESPACE #{tablespace}")
|
|
522
541
|
end
|
|
523
|
-
|
|
524
542
|
end
|
|
525
543
|
end
|
|
526
544
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module ActiveRecord #:nodoc:
|
|
2
2
|
module ConnectionAdapters #:nodoc:
|
|
3
3
|
module OracleEnhancedStructureDump #:nodoc:
|
|
4
|
-
|
|
5
4
|
# Statements separator used in structure dump to allow loading of structure dump also with SQL*Plus
|
|
6
5
|
STATEMENT_TOKEN = "\n\n/\n\n"
|
|
7
6
|
|
|
@@ -73,7 +72,7 @@ module ActiveRecord #:nodoc:
|
|
|
73
72
|
|
|
74
73
|
def structure_dump_primary_key(table) #:nodoc:
|
|
75
74
|
opts = {:name => '', :cols => []}
|
|
76
|
-
pks = select_all(<<-SQL, "Primary Keys")
|
|
75
|
+
pks = select_all(<<-SQL, "Primary Keys")
|
|
77
76
|
SELECT a.constraint_name, a.column_name, a.position
|
|
78
77
|
FROM all_cons_columns a
|
|
79
78
|
JOIN all_constraints c
|
|
@@ -92,7 +91,7 @@ module ActiveRecord #:nodoc:
|
|
|
92
91
|
|
|
93
92
|
def structure_dump_unique_keys(table) #:nodoc:
|
|
94
93
|
keys = {}
|
|
95
|
-
uks = select_all(<<-SQL, "Primary Keys")
|
|
94
|
+
uks = select_all(<<-SQL, "Primary Keys")
|
|
96
95
|
SELECT a.constraint_name, a.column_name, a.position
|
|
97
96
|
FROM all_cons_columns a
|
|
98
97
|
JOIN all_constraints c
|
|
@@ -191,7 +190,6 @@ module ActiveRecord #:nodoc:
|
|
|
191
190
|
sql
|
|
192
191
|
end
|
|
193
192
|
|
|
194
|
-
|
|
195
193
|
# Extract all stored procedures, packages, synonyms and views.
|
|
196
194
|
def structure_dump_db_stored_code #:nodoc:
|
|
197
195
|
structure = []
|
|
@@ -215,7 +213,7 @@ module ActiveRecord #:nodoc:
|
|
|
215
213
|
structure << ddl
|
|
216
214
|
end
|
|
217
215
|
|
|
218
|
-
# export views
|
|
216
|
+
# export views
|
|
219
217
|
select_all("SELECT view_name, text FROM all_views WHERE owner = SYS_CONTEXT('userenv', 'session_user') ORDER BY view_name ASC").each do |view|
|
|
220
218
|
structure << "CREATE OR REPLACE FORCE VIEW #{view['view_name']} AS\n #{view['text']}"
|
|
221
219
|
end
|
|
@@ -298,7 +296,7 @@ module ActiveRecord #:nodoc:
|
|
|
298
296
|
|
|
299
297
|
private
|
|
300
298
|
|
|
301
|
-
# virtual columns are an 11g feature. This returns [] if feature is not
|
|
299
|
+
# virtual columns are an 11g feature. This returns [] if feature is not
|
|
302
300
|
# present or none are found.
|
|
303
301
|
# return [{'column_name' => 'FOOS', 'data_default' => '...'}, ...]
|
|
304
302
|
def virtual_columns_for(table)
|
|
@@ -336,7 +334,6 @@ module ActiveRecord #:nodoc:
|
|
|
336
334
|
string << STATEMENT_TOKEN unless string.blank?
|
|
337
335
|
string
|
|
338
336
|
end
|
|
339
|
-
|
|
340
337
|
end
|
|
341
338
|
end
|
|
342
339
|
end
|
|
@@ -46,7 +46,6 @@ end
|
|
|
46
46
|
|
|
47
47
|
module ActiveRecord
|
|
48
48
|
class Base
|
|
49
|
-
|
|
50
49
|
# Specify table columns which should be ignored by ActiveRecord, e.g.:
|
|
51
50
|
#
|
|
52
51
|
# ignore_table_columns :attribute1, :attribute2
|
|
@@ -173,7 +172,6 @@ module ActiveRecord
|
|
|
173
172
|
end
|
|
174
173
|
|
|
175
174
|
module ConnectionAdapters #:nodoc:
|
|
176
|
-
|
|
177
175
|
# Oracle enhanced adapter will work with both
|
|
178
176
|
# Ruby 1.8/1.9 ruby-oci8 gem (which provides interface to Oracle OCI client)
|
|
179
177
|
# or with JRuby and Oracle JDBC driver.
|
|
@@ -445,7 +443,7 @@ module ActiveRecord
|
|
|
445
443
|
end
|
|
446
444
|
|
|
447
445
|
def arel_visitor # :nodoc:
|
|
448
|
-
if supports_fetch_first_n_rows_and_offset?
|
|
446
|
+
if supports_fetch_first_n_rows_and_offset?
|
|
449
447
|
Arel::Visitors::Oracle12.new(self)
|
|
450
448
|
else
|
|
451
449
|
Arel::Visitors::Oracle.new(self)
|
|
@@ -477,7 +475,7 @@ module ActiveRecord
|
|
|
477
475
|
end
|
|
478
476
|
|
|
479
477
|
def supports_fetch_first_n_rows_and_offset?
|
|
480
|
-
if @connection.database_version == [12,1]
|
|
478
|
+
if !use_old_oracle_visitor && @connection.database_version == [12,1]
|
|
481
479
|
true
|
|
482
480
|
else
|
|
483
481
|
false
|
|
@@ -495,7 +493,7 @@ module ActiveRecord
|
|
|
495
493
|
end
|
|
496
494
|
|
|
497
495
|
def supports_multi_insert?
|
|
498
|
-
|
|
496
|
+
@connection.database_version.to_s >= [11, 2].to_s
|
|
499
497
|
end
|
|
500
498
|
|
|
501
499
|
#:stopdoc:
|
|
@@ -767,7 +765,6 @@ module ActiveRecord
|
|
|
767
765
|
data_sources
|
|
768
766
|
end
|
|
769
767
|
|
|
770
|
-
|
|
771
768
|
def data_sources
|
|
772
769
|
select_values(
|
|
773
770
|
"SELECT DECODE(table_name, UPPER(table_name), LOWER(table_name), table_name) FROM all_tables WHERE owner = SYS_CONTEXT('userenv', 'current_schema') AND secondary = 'N'",
|
|
@@ -1306,7 +1303,6 @@ module ActiveRecord
|
|
|
1306
1303
|
@logger.debug "DBMS_OUTPUT: #{result[:line]}" if @logger
|
|
1307
1304
|
end
|
|
1308
1305
|
end
|
|
1309
|
-
|
|
1310
1306
|
end
|
|
1311
1307
|
end
|
|
1312
1308
|
end
|
|
@@ -4,7 +4,6 @@ module ActiveRecord
|
|
|
4
4
|
module OracleEnhanced
|
|
5
5
|
module Type
|
|
6
6
|
class Text < ActiveModel::Type::Text # :nodoc:
|
|
7
|
-
|
|
8
7
|
def changed_in_place?(raw_old_value, new_value)
|
|
9
8
|
#TODO: Needs to find a way not to cast here.
|
|
10
9
|
raw_old_value = cast(raw_old_value)
|
|
@@ -25,7 +24,6 @@ module ActiveRecord
|
|
|
25
24
|
@value
|
|
26
25
|
end
|
|
27
26
|
end
|
|
28
|
-
|
|
29
27
|
end
|
|
30
28
|
end
|
|
31
29
|
end
|