activerecord-oracle_enhanced-adapter 1.7.7 → 1.8.0
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 +225 -0
- data/README.md +14 -0
- data/VERSION +1 -1
- data/lib/active_record/connection_adapters/emulation/oracle_adapter.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +7 -63
- data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +6 -52
- data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +13 -16
- data/lib/active_record/connection_adapters/oracle_enhanced/context_index.rb +117 -119
- data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +33 -27
- data/lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb +10 -10
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +58 -77
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +0 -4
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +51 -79
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb +4 -4
- data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +77 -77
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +16 -45
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +60 -65
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +33 -51
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +149 -162
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +112 -132
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +3 -4
- data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +69 -107
- data/lib/active_record/connection_adapters/oracle_enhanced/version.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +292 -539
- data/lib/active_record/oracle_enhanced/type/boolean.rb +7 -11
- data/lib/active_record/oracle_enhanced/type/integer.rb +4 -5
- data/lib/active_record/oracle_enhanced/type/json.rb +8 -0
- data/lib/active_record/oracle_enhanced/type/national_character_string.rb +1 -2
- data/lib/active_record/oracle_enhanced/type/raw.rb +2 -4
- data/lib/active_record/oracle_enhanced/type/string.rb +2 -3
- data/lib/active_record/oracle_enhanced/type/text.rb +2 -4
- data/lib/active_record/oracle_enhanced/type/timestamptz.rb +23 -0
- data/lib/activerecord-oracle_enhanced-adapter.rb +2 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +82 -162
- data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +35 -35
- data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +44 -42
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +270 -365
- data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +14 -7
- data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +5 -7
- data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +118 -127
- data/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb +2 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +73 -77
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +68 -83
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +263 -329
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +103 -48
- data/spec/spec_config.yaml.template +11 -0
- data/spec/spec_helper.rb +59 -60
- data/spec/support/alter_system_user_password.sql +2 -0
- data/spec/support/create_oracle_enhanced_users.sql +31 -0
- metadata +25 -25
- data/.rspec +0 -2
- data/Gemfile +0 -22
- data/RUNNING_TESTS.md +0 -83
- data/Rakefile +0 -45
- data/activerecord-oracle_enhanced-adapter.gemspec +0 -95
- data/lib/active_record/connection_adapters/oracle_enhanced/cpk.rb +0 -21
- data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +0 -113
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ee1b843fcd1ec26d858001def3874b07ad7e42b
|
|
4
|
+
data.tar.gz: '079d2060aa9778cfd83b2ff527fae49316d722ab'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e5a0750962779f3da3cce127223ed7c4eefb8f7a95a5b6efe0f55a6d1d3a360013f24f893956ff4c32c6eb7f98e2eb6eff082aea574dafc2a71cf83e292e77b
|
|
7
|
+
data.tar.gz: 61b9e6b44542a1d0a8811e79c0403ec340f6bbeeb1fa55adc7670ee484a9100cf5e3c72a30f23133a6b3b458782bc503198372298430a00a4dc35f7ffbd9de71
|
data/History.md
CHANGED
|
@@ -1,3 +1,228 @@
|
|
|
1
|
+
## 1.8.0 / 2017-04-27
|
|
2
|
+
|
|
3
|
+
* Major enhancements
|
|
4
|
+
* Support Rails 5.1.0
|
|
5
|
+
* Add JSON attribute support [#1240]
|
|
6
|
+
* Update `database.yml` when `rails new <new_app> -d oracle` specified [rails/rails#28257]
|
|
7
|
+
|
|
8
|
+
* Changes and bug fixes
|
|
9
|
+
* No changes since 1.8.0.rc3
|
|
10
|
+
|
|
11
|
+
## 1.8.0.rc3 / 2017-04-24
|
|
12
|
+
|
|
13
|
+
* Changes and bug fixes
|
|
14
|
+
* Include VERSION file in gem [#1302, #1303]
|
|
15
|
+
|
|
16
|
+
## 1.8.0.rc2 / 2017-04-19
|
|
17
|
+
|
|
18
|
+
* Changes and bug fixes
|
|
19
|
+
* Fix `select_all` with legacy `binds` [#1246,#1248,#1250]
|
|
20
|
+
* Fix the `BINARY_FLOAT` column type returns nil in JRuby [#1244, #1254, #1255]
|
|
21
|
+
* Handle `TIMESTAMP WITH TIMEZONE` separately from `TIMEZONE` [#1206, #1267, #1268]
|
|
22
|
+
* Changing `NLS_DATE_FORMAT` and `NLS_TIMESTAMP_FORMAT` is not supported [#1267, #1268]
|
|
23
|
+
* Let abstract adapter type cast Date, DateTime and Time for JRuby [#1272, #1273]
|
|
24
|
+
* Collapse a file specification in gemspec [#1296, #1297]
|
|
25
|
+
* Do not write VERSION directly with gemspec [#1298, #1299]
|
|
26
|
+
* Omit specification of release date in gemspec [#1298, #1299]
|
|
27
|
+
* Add missing `timestamptz.rb` to gemspec at release18 branch [#1286]
|
|
28
|
+
* Remove specs for unsupported behaviour which causes `ORA-01861` [#1267, #1269, #1271]
|
|
29
|
+
* Address `OCIException: OCI8 was already closed` at specs for JSON [#1265, #1266]
|
|
30
|
+
* Bump Ruby version to 2.2.7 [#1261]
|
|
31
|
+
|
|
32
|
+
## 1.8.0.rc1 / 2017-03-20
|
|
33
|
+
|
|
34
|
+
* Major enhancements
|
|
35
|
+
* Support Rails 5.1.0.rc1
|
|
36
|
+
* Add JSON attribute support #1240
|
|
37
|
+
* Update `database.yml` when `rails new <new_app> -d oracle` specified [rails/rails#28257]
|
|
38
|
+
|
|
39
|
+
* Changes and bug fixes
|
|
40
|
+
* Eliminate a redundant empty lines in schema.rb generated by SchemaDumper [#1232]
|
|
41
|
+
* Align the columns of db/structure.sql [#1242]
|
|
42
|
+
* Use Abstract StatementPool [#1228]
|
|
43
|
+
* Decouple Composite Primary Key code [#1224, #1225]
|
|
44
|
+
* Push `valid_type?` up to abstract adapter [#1208]
|
|
45
|
+
* Oracle12 visitor is also available for 12.2 [#1217]
|
|
46
|
+
* Oracle Database 12c Release 2 bundles new ojdbc8.jar [#1218]
|
|
47
|
+
* Deprecate `supports_migrations?` on connection adapters [#1209]
|
|
48
|
+
* Use `ActiveRecord::SchemaMigration.table_name` [#1221]
|
|
49
|
+
* No need to check if `changed?` defined [#1226]
|
|
50
|
+
* No need to initialize `@quoted_column_names` and `@quoted_table_names` [#1227]
|
|
51
|
+
* Hard code `empty_blob()` or `empty_clob()` based on types [#1229]
|
|
52
|
+
* ruby-plsql 0.6.0 or higher version is required [#1216]
|
|
53
|
+
* No need to specify `rack` in Gemfile [#1230]
|
|
54
|
+
* Bundle from more secure source [#1243]
|
|
55
|
+
* Add Travis CI build status [#1231]
|
|
56
|
+
* Bump JRuby to 9.1.8.0 [#1222]
|
|
57
|
+
* Remove a duplicate spec testing `Model.distinct.count` [#1235]
|
|
58
|
+
* Suppress unused and not initialized warnings [#1215]
|
|
59
|
+
* Suppress `WARNING: Using the `raise_error` matcher without providing a specific error` [#1219]
|
|
60
|
+
* Suppress `WARNING: Using `expect { }.not_to raise_error(...)` risks false positives` [#1220]
|
|
61
|
+
|
|
62
|
+
## 1.8.0.beta1 / 2017-02-27
|
|
63
|
+
|
|
64
|
+
* Major enhancements
|
|
65
|
+
* Support Rails 5.1.0.beta1
|
|
66
|
+
* Fallback :bigint to :integer for primary keys [#1077]
|
|
67
|
+
* Drop Java SE 6 or older version of Java SE support [#1126]
|
|
68
|
+
* Drop JRuby 9.0.x support for Rails 5.1 [#1147]
|
|
69
|
+
* Refactor ColumnDumper to support consistent Virtual column with Rails [#1185]
|
|
70
|
+
* Schema dumper supports `t.index` in `create_table` [#1187]
|
|
71
|
+
* `table_exists?` only checks tables, does not check views [#1179, #1191]
|
|
72
|
+
* `data_sources` returns tables and views [#1192]
|
|
73
|
+
* `Model.table_comment` syntax is not supported anymore [#1199]
|
|
74
|
+
* Remove Oracle enhanced adapter own foreign key implementations [#977]
|
|
75
|
+
|
|
76
|
+
* Changes and bug fixes
|
|
77
|
+
* Rails 5.1.0.beta1 is out [#1204]
|
|
78
|
+
* Composite foreign keys are not supported [#1188]
|
|
79
|
+
* Introduce `supports_virtual_columns?` [#1184]
|
|
80
|
+
* Made it able to change column with adding comment [#1156, #1164]
|
|
81
|
+
* Omit table comment option of schema.rb if it is blank [#1159]
|
|
82
|
+
* Fix to return nil if column comment is blank at table creation [#1158]
|
|
83
|
+
* `bind_param` arity change, not to take column [#1203]
|
|
84
|
+
* ActiveRecord `structure_dump` and `structure_load` signature changes [#1125]
|
|
85
|
+
* Quoting booleans should return a frozen string [#956]
|
|
86
|
+
* Pass `type_casted_binds` to log subscriber [#957]
|
|
87
|
+
* `supports_datetime_with_precision?` always returns `true` [#964]
|
|
88
|
+
* Handle ORA-00942 and ORA-00955 as `ActiveRecord::StatementInvalid` [#1093]
|
|
89
|
+
* Raise `ActiveRecord::StatementInvalid` at `rename_index` when old index does not exist [#1195]
|
|
90
|
+
* Handle `ORA-01418: specified index does not exist` as `ActiveRecord::StatementInvalid` [#1195]
|
|
91
|
+
* Raise ActiveRecord::NotNullViolation when OCIError: ORA-01400 [#1174]
|
|
92
|
+
* Rails 5.1 : insert into `returning_id` not working since rails/rails#26002 [#988, #1088]
|
|
93
|
+
* Make `exec_{insert,update}` signatures consistent [#966]
|
|
94
|
+
* Introduce OracleEnhanced `ColumnMethods` module and `AlterTable` `Table` classes [#1081]
|
|
95
|
+
* `empty_insert_statement_value` is not implemented [#1180]
|
|
96
|
+
* Switch to keyword args for `type_to_sql` [#1167, #1168]
|
|
97
|
+
* Replace `all_timestamp_attributes` with `all_timestamp_attributes_in_model` [#1129]
|
|
98
|
+
* `current_database` returns the expected database name [#1135]
|
|
99
|
+
* Use `supports_foreign_keys_in_create?` [#1143]
|
|
100
|
+
* Address `add_column` gets `ArgumentError: wrong number of arguments` [#1157, #1170]
|
|
101
|
+
* Address `change_column` `ArgumentError: wrong number of arguments` [#1171, #1172]
|
|
102
|
+
* SchemaDumper should not dump views as tables [#1192]
|
|
103
|
+
* Use Abstract `select_rows(arel, name = nil, binds = [])` [#1132]
|
|
104
|
+
* Address `OCIError: ORA-01756: quoted string not properly terminated:` [#1102]
|
|
105
|
+
* Use `table_exists?` and `tables` [#1170, #1178]
|
|
106
|
+
* Move `ActiveModel::Type::Text` to `ActiveRecord::Type::Text` [#1082]
|
|
107
|
+
* Support schema option for views [#1190]
|
|
108
|
+
* Quote table and trigger names containing sinqle quote character [#1192]
|
|
109
|
+
* Restore :raw type migration support [#1176]
|
|
110
|
+
* Refactor Boolean type by removing duplicate code [#1047]
|
|
111
|
+
* Remove deprecated methods to get and set columns [#958]
|
|
112
|
+
* Remove `is_?` deprecated methods [#959]
|
|
113
|
+
* Remove `quote_date_with_to_date` and `quote_timestamp_with_to_timestamp` #960
|
|
114
|
+
* Remove unnecessary comments in Type [#961]
|
|
115
|
+
* Remove options[:default] for virtual columns [#962]
|
|
116
|
+
* Remove `self.emulate_dates` and `self.emulate_dates_by_column_name` [#963]
|
|
117
|
+
* Delete `self.boolean_to_string` [#967]
|
|
118
|
+
* Delete Oracle enhanced its own `join_to_update` [#968]
|
|
119
|
+
* Remove `self.ignore_table_columns` [#969]
|
|
120
|
+
* Remove unused `self.virtual_columns` [#970]
|
|
121
|
+
* Remove `dump_schema_information` and `initialize_schema_migrations_table` [#972]
|
|
122
|
+
* Remove `fallback_string_to_date`, `fallback_string_to_time` [#974, #975, #1112]
|
|
123
|
+
* Remove `dependent` option from `add_foreign_key` [#976]
|
|
124
|
+
* Remove specs testing Rails `self.ignored_columns` features [#987]
|
|
125
|
+
* Remove `add_foreign_key` specs with `table_name_prefix` and `table_name_suffix` [#990]
|
|
126
|
+
* Remove `type_cast` method just calling super [#1201]
|
|
127
|
+
* Remove `ids_in_list_limit` alias [#1202]
|
|
128
|
+
* Remove unused comments from data types spec [#1079]
|
|
129
|
+
* Remove deprecated `table_exists?` and `tables` [#1100, #1178]
|
|
130
|
+
* Remove deprecated `name` argument from `#tables` [#1189]
|
|
131
|
+
* Prefer `SYS_CONTEXT` function than `v$nls_parameters` view [#1107]
|
|
132
|
+
* `initialize_schema_migrations_table` method has been removed [#1144]
|
|
133
|
+
* `index_name_exists?` at schema statements spec is not necessary [#1197]
|
|
134
|
+
* Remove comments for `data_source_exists?` [#1200]
|
|
135
|
+
* Address DEPRECATION WARNING: Passing a column to `quote` has been deprecated. [#978]
|
|
136
|
+
* Deprecate `supports_primary_key?` [#1177]
|
|
137
|
+
* Deprecate passing `default` to `index_name_exists?` [#1175]
|
|
138
|
+
* Suppress `add_index_options` method `DEPRECATION WARNING:` [#1193]
|
|
139
|
+
* Suppress `remove_index` method deprecation warning [#1194]
|
|
140
|
+
* Suppress DEPRECATION WARNING at `rename_index` [#1195]
|
|
141
|
+
* Suppress `oracle_enhanced_adapter.rb:591: warning: assigned but unused` [#1198]
|
|
142
|
+
* Use rails rubocop setting [#1111]
|
|
143
|
+
* Rubocop addresses `Extra empty line detected at class body beginning.` [#1078]
|
|
144
|
+
* Address `Lint/EndAlignment` offences by changing code ifself [#1113]
|
|
145
|
+
* rubocop `AlignWith` has been renamed to `EnforcedStyleAlignWith` [#1142]
|
|
146
|
+
* Add `Style/EmptyLinesAroundMethodBody` [#1173]
|
|
147
|
+
* Address git warnings: [#1000]
|
|
148
|
+
* Update `required_rubygems_version` just following rails.gemspec [#1110]
|
|
149
|
+
* Use the latest ruby-plsql while developing alpha version [#1114]
|
|
150
|
+
* Use the latest arel master while developing alpha version [#1115]
|
|
151
|
+
* Bump Arel to 8.0 [#1120, #1121, #1124]
|
|
152
|
+
* Use released Arel 8 [#1205]
|
|
153
|
+
* Remove duplicate license information [#965]
|
|
154
|
+
* Clean up comments and un-commented specs for table comment feature [#971]
|
|
155
|
+
* Use Rails migration `create_table` to create table and sequence [#991]
|
|
156
|
+
* Removed a invalid spec about TIMESTAMP column [#1020]
|
|
157
|
+
* Remove specs which set `attribute :hire_date, :date` [#1024]
|
|
158
|
+
* Remove version specification for rspec [#1055]
|
|
159
|
+
* Suppress `create_table(:test_employees, {:force=>true})` message [#1080]
|
|
160
|
+
* Perform `drop_table :test_employees` [#1087]
|
|
161
|
+
* Address rspec deprecation warning [#1089]
|
|
162
|
+
* Suppress rspec warning [#1101]
|
|
163
|
+
* Suppress `Dropped database 'ORCL'` messages while running rspec [#1103]
|
|
164
|
+
* Address rspec warnings by checking with `raise_errors_for_deprecations!` [#1104]
|
|
165
|
+
* `clear_cache!` always exists at least since Rails 4.0 [#1106]
|
|
166
|
+
* Use SimpleCov [#1108]
|
|
167
|
+
* Enable RSpec `--warnings` option [#1116]
|
|
168
|
+
* Remove entry for rcov since it already migrated to simplecov [#1118]
|
|
169
|
+
* Add spec for #1149 `TypeError: can't cast Java::JavaSql::Timestamp` [#1152]
|
|
170
|
+
* Remove a duplicated specs [#1163]
|
|
171
|
+
* Specify `--require spec_helper` in .rspec [#1186]
|
|
172
|
+
* Add 'pry' and 'pry-nav' for JRuby debug [#973]
|
|
173
|
+
* Remove ruby-debug [#1196]
|
|
174
|
+
* Use Ubuntu Trusty at travis [#1095]
|
|
175
|
+
* Address travis.yml has multilpe language entries [#1109]
|
|
176
|
+
* Use docker-oracle-xe-11g for Travis CI [#1117]
|
|
177
|
+
* Modify `JRUBY_OPTS` for Travis CI [#1119]
|
|
178
|
+
* Add ruby-head and jruby-head to .travis.yml [#1127]
|
|
179
|
+
* Use JRuby 9.1.7.0 [#1138]
|
|
180
|
+
* Add JRuby 9.0.4.0 and allow JRuby 9.0.5.0 failures [#1146]
|
|
181
|
+
* Tiny fix for .travis.yml after migrating to docker-oracle-xe-11g [#1183]
|
|
182
|
+
* Templates updated to use Rails master branch for Rails 5.1 [#1133]
|
|
183
|
+
* Update running tests to include rails-dev-box [#1140]
|
|
184
|
+
|
|
185
|
+
* Known issues
|
|
186
|
+
* Legacy primary key support testing [#1207]
|
|
187
|
+
* PrimaryKeyIntegerNilDefaultTest failures [#1162]
|
|
188
|
+
* Skip `explain should explain query with bind` with JRuby [#1091]
|
|
189
|
+
|
|
190
|
+
## 1.7.10 / 2017-02-03
|
|
191
|
+
|
|
192
|
+
* Changes and bug fixes
|
|
193
|
+
* Address `TypeError: can't cast Java::JavaSql::Timestamp` [#1147, 1153]
|
|
194
|
+
* Use docker-oracle-xe-11g for Travis CI for release17 branch [#1150]
|
|
195
|
+
* Use JRuby 9.1.7.0 for release17 branch [#1154]
|
|
196
|
+
* Pending until further investigation made for #908 for release17 branch [#1151]
|
|
197
|
+
|
|
198
|
+
* Known issues
|
|
199
|
+
* No changes since 1.7.7
|
|
200
|
+
|
|
201
|
+
## 1.7.9 / 2016-12-26
|
|
202
|
+
|
|
203
|
+
* Changes and bug fixes
|
|
204
|
+
|
|
205
|
+
* Fix ORA-00933 error when executing `rails db:schema:load` [#1084]
|
|
206
|
+
* Quoting booleans should return a frozen string [#1083]
|
|
207
|
+
* CI against ruby 2.4.0 [#1096, #1086]
|
|
208
|
+
|
|
209
|
+
* Known issues
|
|
210
|
+
* No changes since 1.7.7
|
|
211
|
+
|
|
212
|
+
## 1.7.8 / 2016-12-06
|
|
213
|
+
|
|
214
|
+
* Changes and bug fixes
|
|
215
|
+
* Separate schema migration insert statements correctly [#1074]
|
|
216
|
+
* Add `use_old_oracle_visitor` example [#1068]
|
|
217
|
+
* `supports_fetch_first_n_rows_and_offset?` returns `false` when `use_old_oracle_visitor` is true {1070, #1075]
|
|
218
|
+
* Suppress `create_table(:posts, {:force=>true})` message [#1067, #1072]
|
|
219
|
+
* Enable rubocop and Code Climate [#1056, #1057, #1060, #1062, #1071]
|
|
220
|
+
* Bump MRI version for travis [#1054, #1059]
|
|
221
|
+
* Drop `ActiveRecord::InternalMetadata.table_name` after each spec [#1073]
|
|
222
|
+
|
|
223
|
+
* Known issues
|
|
224
|
+
* No changes since 1.7.7
|
|
225
|
+
|
|
1
226
|
## 1.7.7 / 2016-11-15
|
|
2
227
|
|
|
3
228
|
* Changes and bug fixes
|
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 5.1
|
|
14
|
+
|
|
15
|
+
Oracle enhanced adapter version 1.8 just supports Rails 5.1 and does not support Rails 5.0 or lower version of Rails.
|
|
16
|
+
When using Ruby on Rails version 5.1 then in Gemfile include
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
# Use oracle as the database for Active Record
|
|
20
|
+
gem 'activerecord-oracle_enhanced-adapter', '~> 1.8.0'
|
|
21
|
+
gem 'ruby-oci8' # only for CRuby users
|
|
22
|
+
```
|
|
23
|
+
|
|
13
24
|
### Rails 5.0
|
|
14
25
|
|
|
15
26
|
Oracle enhanced adapter version 1.7 just supports Rails 5.0 and does not support Rails 4.2 or lower version of Rails.
|
|
@@ -240,6 +251,9 @@ ActiveSupport.on_load(:active_record) do
|
|
|
240
251
|
# start primary key sequences from 1 (and not 10000) and take just one next value in each session
|
|
241
252
|
self.default_sequence_start_value = "1 NOCACHE INCREMENT BY 1"
|
|
242
253
|
|
|
254
|
+
# Use old visitor for Oracle 12c database
|
|
255
|
+
self.use_old_oracle_visitor = true
|
|
256
|
+
|
|
243
257
|
# other settings ...
|
|
244
258
|
end
|
|
245
259
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.8.0
|
|
@@ -1,11 +1,9 @@
|
|
|
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:
|
|
8
|
-
|
|
9
7
|
@virtual = virtual
|
|
10
8
|
@virtual_column_data_default = default.inspect if virtual
|
|
11
9
|
@returning_id = returning_id
|
|
@@ -18,7 +16,7 @@ module ActiveRecord
|
|
|
18
16
|
# Is column NCHAR or NVARCHAR2 (will need to use N'...' value quoting for these data types)?
|
|
19
17
|
# Define only when needed as adapter "quote" method will check at first if instance variable is defined.
|
|
20
18
|
if sql_type_metadata
|
|
21
|
-
@object_type = sql_type_metadata.sql_type.include?
|
|
19
|
+
@object_type = sql_type_metadata.sql_type.include? "."
|
|
22
20
|
end
|
|
23
21
|
# TODO: Need to investigate when `sql_type` becomes nil
|
|
24
22
|
end
|
|
@@ -63,75 +61,21 @@ module ActiveRecord
|
|
|
63
61
|
super
|
|
64
62
|
end
|
|
65
63
|
|
|
66
|
-
# Get column comment from schema definition.
|
|
67
|
-
# Will work only if using default ActiveRecord connection.
|
|
68
|
-
# def comment
|
|
69
|
-
# #TODO: may be deprecated due to conflict with variable
|
|
70
|
-
# ActiveRecord::Base.connection.column_comment(@table_name, name)
|
|
71
|
-
# end
|
|
72
|
-
|
|
73
64
|
private
|
|
74
65
|
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
def self.extract_value_from_default(default)
|
|
67
|
+
case default
|
|
77
68
|
when String
|
|
78
69
|
default.gsub(/''/, "'")
|
|
79
|
-
|
|
70
|
+
else
|
|
80
71
|
default
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def guess_date_or_time(value)
|
|
85
|
-
value.respond_to?(:hour) && (value.hour == 0 and value.min == 0 and value.sec == 0) ?
|
|
86
|
-
Date.new(value.year, value.month, value.day) : value
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
class << self
|
|
90
|
-
protected
|
|
91
|
-
|
|
92
|
-
def fallback_string_to_date(string) #:nodoc:
|
|
93
|
-
if OracleEnhancedAdapter.string_to_date_format || OracleEnhancedAdapter.string_to_time_format
|
|
94
|
-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
95
|
-
`fallback_string_to_date` has been deprecated.
|
|
96
|
-
It will be removed from next version of Oracle enhanced adapter.
|
|
97
|
-
Users are unlikely to see this message since this method has gone
|
|
98
|
-
from ActiveRecord::ConnectionAdapters::Column in Rails 4.2.
|
|
99
|
-
MSG
|
|
100
|
-
return (string_to_date_or_time_using_format(string).to_date rescue super)
|
|
101
72
|
end
|
|
102
|
-
super
|
|
103
73
|
end
|
|
104
74
|
|
|
105
|
-
def
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
`fallback_string_to_time` has been deprecated.
|
|
109
|
-
It will be removed from next version of Oracle enhanced adapter.
|
|
110
|
-
Users are unlikely to see this message since this method has gone
|
|
111
|
-
from ActiveRecord::ConnectionAdapters::Column in Rails 4.2.
|
|
112
|
-
MSG
|
|
113
|
-
return (string_to_date_or_time_using_format(string).to_time rescue super)
|
|
114
|
-
end
|
|
115
|
-
super
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def string_to_date_or_time_using_format(string) #:nodoc:
|
|
119
|
-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
|
120
|
-
`string_to_date_or_time_using_format` has been deprecated.
|
|
121
|
-
It will be removed from next version of Oracle enhanced adapter.
|
|
122
|
-
Users are unlikely to see this message since `fallback_string_to_date`
|
|
123
|
-
and `fallback_string_to_time` have gone
|
|
124
|
-
from ActiveRecord::ConnectionAdapters::Column in Rails 4.2.
|
|
125
|
-
MSG
|
|
126
|
-
if OracleEnhancedAdapter.string_to_time_format && dt=Date._strptime(string, OracleEnhancedAdapter.string_to_time_format)
|
|
127
|
-
return Time.parse("#{dt[:year]}-#{dt[:mon]}-#{dt[:mday]} #{dt[:hour]}:#{dt[:min]}:#{dt[:sec]}#{dt[:zone]}")
|
|
128
|
-
end
|
|
129
|
-
DateTime.strptime(string, OracleEnhancedAdapter.string_to_date_format).to_date
|
|
75
|
+
def guess_date_or_time(value)
|
|
76
|
+
value.respond_to?(:hour) && ((value.hour == 0) && (value.min == 0) && (value.sec == 0)) ?
|
|
77
|
+
Date.new(value.year, value.month, value.day) : value
|
|
130
78
|
end
|
|
131
|
-
|
|
132
|
-
end
|
|
133
79
|
end
|
|
134
|
-
|
|
135
80
|
end
|
|
136
|
-
|
|
137
81
|
end
|
|
@@ -2,68 +2,22 @@ module ActiveRecord #:nodoc:
|
|
|
2
2
|
module ConnectionAdapters #:nodoc:
|
|
3
3
|
module OracleEnhanced #:nodoc:
|
|
4
4
|
module ColumnDumper #:nodoc:
|
|
5
|
-
|
|
6
|
-
def column_spec(column)
|
|
7
|
-
spec = Hash[prepare_column_options(column).map { |k, v| [k, "#{k}: #{v}"] }]
|
|
8
|
-
spec[:name] = column.name.inspect
|
|
9
|
-
if column.virtual?
|
|
10
|
-
spec[:type] = "virtual"
|
|
11
|
-
else
|
|
12
|
-
spec[:type] = schema_type(column).to_s
|
|
13
|
-
end
|
|
14
|
-
spec
|
|
15
|
-
end
|
|
16
|
-
|
|
17
5
|
def prepare_column_options(column)
|
|
18
|
-
spec =
|
|
19
|
-
|
|
20
|
-
if limit = schema_limit(column)
|
|
21
|
-
spec[:limit] = limit
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
if precision = schema_precision(column)
|
|
25
|
-
spec[:precision] = precision
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
if scale = schema_scale(column)
|
|
29
|
-
spec[:scale] = scale
|
|
30
|
-
end
|
|
6
|
+
spec = super
|
|
31
7
|
|
|
32
|
-
if
|
|
33
|
-
spec[:as] =
|
|
8
|
+
if supports_virtual_columns? && column.virtual?
|
|
9
|
+
spec[:as] = column.virtual_column_data_default
|
|
10
|
+
spec = { type: schema_type(column).inspect }.merge!(spec) unless column.type == :decimal
|
|
34
11
|
end
|
|
35
12
|
|
|
36
|
-
if virtual_type = schema_virtual_type(column)
|
|
37
|
-
spec[:virtual_type] = virtual_type
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
default = schema_default(column) if column.has_default?
|
|
41
|
-
spec[:default] = default unless default.nil?
|
|
42
|
-
|
|
43
|
-
spec[:null] = 'false' unless column.null
|
|
44
|
-
|
|
45
|
-
spec[:comment] = column.comment.inspect if column.comment.present?
|
|
46
|
-
|
|
47
13
|
spec
|
|
48
14
|
end
|
|
49
15
|
|
|
50
|
-
def migration_keys
|
|
51
|
-
# TODO `& column_specs.map(&:keys).flatten` should be exetuted here
|
|
52
|
-
[:name, :limit, :precision, :scale, :default, :null, :as, :virtual_type, :comment]
|
|
53
|
-
end
|
|
54
|
-
|
|
55
16
|
private
|
|
56
17
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def schema_virtual_type(column)
|
|
62
|
-
unless column.type == :decimal
|
|
63
|
-
column.type.inspect if column.virtual?
|
|
18
|
+
def default_primary_key?(column)
|
|
19
|
+
schema_type(column) == :integer
|
|
64
20
|
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
21
|
end
|
|
68
22
|
end
|
|
69
23
|
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
|
|
@@ -30,8 +29,8 @@ module ActiveRecord
|
|
|
30
29
|
# Used always by JDBC connection as well by OCI connection when describing tables over database link
|
|
31
30
|
def describe(name)
|
|
32
31
|
name = name.to_s
|
|
33
|
-
if name.include?(
|
|
34
|
-
name, db_link = name.split(
|
|
32
|
+
if name.include?("@")
|
|
33
|
+
name, db_link = name.split("@")
|
|
35
34
|
default_owner = select_value("SELECT username FROM all_db_links WHERE db_link = '#{db_link.upcase}'")
|
|
36
35
|
db_link = "@#{db_link}"
|
|
37
36
|
else
|
|
@@ -39,8 +38,8 @@ module ActiveRecord
|
|
|
39
38
|
default_owner = @owner
|
|
40
39
|
end
|
|
41
40
|
real_name = ActiveRecord::ConnectionAdapters::OracleEnhanced::Quoting.valid_table_name?(name) ? name.upcase : name
|
|
42
|
-
if real_name.include?(
|
|
43
|
-
table_owner, table_name = real_name.split(
|
|
41
|
+
if real_name.include?(".")
|
|
42
|
+
table_owner, table_name = real_name.split(".")
|
|
44
43
|
else
|
|
45
44
|
table_owner, table_name = default_owner, real_name
|
|
46
45
|
end
|
|
@@ -66,11 +65,11 @@ module ActiveRecord
|
|
|
66
65
|
AND synonym_name = '#{real_name}'
|
|
67
66
|
SQL
|
|
68
67
|
if result = select_one(sql)
|
|
69
|
-
case result[
|
|
70
|
-
when
|
|
68
|
+
case result["name_type"]
|
|
69
|
+
when "SYNONYM"
|
|
71
70
|
describe("#{result['owner'] && "#{result['owner']}."}#{result['table_name']}#{db_link}")
|
|
72
71
|
else
|
|
73
|
-
db_link ? [result[
|
|
72
|
+
db_link ? [result["owner"], result["table_name"], db_link] : [result["owner"], result["table_name"]]
|
|
74
73
|
end
|
|
75
74
|
else
|
|
76
75
|
raise OracleEnhancedConnectionException, %Q{"DESC #{name}" failed; does it exist?}
|
|
@@ -97,28 +96,26 @@ 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
|
|
|
114
111
|
# if MRI or YARV
|
|
115
|
-
if !defined?(RUBY_ENGINE) || RUBY_ENGINE ==
|
|
112
|
+
if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
|
|
116
113
|
ORACLE_ENHANCED_CONNECTION = :oci
|
|
117
|
-
require
|
|
114
|
+
require "active_record/connection_adapters/oracle_enhanced/oci_connection"
|
|
118
115
|
# if JRuby
|
|
119
|
-
elsif RUBY_ENGINE ==
|
|
116
|
+
elsif RUBY_ENGINE == "jruby"
|
|
120
117
|
ORACLE_ENHANCED_CONNECTION = :jdbc
|
|
121
|
-
require
|
|
118
|
+
require "active_record/connection_adapters/oracle_enhanced/jdbc_connection"
|
|
122
119
|
else
|
|
123
120
|
raise "Unsupported Ruby engine #{RUBY_ENGINE}"
|
|
124
121
|
end
|