activerecord-oracle_enhanced-adapter 1.6.9 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -11
  3. data/History.md +267 -11
  4. data/README.md +57 -15
  5. data/RUNNING_TESTS.md +1 -1
  6. data/Rakefile +1 -16
  7. data/VERSION +1 -1
  8. data/activerecord-oracle_enhanced-adapter.gemspec +15 -52
  9. data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +8 -22
  10. data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +53 -45
  11. data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +6 -1
  12. data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +28 -61
  13. data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +46 -56
  14. data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +36 -0
  15. data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +39 -26
  16. data/lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb +36 -0
  17. data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +2 -2
  18. data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +177 -0
  19. data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +17 -8
  20. data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +17 -20
  21. data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +162 -178
  22. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +42 -94
  23. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +50 -54
  24. data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +15 -11
  25. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +238 -322
  26. data/lib/active_record/oracle_enhanced/type/integer.rb +3 -2
  27. data/lib/active_record/oracle_enhanced/type/national_character_string.rb +25 -0
  28. data/lib/active_record/oracle_enhanced/type/raw.rb +14 -2
  29. data/lib/active_record/oracle_enhanced/type/string.rb +28 -0
  30. data/lib/active_record/oracle_enhanced/type/text.rb +32 -0
  31. data/lib/activerecord-oracle_enhanced-adapter.rb +12 -17
  32. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +116 -135
  33. data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +54 -60
  34. data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +40 -41
  35. data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +6 -6
  36. data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +218 -353
  37. data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +7 -7
  38. data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +10 -10
  39. data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +22 -22
  40. data/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb +2 -2
  41. data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +36 -37
  42. data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +85 -63
  43. data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +189 -335
  44. data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +51 -60
  45. data/spec/spec_helper.rb +0 -6
  46. metadata +38 -153
  47. data/.travis/oracle/download.sh +0 -14
  48. data/.travis/oracle/install.sh +0 -31
  49. data/.travis/setup_accounts.sh +0 -9
  50. data/.travis.yml +0 -39
  51. data/lib/active_record/connection_adapters/oracle_enhanced/dirty.rb +0 -40
  52. data/lib/active_record/oracle_enhanced/type/timestamp.rb +0 -11
  53. data/spec/spec_config.yaml.template +0 -11
  54. data/spec/support/alter_system_user_password.sql +0 -2
  55. data/spec/support/create_oracle_enhanced_users.sql +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3bf47194eb3711fcdc5cc04ea0c11ca3afe5ba8
4
- data.tar.gz: cb7f41143131f866bf881a9fbc19d76785ff5c75
3
+ metadata.gz: 90fa8b1a7acfc65a87b37c9d9e6fab35b7a6fe35
4
+ data.tar.gz: 3d1fe46c3644b1a5ac00bc7c212df6e7e55fa1fb
5
5
  SHA512:
6
- metadata.gz: 976de1d723fa15c16a103e6ea6c9961f1600a04f1e08f4817e804b1a05dca1aec5d1759a5a1a42c938061118caf1bd2f1b40f0b0328763b052631ff765e92e50
7
- data.tar.gz: 01fa3f9969c749aa645571e219a5069c333d05afc39d138733ef723846da8ef8b0dfffef699cc3385c8df4a7233fff83bc551c08fead510aab683560a92166cd
6
+ metadata.gz: 04809974b2b2258aff6483828ae2d4c5db9d2b7ff7f6c5290c8d0c6f50b63d59b391c66efbe47bb3f911c0083fb16707c10479ddd4a3c1e7c9a00a5f8366cd04
7
+ data.tar.gz: 2fb86439af72485537fa6e6545eedffd2716e77f3ee640a5e207a1ff935add1f650c94a71e6b0ef0e50b7922b69d07dd4c92c222a42b028e6eacc9255800c3aa
data/Gemfile CHANGED
@@ -1,23 +1,22 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  group :development do
4
- gem 'jeweler', '~> 2.0'
5
- gem 'rspec'
4
+ gem 'rspec', '~> 3.3'
6
5
  gem 'rdoc'
6
+ gem 'rake'
7
7
 
8
- gem 'activerecord', github: 'rails/rails', branch: '4-2-stable'
9
- gem 'activemodel', github: 'rails/rails', branch: '4-2-stable'
10
- gem 'activesupport', github: 'rails/rails', branch: '4-2-stable'
11
- gem 'actionpack', github: 'rails/rails', branch: '4-2-stable'
12
- gem 'railties', github: 'rails/rails', branch: '4-2-stable'
8
+ gem 'activerecord', github: 'rails/rails', branch: '5-0-stable'
9
+ gem 'rack', github: 'rack/rack', branch: 'master'
10
+ gem 'arel', github: 'rails/arel', branch: 'master'
13
11
 
14
- gem 'arel', github: 'rails/arel', branch: '6-0-stable'
15
- gem 'journey', github: 'rails/journey'
16
-
17
- gem 'activerecord-deprecated_finders'
18
12
  gem 'ruby-plsql', '>=0.5.0'
19
13
 
20
14
  platforms :ruby do
21
15
  gem 'ruby-oci8', github: 'kubo/ruby-oci8'
16
+ gem 'byebug'
17
+ end
18
+
19
+ platforms :jruby do
20
+ gem 'ruby-debug'
22
21
  end
23
22
  end
data/History.md CHANGED
@@ -1,19 +1,275 @@
1
- ## 1.6.9 / 2017-03-29
1
+ ## 1.7.0 / 2016-08-04
2
2
 
3
- * Changes and bug fixes since 1.6.8
4
- * Fix the BINARY_FLOAT column type returns nil in JRuby [#1257]
3
+ * Changes and bug fixes
4
+ * No changes since 1.7.0.rc1
5
5
 
6
- ## 1.6.8 / 2017-03-18
6
+ * Known issues
7
+ * No changes since 1.7.0.rc1
7
8
 
8
- * Changes and bug fixes since 1.6.7
9
- * Better fix to support "Relation#count does not support finder options anymore in Rails [#787, #788]
9
+ ## 1.7.0.rc1 / 2016-08-02
10
+
11
+ * Changes and bug fixes
12
+
13
+ * Support `emulate_booleans_from_strings` in Rails 5 [#953, #942]
14
+ * Deprecate `self.is_boolean_column?` [#949]
15
+ * Deprecate `self.is_date_column?` and `is_date_column?` [#950]
16
+ * Deprecate `set_type_for_columns`, `set_type_for_columns` and `clear_types_for_columns` [#951]
17
+ * Deprecate `self.is_integer_column?` [#952]
18
+
19
+ * Known issues
20
+
21
+ - Only with JRuby
22
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
23
+ * Workaround: execute explain without bind or use CRuby
24
+ - CRuby and JRuby
25
+ * Rails 5 : custom methods for create record when exception is raised in after_create callback fails [#944]
26
+ * Rails 5 : specs need update to emulate_booleans_from_strings [#942]
27
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
28
+ * #848 reproduces when database version is 11gR2 or older, it does not reproduce with 12c
29
+ * One of the units test skipped when database version is 11gR2 or lower. [#946]
30
+
31
+ ## 1.7.0.beta7 / 2016-08-01
32
+
33
+ * Changes and bug fixes
34
+
35
+ * Use OracleEnhanced::SchemaDumper#tables and #table
36
+ only if they have Oracle enhanced specific features [#947, #797]
37
+
38
+ * Known issues
39
+
40
+ - Only with JRuby
41
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
42
+ - CRuby and JRuby
43
+ * Rails 5 : custom methods for create record when exception is raised in after_create callback fails [#944]
44
+ * Rails 5 : emulate_booleans_from_strings support [#942]
45
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
46
+ * #848 reproduces when database version is 11gR2 or older, it does not reproduce with 12c
47
+ * One of the units test skipped when database version is 11gR2 or lower. [#946]
48
+
49
+ ## 1.7.0.beta6 / 2016-07-29
50
+
51
+ * Changes and bug fixes
52
+
53
+ * Use attributes.keys to update all attributes when partial_write is disabled [#906 #943]
54
+
55
+ * Known issues
56
+
57
+ - Only with JRuby
58
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
59
+ - CRuby and JRuby
60
+ * Rails 5 : custom methods for create record when exception is raised in after_create callback fails [#944]
61
+ * Rails 5 : emulate_booleans_from_strings support [#942]
62
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
63
+ * #848 reproduces when database version is 11gR2 or older, it does not reproduce with 12c
64
+
65
+ ## 1.7.0.beta5 / 2016-07-28
66
+
67
+ * Changes and bug fixes
68
+
69
+ * Use binds.size to set returning_id_index for returning_id [#907, #912 and #939]
70
+
71
+ * Known issues
72
+
73
+ - Only with JRuby
74
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
75
+ - CRuby and JRuby
76
+ * Rails 5 : custom methods for create, update and destroy not working [#906]
77
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
78
+ * #848 reproduces when database version is 11gR2 or older, it does not reproduce with 12c
79
+
80
+ ## 1.7.0.beta4 / 2016-07-27
81
+
82
+ * Changes and bug fixes
83
+
84
+ * Call `bind_returning_param` when sql has returning_id and using JRuby [#937]
85
+ * Remove unused `col_type` to avoid warnings [#934]
86
+ * Remove TODO comment since Oracle DATE type can be mapped Rails Datetime with attribute API [#935]
87
+ * Remove rspec from runtime dependency [#933]
88
+ * Rename `add_dependency` to `add_runtime_dependency` [#933]
89
+ * Remove warnings for + when tested with JRuby 9.1.2 [#936]
90
+
91
+ * Known issues
92
+
93
+ - Only with JRuby
94
+ * Rails 5 : create table with primary key trigger with default primary key not returning id [#912]
95
+ * #937 addresses two failures reported in #912
96
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
97
+ - CRuby and JRuby
98
+ * Rails 5 : create table with primary key trigger not returning id [#907]
99
+ * Rails 5 : custom methods for create, update and destroy not working [#906]
100
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
101
+
102
+ ## 1.7.0.beta3 / 2016-07-22
103
+
104
+ * Changes and bug fixes
105
+ * Not giving `bind_param` a 3rd argument `column` [#929, #909]
106
+
107
+ * Known issues
108
+
109
+ - Only with JRuby
110
+ * Rails 5 : create table with primary key trigger with default primary key not returning id [#912]
111
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
112
+ - CRuby and JRuby
113
+ * Rails 5 : create table with primary key trigger not returning id [#907]
114
+ * Rails 5 : custom methods for create, update and destroy not working [#906]
115
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
116
+
117
+ ## 1.7.0.beta2 / 2016-07-22
118
+
119
+ * Changes and bug fixes
120
+
121
+ * Support CLOB for JRuby [#926, #910, #911]
122
+ * Arel 7.1.0 or higher version is required [#919]
123
+ * Document usage of ActiveRecord Attributes API in 1.7 [#924]
124
+ * Add a note about usage pecularities of context_index's index_column option to README [#924]
125
+ * Set required_ruby_version = '>= 2.2.2' [#916]
126
+ * Remove ActiveRecord::ConnectionAdapters::TableDefinition#aliased_types [#921]
127
+ * Update warning message for composite primary keys [#923]
128
+ * Remove specs deprecated in Oracle enhanced adapter 1.7 [#917]
129
+ * Rails 5 : has_and_belongs_to_many test gets ORA-01400 since primary key column "ID"
130
+ not included in insert statement [#856, rails/rails#25388, rails/rails#25578 ]
131
+ - This fix will be included in the next version of Rails which should be named 5.0.1
132
+
133
+ * Known issues
134
+
135
+ - Only with JRuby
136
+ * Rails 5 : create table with primary key trigger with default primary key not returning id [#912]
137
+ * Rails 5 : SQL with bind parameters when NLS_NUMERIC_CHARACTERS is set to ', '
138
+ show Java::JavaSql::SQLSyntaxErrorException: / ORA-01722: invalid number [#909]
139
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
140
+ - CRuby and JRuby
141
+ * Rails 5 : create table with primary key trigger not returning id [#907]
142
+ * Rails 5 : custom methods for create, update and destroy not working [#906]
143
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
144
+
145
+ ## 1.7.0.beta1 / 2016-07-18
146
+
147
+ * Major enhancements
148
+
149
+ * Support Rails 5.0
150
+ * Use Arel::Visitors::Oracle12 to use better top-N query support [#671]
151
+ * Oracle TIMESTAMP sql type is associated with Rails `DateTime` type [#845]
152
+ * Rails :time as Oracle TIMESTAMP to support subsecond precision [#817, #816]
153
+ * Rails :datetime as Oracle TIMESTAMP to support subsecond precision [#739]
154
+ * Remove ActiveRecord::OracleEnhanced::Type::Timestamp [#815]
155
+ * Deprecate `quote_date_with_to_date` and `quote_timestamp_with_to_timestamp` [#879]
156
+ * Deprecate `set_boolean_columns` and `set_string_columns` [#874]
157
+ * Deprecate `set_integer_columns [#872]
158
+ * Deprecate `set_date_columns` and `set_datetime_columns` [#869]
159
+ * Deprecate `ignore_table_columns` to use Rails native `ignored_columns` [#855]
160
+ * Set :datetime for an attribute explicitly [#875, #876]
161
+ * Support `#views` #738
162
+ * Replace `table_exists?` with `data_source_exists?` [#842]
163
+ * Introduce `data_source_exists?` to return tables and views [#841]
164
+ * Implement primary_keys to prepare dumping composite primary key [#860]
165
+ * Support for any type primary key [#836]
166
+ * Dump composite primary keys [#863]
167
+ * Dump type and options for non default primary keys [#861]
168
+ * Support creating foreign keys in create table [#862]
169
+ * Support ActiveRecord native comment feature [#822, #821, #819]
170
+
171
+ * Changes and bug fixes
172
+
173
+ * Fix cast_type issue [#795]
174
+ * Rename quote_value to quote_default_expression [#661]
175
+ * Change bind parameters order to come offset first then limit next [#831]
176
+ * type_cast arity change [#781]
177
+ * Initial support for sql_type_metadata [#656]
178
+ * Support bind_params for JDBC connections [#806]
179
+ * Use all_* dictionary replacing user_* ones [#713]
180
+ * Register `NUMBER(1)` sql_type to `Type::Boolean` [#844]
181
+ * Add `ActiveRecord::ValueTooLong` exception class [#827]
182
+ * Not passing `native_database_types` to `TableDefinition` [#747]
183
+ * Ignore index name in `index_exists?` when not passed a name to check for [#840]
184
+ * Add reversible syntax for change_column_default [#839]
185
+ * Support Oracle national character set NCHAR, NVARCHAR2 [#886]
186
+ * Support "limited" :returning_id [#894, #803]
187
+ * Support RAW sql data type in Rails 5 [#877]
188
+ * Remove `serialized_attributes` which is removed in Rails 5 [#694]
189
+ * Add deprecation warning for `bind_param` [#809]
190
+ * Remove `self.string_to_raw` from Column which is not called anymore [#813]
191
+ * Remove type_cast from Column [#811]
192
+ * Remove deprecated `distinct` method [#771]
193
+ * Remove alias_method_chain and rename oracle_enhanced_table to table [#864]
194
+ * Warn if `AR.primary_key` is called for a table with composite primary key [#837]
195
+ * Remove select method from Oracle enhanced adapter [#784]
196
+ * Remove version check to see if ::Rails::Railtie exists [#769]
197
+ * Remove FALSE_VALUES [#716]
198
+ * Remove TRUE_VALUES from OracleEnhancedColumn [#646]
199
+ * Remove insert_sql method [#866, #890]
200
+ * Rails5 remove require bind visitor [#853]
201
+ * substitute_at has been removed from Rails [#849]
202
+ * Serialize value for lob columns [#878]
203
+ * Do not cache prepared statements that are unlikely to have cache hits [#748]
204
+ * Handle BLOB type correctly [#804]
205
+ * Move ActiveRecord::Type to ActiveModel [#723]
206
+ * Remove cast_type to support Rails 5 Attribute API [#867]
207
+ * Handle ActiveModel::Type::Binary::Data type cast in _type_cast [#826]
208
+ * Use Abstract adapter `dump_schema_information` implementation [#857]
209
+ * Use ActiveRecord initialize_schema_migrations_table [#843]
210
+ * Use ActiveRecord::SchemaDumper#ignored? [#838]
211
+ * Use Abstract adapter join_to_update [#801, #800]
212
+ * Use ActiveRecord::OracleEnhanced::Type::Text [#887]
213
+ * Use ActiveRecord::OracleEnhanced::Type::String [#883]
214
+ * Use OracleEnhanced::ColumnDefinition [#650]
215
+ * Move to ActiveRecord::ConnectionAdapters::OracleEnhanced::SchemaDumper [#695]
216
+ * ColumnDumper uses Module#prepend [#696]
217
+ * Migrate from OracleEnhancedSchemaStatementExt to OracleEnhanced::SchemaStatementsExt [#768]
218
+ * Extract ActiveRecord::ConnectionAdapters::OracleEnhanced::Quoting [#764]
219
+ * Use keyword arguments for new table options [#820]
220
+ * Move `ruby_to_java_value` logic to `_type_cast` [#904]
221
+ * OracleEnhancedColumn.new needs sql_type_metadata including sql_type [#858]
222
+ * OracleEnhanced::JDBCQuoting and OCIQuoting [#897]
223
+ * Address `add_column_options!': undefined method `quote_value' [#647]
224
+ * Remove dirty tracking methods [#883]
225
+ * Use arel master branch for rails5 development [#645]
226
+ * Bump ruby-oci8 version to 2.2.0 or higher [#775]
227
+ * Remove jeweler dependency [#766]
228
+ * Remove required_rubygems_version [#719]
229
+ * Remove journey which is already part of Rails [#701]
230
+ * Remove dependencies with non activerecord gems [#700]
231
+ * Remove activerecord-deprecated_finders [#698]
232
+ * Use rack master branch [#697]
233
+ * Clean up gemspec file and bump rspec, ruby-plsql and ruby-oci8 versions [#717]
234
+ * Remove magic comment for utf-8 [#772, #726]
235
+ * add_dependency with ruby-oci8 only if it runs cruby, not jruby [#902]
236
+ * Install ruby-debug for jruby [#899]
237
+ * Address dirty object tracking should not mark empty text as changed [#888]
238
+ * Revert "Update matcher to skip sql statements to get `table` metadata" [#881]
239
+ * No need to set @visitor instance variable here [#854]
240
+ * log binds should not be type_casted [#818]
241
+ * Fix schema dumper errors [#810]
242
+ * Address undefined method `cast_type' [#805]
243
+ * Better fix to support "Relation#count does not support finder options anymore in Rails [#788, #787]
244
+ * ActiveRecord::Calculations#count no longer accepts an options hash argument #754
245
+ * Supress WARNINGs using `raise_error` without specific errors [#724]
246
+ * Use RSpec 3 [#707]
247
+ * Update "OracleEnhancedAdapter boolean type detection based on string column types and names" [#873]
248
+ * Update "OracleEnhancedAdapter integer type detection based on column names" [#871]
249
+ * Update "OracleEnhancedAdapter date type detection based on column names" [#868]
250
+ * Do not set emulate_dates_by_column_name or emulate_dates in specs [#870]
251
+ * Update rake spec message to show default branch name as master [#648]
252
+ * Remove `ActiveRecord::Base.default_timezone = :local` from spec_helper [#901]
253
+ * Update to rspec3 syntax to avoid deprecation notices [#776]
254
+ * Remove RAILS_GEM_VERSION [#702]
10
255
  * Run Oracle enhanced adapter unit tests using Travis CI [#789]
11
256
  * Upgrade travis-oracle to Version 2.0.1 [#903]
12
- * NoMethodError: undefined method `write' for nil:NilClass for serialized column [#798, #1004]
13
- * Support connection strings in `DATABASE_URL` [#1036]
14
- * Rebuild primary key index to default_tablespaces[:index] [#1037]
15
- * Use docker oracle xe 11g for release16 branch [#1238]
16
- * Fix deprecated warnings in Ruby 2.4.0+ [#1237]
257
+
258
+ * Known issues
259
+
260
+ - Only with JRuby
261
+ * Rails 5 : create table with primary key trigger with default primary key not returning id [#912]
262
+ * Rails 5 : dirty object tracking not working correctly for CLOB [#911]
263
+ * Rails 5 : handling of CLOB columns get failures [#910]
264
+ * Rails 5 : SQL with bind parameters when NLS_NUMERIC_CHARACTERS is set to ', '
265
+ show Java::JavaSql::SQLSyntaxErrorException: / ORA-01722: invalid number [#909]
266
+ * Rails 5 : explain should explain query with binds got Java::JavaSql::SQLException: Invalid column index [#908]
267
+ - CRuby and JRuby
268
+ * Rails 5 : create table with primary key trigger not returning id [#907]
269
+ * Rails 5 : custom methods for create, update and destroy not working [#906]
270
+ * Rails 5 : has_and_belongs_to_many test gets ORA-01400 since primary key column "ID"
271
+ not included in insert statement [#856, rails/rails#25388]
272
+ * Rails 5 : undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> [#848, rails/arel#438]
17
273
 
18
274
  ## 1.6.7 / 2016-03-08
19
275
 
data/README.md CHANGED
@@ -1,5 +1,3 @@
1
- [![Build Status](https://travis-ci.org/rsim/oracle-enhanced.svg?branch=master)](https://travis-ci.org/rsim/oracle-enhanced)
2
-
3
1
  activerecord-oracle_enhanced-adapter
4
2
  ====================================
5
3
 
@@ -8,10 +6,20 @@ Oracle enhanced adapter for ActiveRecord
8
6
  DESCRIPTION
9
7
  -----------
10
8
 
11
- Oracle enhanced ActiveRecord adapter provides Oracle database access from Ruby on Rails applications. Oracle enhanced adapter can be used from Ruby on Rails versions between 2.3.x and 4.0 and it is working with Oracle database versions from 10g to 12c.
9
+ Oracle enhanced ActiveRecord adapter provides Oracle database access from Ruby on Rails applications. Oracle enhanced adapter can be used from Ruby on Rails versions between 2.3.x and 5.0 and it is working with Oracle database versions from 10g to 12c.
12
10
 
13
11
  INSTALLATION
14
12
  ------------
13
+ ### Rails 5.0
14
+
15
+ Oracle enhanced adapter version 1.7 just supports Rails 5.0 and does not support Rails 4.2 or lower version of Rails.
16
+ When using Ruby on Rails version 5.0 then in Gemfile include
17
+
18
+ ```ruby
19
+ # Use oracle as the database for Active Record
20
+ gem 'activerecord-oracle_enhanced-adapter', '~> 1.7.0'
21
+ ```
22
+
15
23
  ### Rails 4.2
16
24
 
17
25
  Oracle enhanced adapter version 1.6 just supports Rails 4.2 and does not support Rails 4.1 or lower version of Rails.
@@ -191,12 +199,6 @@ environment variable, note that the adapter name uses a dash instead of an under
191
199
  DATABASE_URL=oracle-enhanced://localhost/XE
192
200
  ```
193
201
 
194
- You can also specify a connection string via the `DATABASE_URL`, as long as it doesn't have any whitespace:
195
-
196
- ```bash
197
- DATABASE_URL=oracle-enhanced://user:secret@connection-string/(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=xe)))
198
- ```
199
-
200
202
  If you deploy JRuby on Rails application in Java application server that supports JNDI connections then you can specify JNDI connection as well:
201
203
 
202
204
  ```yml
@@ -255,14 +257,17 @@ class Employee < ActiveRecord::Base
255
257
  # specify sequence name
256
258
  self.sequence_name = "hr.hr_employee_s"
257
259
 
258
- # set which DATE columns should be converted to Ruby Date
259
- set_date_columns :hired_on, :birth_date_on
260
+ # set which DATE columns should be converted to Ruby Date using ActiveRecord Attribute API
261
+ # Starting from Oracle enhanced adapter 1.7 Oracle `DATE` columns are mapped to Ruby `Date` by default.
262
+ attribute :hired_on, :date
263
+ attribute :birth_date_on, :date
260
264
 
261
- # set which DATE columns should be converted to Ruby Time
262
- set_datetime_columns :last_login_time
265
+ # set which DATE columns should be converted to Ruby Time using ActiveRecord Attribute API
266
+ attribute :last_login_time, :datetime
263
267
 
264
- # set which VARCHAR2 columns should be converted to true and false
265
- set_boolean_columns :manager, :active
268
+ # set which VARCHAR2 columns should be converted to true and false using ActiveRecord Attribute API
269
+ attribute :manager, :boolean
270
+ attribute :active, :boolean
266
271
 
267
272
  # set which columns should be ignored in ActiveRecord
268
273
  ignore_table_columns :attribute1, :attribute2
@@ -275,6 +280,35 @@ You can also access remote tables over database link using
275
280
  self.table_name "hr_employees@db_link"
276
281
  ```
277
282
 
283
+ Examples for Rails 4.x
284
+
285
+ ```ruby
286
+ class Employee < ActiveRecord::Base
287
+ # specify schema and table name
288
+ self.table_name = "hr.hr_employees"
289
+
290
+ # specify primary key name
291
+ self.primary_key = "employee_id"
292
+
293
+ # specify sequence name
294
+ self.sequence_name = "hr.hr_employee_s"
295
+
296
+ # If you're using Rails 4.2 or earlier you can do this
297
+
298
+ # set which DATE columns should be converted to Ruby Date
299
+ set_date_columns :hired_on, :birth_date_on
300
+
301
+ # set which DATE columns should be converted to Ruby Time
302
+ set_datetime_columns :last_login_time
303
+
304
+ # set which VARCHAR2 columns should be converted to true and false
305
+ set_boolean_columns :manager, :active
306
+
307
+ # set which columns should be ignored in ActiveRecord
308
+ ignore_table_columns :attribute1, :attribute2
309
+ end
310
+ ```
311
+
278
312
  Examples for Rails 3.2 and lower version of Rails
279
313
 
280
314
  ```ruby
@@ -426,6 +460,14 @@ Post.contains(:all_text, "aaa within title")
426
460
  Post.contains(:all_text, "bbb within comment_author")
427
461
  ```
428
462
 
463
+ Please note that `index_column` must be a real column in your database and it's value will be overriden every time your `index_column_trigger_on` columns are changed. So, _do not use columns with real data as `index_column`_.
464
+
465
+ Index column can be created as:
466
+
467
+ ```ruby
468
+ add_column :posts, :all_text, :string, limit: 2, comment: 'Service column for context search index'
469
+ ```
470
+
429
471
  ### Oracle virtual columns support
430
472
 
431
473
  Since version R11G1 Oracle database allows adding computed [Virtual Columns](http://www.oracle-base.com/articles/11g/virtual-columns-11gr1.php) to the table.
data/RUNNING_TESTS.md CHANGED
@@ -42,7 +42,7 @@ Running tests
42
42
  bundle install
43
43
 
44
44
  * Configure database credentials in one of two ways:
45
- * copy spec/spec_config.yaml.template to spec/spec_config.yaml and modify as needed
45
+ * copy spec/spec_config.yaml.template to spec/config.yaml and modify as needed
46
46
  * set required environment variables (see DATABASE_NAME in spec_helper.rb)
47
47
 
48
48
  * Run tests with
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
+ require 'bundler/gem_tasks'
3
4
  begin
4
5
  Bundler.setup(:default, :development)
5
6
  rescue Bundler::BundlerError => e
@@ -10,22 +11,6 @@ end
10
11
 
11
12
  require 'rake'
12
13
 
13
- require 'jeweler'
14
- Jeweler::Tasks.new do |gem|
15
- gem.name = "activerecord-oracle_enhanced-adapter"
16
- gem.summary = "Oracle enhanced adapter for ActiveRecord"
17
- gem.description = <<-EOS
18
- Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
19
- This adapter is superset of original ActiveRecord Oracle adapter.
20
- EOS
21
- gem.email = "raimonds.simanovskis@gmail.com"
22
- gem.homepage = "http://github.com/rsim/oracle-enhanced"
23
- gem.authors = ["Raimonds Simanovskis"]
24
- gem.extra_rdoc_files = ['README.md']
25
- gem.license = 'MIT'
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
-
29
14
  require 'rspec/core/rake_task'
30
15
  RSpec::Core::RakeTask.new(:spec)
31
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.9
1
+ 1.7.0
@@ -1,16 +1,12 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
1
  Gem::Specification.new do |s|
7
2
  s.name = %q{activerecord-oracle_enhanced-adapter}
8
- s.version = "1.6.9"
3
+ s.version = "1.7.0"
9
4
 
10
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.required_ruby_version = '>= 2.2.2'
11
7
  s.license = 'MIT'
12
8
  s.authors = [%q{Raimonds Simanovskis}]
13
- s.date = %q{2017-03-29}
9
+ s.date = %q{2016-08-04}
14
10
  s.description = %q{Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
15
11
  This adapter is superset of original ActiveRecord Oracle adapter.
16
12
  }
@@ -36,11 +32,13 @@ This adapter is superset of original ActiveRecord Oracle adapter.
36
32
  "lib/active_record/connection_adapters/oracle_enhanced/context_index.rb",
37
33
  "lib/active_record/connection_adapters/oracle_enhanced/cpk.rb",
38
34
  "lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb",
39
- "lib/active_record/connection_adapters/oracle_enhanced/dirty.rb",
40
35
  "lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb",
41
36
  "lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb",
37
+ "lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb",
42
38
  "lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb",
39
+ "lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb",
43
40
  "lib/active_record/connection_adapters/oracle_enhanced/procedures.rb",
41
+ "lib/active_record/connection_adapters/oracle_enhanced/quoting.rb",
44
42
  "lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb",
45
43
  "lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb",
46
44
  "lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb",
@@ -49,8 +47,10 @@ This adapter is superset of original ActiveRecord Oracle adapter.
49
47
  "lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb",
50
48
  "lib/active_record/connection_adapters/oracle_enhanced/version.rb",
51
49
  "lib/active_record/oracle_enhanced/type/integer.rb",
52
- "lib/active_record/oracle_enhanced/type/timestamp.rb",
50
+ "lib/active_record/oracle_enhanced/type/national_character_string.rb",
53
51
  "lib/active_record/oracle_enhanced/type/raw.rb",
52
+ "lib/active_record/oracle_enhanced/type/string.rb",
53
+ "lib/active_record/oracle_enhanced/type/text.rb",
54
54
  "lib/activerecord-oracle_enhanced-adapter.rb",
55
55
  "spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
56
56
  "spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
@@ -69,7 +69,6 @@ This adapter is superset of original ActiveRecord Oracle adapter.
69
69
  ]
70
70
  s.homepage = %q{http://github.com/rsim/oracle-enhanced}
71
71
  s.require_paths = [%q{lib}]
72
- s.rubygems_version = %q{1.8.6}
73
72
  s.summary = %q{Oracle enhanced adapter for ActiveRecord}
74
73
  s.test_files = [
75
74
  "spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
@@ -87,46 +86,10 @@ This adapter is superset of original ActiveRecord Oracle adapter.
87
86
  "spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb",
88
87
  "spec/spec_helper.rb"
89
88
  ]
90
-
91
- if s.respond_to? :specification_version then
92
- s.specification_version = 3
93
-
94
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
95
- s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
96
- s.add_development_dependency(%q<rspec>, ["~> 2.4"])
97
- s.add_development_dependency(%q<activerecord>, ["~> 4.2.1"])
98
- s.add_development_dependency(%q<activemodel>, [">= 0"])
99
- s.add_development_dependency(%q<activesupport>, [">= 0"])
100
- s.add_development_dependency(%q<actionpack>, [">= 0"])
101
- s.add_development_dependency(%q<railties>, [">= 0"])
102
- s.add_development_dependency(%q<arel>, [">= 0"])
103
- s.add_development_dependency(%q<journey>, [">= 0"])
104
- s.add_development_dependency(%q<ruby-plsql>, [">= 0.4.4"])
105
- s.add_development_dependency(%q<ruby-oci8>, [">= 2.0.4"])
106
- else
107
- s.add_dependency(%q<jeweler>, ["~> 2.0"])
108
- s.add_dependency(%q<rspec>, ["~> 2.4"])
109
- s.add_dependency(%q<activerecord>, ["~> 4.2.1"])
110
- s.add_dependency(%q<activemodel>, [">= 0"])
111
- s.add_dependency(%q<activesupport>, [">= 0"])
112
- s.add_dependency(%q<actionpack>, [">= 0"])
113
- s.add_dependency(%q<railties>, [">= 0"])
114
- s.add_dependency(%q<arel>, [">= 0"])
115
- s.add_dependency(%q<journey>, [">= 0"])
116
- s.add_dependency(%q<ruby-plsql>, [">= 0.4.4"])
117
- s.add_dependency(%q<ruby-oci8>, [">= 2.0.4"])
118
- end
119
- else
120
- s.add_dependency(%q<jeweler>, ["~> 2.0"])
121
- s.add_dependency(%q<rspec>, ["~> 2.4"])
122
- s.add_dependency(%q<activerecord>, ["~> 4.2.1"])
123
- s.add_dependency(%q<activemodel>, [">= 0"])
124
- s.add_dependency(%q<activesupport>, [">= 0"])
125
- s.add_dependency(%q<actionpack>, [">= 0"])
126
- s.add_dependency(%q<railties>, [">= 0"])
127
- s.add_dependency(%q<arel>, [">= 0"])
128
- s.add_dependency(%q<journey>, [">= 0"])
129
- s.add_dependency(%q<ruby-plsql>, [">= 0.4.4"])
130
- s.add_dependency(%q<ruby-oci8>, [">= 2.0.4"])
131
- end
89
+ s.add_runtime_dependency(%q<activerecord>, ["~> 5.0.0"])
90
+ s.add_runtime_dependency(%q<arel>, ["~> 7.1.0"])
91
+ s.add_runtime_dependency(%q<ruby-plsql>, [">= 0.5.0"])
92
+ s.add_runtime_dependency(%q<ruby-oci8>, [">= 2.2.0"]) if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby'
93
+ s.license = 'MIT'
132
94
  end
95
+
@@ -4,11 +4,8 @@ module ActiveRecord
4
4
 
5
5
  attr_reader :table_name, :nchar, :virtual_column_data_default, :returning_id #:nodoc:
6
6
 
7
- FALSE_VALUES << 'N'
8
- TRUE_VALUES << 'Y'
7
+ def initialize(name, default, sql_type_metadata = nil, null = true, table_name = nil, virtual = false, returning_id = nil, comment = nil) #:nodoc:
9
8
 
10
- def initialize(name, default, cast_type, sql_type = nil, null = true, table_name = nil, virtual=false, returning_id=false) #:nodoc:
11
- @table_name = table_name
12
9
  @virtual = virtual
13
10
  @virtual_column_data_default = default.inspect if virtual
14
11
  @returning_id = returning_id
@@ -17,22 +14,15 @@ module ActiveRecord
17
14
  else
18
15
  default_value = self.class.extract_value_from_default(default)
19
16
  end
20
- super(name, default_value, cast_type, sql_type, null)
17
+ super(name, default_value, sql_type_metadata, null, table_name, comment: comment)
21
18
  # Is column NCHAR or NVARCHAR2 (will need to use N'...' value quoting for these data types)?
22
19
  # Define only when needed as adapter "quote" method will check at first if instance variable is defined.
23
- if sql_type
24
- @nchar = true if cast_type.class == ActiveRecord::Type::String && sql_type[0,1] == 'N'
25
- @object_type = sql_type.include? '.'
20
+ if sql_type_metadata
21
+ @object_type = sql_type_metadata.sql_type.include? '.'
26
22
  end
27
23
  # TODO: Need to investigate when `sql_type` becomes nil
28
24
  end
29
25
 
30
- def type_cast(value) #:nodoc:
31
- return OracleEnhancedColumn::string_to_raw(value) if type == :raw
32
- return guess_date_or_time(value) if type == :datetime && OracleEnhancedAdapter.emulate_dates
33
- super
34
- end
35
-
36
26
  def virtual?
37
27
  @virtual
38
28
  end
@@ -73,16 +63,12 @@ module ActiveRecord
73
63
  super
74
64
  end
75
65
 
76
- # convert RAW column values back to byte strings.
77
- def self.string_to_raw(string) #:nodoc:
78
- string
79
- end
80
-
81
66
  # Get column comment from schema definition.
82
67
  # Will work only if using default ActiveRecord connection.
83
- def comment
84
- ActiveRecord::Base.connection.column_comment(@table_name, name)
85
- end
68
+ # def comment
69
+ # #TODO: may be deprecated due to conflict with variable
70
+ # ActiveRecord::Base.connection.column_comment(@table_name, name)
71
+ # end
86
72
 
87
73
  private
88
74