activerecord-oracle_enhanced-adapter-with-schema 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.rspec +2 -0
  2. data/Gemfile +52 -0
  3. data/History.md +301 -0
  4. data/License.txt +20 -0
  5. data/README.md +123 -0
  6. data/RUNNING_TESTS.md +45 -0
  7. data/Rakefile +59 -0
  8. data/VERSION +1 -0
  9. data/activerecord-oracle_enhanced-adapter-with-schema.gemspec +130 -0
  10. data/lib/active_record/connection_adapters/emulation/oracle_adapter.rb +5 -0
  11. data/lib/active_record/connection_adapters/oracle_enhanced.rake +105 -0
  12. data/lib/active_record/connection_adapters/oracle_enhanced_activerecord_patches.rb +41 -0
  13. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +1399 -0
  14. data/lib/active_record/connection_adapters/oracle_enhanced_base_ext.rb +121 -0
  15. data/lib/active_record/connection_adapters/oracle_enhanced_column.rb +146 -0
  16. data/lib/active_record/connection_adapters/oracle_enhanced_connection.rb +119 -0
  17. data/lib/active_record/connection_adapters/oracle_enhanced_context_index.rb +359 -0
  18. data/lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb +25 -0
  19. data/lib/active_record/connection_adapters/oracle_enhanced_cpk.rb +21 -0
  20. data/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb +46 -0
  21. data/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb +565 -0
  22. data/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb +494 -0
  23. data/lib/active_record/connection_adapters/oracle_enhanced_procedures.rb +260 -0
  24. data/lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb +227 -0
  25. data/lib/active_record/connection_adapters/oracle_enhanced_schema_dumper.rb +260 -0
  26. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb +428 -0
  27. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements_ext.rb +258 -0
  28. data/lib/active_record/connection_adapters/oracle_enhanced_structure_dump.rb +294 -0
  29. data/lib/active_record/connection_adapters/oracle_enhanced_tasks.rb +17 -0
  30. data/lib/active_record/connection_adapters/oracle_enhanced_version.rb +1 -0
  31. data/lib/activerecord-oracle_enhanced-adapter-with-schema.rb +25 -0
  32. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +778 -0
  33. data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +332 -0
  34. data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +427 -0
  35. data/spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb +19 -0
  36. data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +113 -0
  37. data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +1388 -0
  38. data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +69 -0
  39. data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +141 -0
  40. data/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb +25 -0
  41. data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +378 -0
  42. data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +440 -0
  43. data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +1385 -0
  44. data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +339 -0
  45. data/spec/spec_helper.rb +189 -0
  46. metadata +260 -0
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --backtrace
data/Gemfile ADDED
@@ -0,0 +1,52 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'jeweler', '~> 1.5.1'
5
+ gem 'rspec', '~> 2.4'
6
+ gem 'rdoc'
7
+
8
+ if ENV['RAILS_GEM_VERSION']
9
+ gem 'activerecord', "=#{ENV['RAILS_GEM_VERSION']}"
10
+ gem 'actionpack', "=#{ENV['RAILS_GEM_VERSION']}"
11
+ gem 'activesupport', "=#{ENV['RAILS_GEM_VERSION']}"
12
+ case ENV['RAILS_GEM_VERSION']
13
+ when /^2.0/
14
+ gem 'composite_primary_keys', '=0.9.93'
15
+ when /^2.1/
16
+ gem 'composite_primary_keys', '=1.0.8'
17
+ when /^2.2/
18
+ gem 'composite_primary_keys', '=2.2.2'
19
+ when /^2.3.3/
20
+ gem 'composite_primary_keys', '=2.3.2'
21
+ when /^3/
22
+ gem 'railties', "=#{ENV['RAILS_GEM_VERSION']}"
23
+ end
24
+ else
25
+ %w(activerecord activemodel activesupport actionpack railties).each do |gem_name|
26
+ if ENV['RAILS_GEM_PATH']
27
+ gem gem_name, :path => File.join(ENV['RAILS_GEM_PATH'], gem_name)
28
+ else
29
+ gem gem_name, :git => "git://github.com/rails/rails"
30
+ end
31
+ end
32
+
33
+ if ENV['AREL_GEM_PATH']
34
+ gem 'arel', :path => ENV['AREL_GEM_PATH']
35
+ else
36
+ gem 'arel', :git => "git://github.com/rails/arel"
37
+ end
38
+
39
+ if ENV['JOURNEY_GEM_PATH']
40
+ gem 'journey', :path => ENV['JOURNEY_GEM_PATH']
41
+ else
42
+ gem "journey", :git => "git://github.com/rails/journey"
43
+ end
44
+ end
45
+
46
+ gem 'ruby-plsql', '>=0.4.4'
47
+
48
+ platforms :ruby do
49
+ gem 'ruby-oci8', '>=2.0.4'
50
+ end
51
+
52
+ end
data/History.md ADDED
@@ -0,0 +1,301 @@
1
+ ### 1.4.2 / 2013-03-18
2
+
3
+ * No changes since 1.4.2.rc2
4
+
5
+ ### 1.4.2.rc2 / 2013-03-01
6
+
7
+ * Bug fixes:
8
+ * Do not consider the numeric attribute as changed if the old value is zero and the new value is not a string [#247]
9
+ * Removed table_name_prefix and table_name_suffix when schema dumper executed [#248]
10
+ * Remove_column should raise an ArgumentError when no columns are passed [#246]
11
+ * Don't dump type for NUMBER virtual columns [#256]
12
+ * Address :returning_id column should be of type Column [#274]
13
+ * Migrated versions should be dumped in order [#277]
14
+ * Always write serialized LOB columns [#275]
15
+ * Truncate the schema_migrations index [#276]
16
+ * Split paths on windows machines in the right way [#231]
17
+
18
+ ### 1.4.2.rc1 / 2012-11-13
19
+
20
+ * Enhancements:
21
+ * Wordlist option for context index [#154]
22
+ * Fall back to directly connecting via OracleDriver on JRuby [#163]
23
+ * Allow slash-prefixed database name in database.yml for using a service [#201]
24
+ * Bug fixes:
25
+ * Fixed explain plans to work with JDBC and OCI8 [#146]
26
+ * Fixed various issues with virtual columns [#159]
27
+ * Fixed SQL structure dump with function indexes [#161]
28
+ * Fixed broken column remove inside a change_table block [#216]
29
+ * Dump indexes on virtual columns using the column's name instead of the column expression [#211]
30
+ * Don't update lobs that haven't changed or are attr_readonly [#212]
31
+ * Support dirty tracking with rails 3.2.9
32
+
33
+ ### 1.4.1 / 2012-01-27
34
+
35
+ * Enhancements:
36
+ * Support for Rails 3.2
37
+ * Support for ActiveRecord 3.2 explain plans [#116]
38
+ * Support for ActiveRecord 3.1 statement pool, to avoid `ORA-01000` maximum open cursors exceeded (default `statement_limit` is 250 and can be changed in `database.yml`) [#100]
39
+ * Added error handling for `rename_table` method in migrations [#137]
40
+ * Bug fixes:
41
+ * Store primary key as `nil` in cache at first time for table without primary key [#84]
42
+ * Fixed inserting records with decimal type columns (`ORA-01722` invalid number exceptions) [#130]
43
+ * Check virtual columns only in models that are using `oracle-enhanced` adapter, to avoid problems when using multiple database adapters [#85]
44
+ * Don't drop the user in rake `db:create` and `db:drop` tasks [#103]
45
+ * Don't add `db:create` and `db:drop` when ActiveRecord is not used as the primary datastore [#128]
46
+ * Quote column names in LOB statements to avoid `ORA-00936` errors [#91]
47
+ * Don't add the `RETURNING` clause if using `composite_primary_keys` gem [#132]
48
+ * Added `join_to_update` method that is necessary for ActiveRecord 3.1 to ensure that correct UPDATE statement is generated using `WHERE ... IN` subquery with offset condition
49
+
50
+ ### 1.4.0 / 2011-08-09
51
+
52
+ * Enhancements:
53
+ * Support for Rails 3.1
54
+ * Bind parameter support for exec_insert, exec_update and exec_delete (in ActiveRecord 3.1)
55
+ * Purge recyclebin on rake db:test:purge
56
+ * Support transactional context index
57
+ * Require ojdbc6.jar (on Java 6) or ojdbc5.jar (on Java 5) JDBC drivers
58
+ * Support for RAW data type
59
+ * rake db:create and db:drop tasks
60
+ * Support virtual columns (in Oracle 11g) in schema dump
61
+ * It is possible to specify default tablespaces for tables, indexes, CLOBs and BLOBs
62
+ * rename_index migrations method
63
+ * Search for JDBC driver in ./lib directory of Rails application
64
+ * Bug fixes:
65
+ * Fixed context index dump when definition is larger than 4000 bytes
66
+ * Fixed schema dump not to conflict with other database adapters that are used in the same application
67
+ * Allow $ in table name prefix or suffix
68
+
69
+ ### 1.3.2 / 2011-01-05
70
+
71
+ * Enhancements:
72
+ * If no :host or :port is provided then connect with :database name (do not default :host to localhost)
73
+ * Database connection pool support for JRuby on Tomcat and JBoss application servers
74
+ * NLS connection parameters support via environment variables or database.yml
75
+ * Support for Arel 2.0 and latest Rails master branch
76
+ * Support for Rails 3.1 prepared statements (implemented in not yet released Rails master branch version)
77
+ * Eager loading of included association with more than 1000 records (implemented in not yet released Rails master branch version)
78
+ * Bug fixes:
79
+ * Foreign keys are added after table definitions in schema dump to ensure correct order of schema statements
80
+ * Quote NCHAR and NVARCHAR2 type values with N'...'
81
+ * Numeric username and/or password in database.yml will be automatically converted to string
82
+
83
+ ### 1.3.1 / 2010-09-09
84
+
85
+ * Enhancements:
86
+ * Tested with Rails 3.0.0 release
87
+ * Lexer options for context index creation
88
+ * Added Bundler for running adapter specs, added RUNNING_TESTS.rdoc with description how to run specs
89
+ * Connection to database using :host, :port and :database options
90
+ * Improved loading of adapter in Rails 3 using railtie
91
+ * Bug fixes:
92
+ * Fix for custom context index procedure when indexing records with null values
93
+ * Quote table and column names in write_lobs callback
94
+ * Fix for incorrect column SQL types when two models use the same table and AR query cache is enabled
95
+ * Fixes for schema and scructure dump tasks
96
+ * Fix for handling of zero-length strings in BLOB and CLOB columns
97
+ * removed String.mb_chars upcase and downcase methods for Ruby 1.9 as Rails 3.0.0 already includes Unicode aware upcase and downcase methods for Ruby 1.9
98
+ * Fixes for latest ActiveRecord unit tests
99
+
100
+ ### 1.3.0 / 2010-06-21
101
+
102
+ * Enhancements:
103
+ * Rails 3.0.0.beta4 and Rails 2.3.x compatible
104
+ * When used with Rails 3 then works together with Oracle SQL compiler included in Arel gem (http://github.com/rails/arel)
105
+ * Rails 3: Better support for limit and offset (when possible adds just ROWNUM condition in WHERE clause without using subqueries)
106
+ * Table and column names are always quoted and in uppercase to avoid the need for checking Oracle reserved words
107
+ * Full text search index creation (add_context_index and remove_context_index methods in migrations and #contains method in ActiveRecord models)
108
+ * add_index and remove_index give just warnings on wrong index names (new expected behavior in Rails 2.3.8 and 3.0.0)
109
+ * :tablespace and :options options for create_table and add_index
110
+ * Workarounds:
111
+ * Rails 3: set ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.cache_columns = true in initializer file for all environments
112
+ (to avoid too many data dictionary queries from Arel)
113
+ * Rails 2.3: patch several ActiveRecord methods to work correctly with quoted table names in uppercase (see oracle_enhanced_activerecord_patches.rb).
114
+ These patches are already included in Rails 3.0.0.beta4.
115
+ * Bug fixes:
116
+ * Fixes for schema purge (drop correctly materialized views)
117
+ * Fixes for schema dump and structure dump (use correct statement separator)
118
+ * Only use Oracle specific schema dump for Oracle connections
119
+
120
+ ### 1.2.4 / 2010-02-23
121
+
122
+ * Enhancements:
123
+ * rake db:test:purge will drop all schema objects from test schema (including views, synonyms, packages, functions, procedures) -
124
+ they should be always reloaded before tests run if necessary
125
+ * added views, synonyms, packages, functions, procedures, indexes, triggers, types, primary, unique and foreign key constraints to structure dump
126
+ * added :temporary option for create_table to create temporary tables
127
+ * added :tablespace option for add_index
128
+ * support function based indexes in schema dump
129
+ * support JNDI database connections in JRuby
130
+ * check ruby-oci8 minimum version 2.0.3
131
+ * added savepoints support (nested ActiveRecord transactions)
132
+ * Bug fixes:
133
+ * typecast returned BigDecimal integer values to Fixnum or Bignum
134
+ (to avoid issues with _before_type_cast values for id attributes because _before_type_cast is used in form helpers)
135
+ * clear table columns cache after columns definition change in migrations
136
+
137
+ ### 1.2.3 / 2009-12-09
138
+
139
+ * Enhancements
140
+ * support fractional seconds in TIMESTAMP values
141
+ * support for ActiveRecord 2.3.5
142
+ * use ENV['TZ'] to set database session time zone
143
+ (as a result DATE and TIMESTAMP values are retrieved with correct time zone)
144
+ * added cache_columns adapter option
145
+ * added current_user adapter method
146
+ * added set_integer_columns and set_string_columns ActiveRecord model class methods
147
+ * Bug fixes:
148
+ * do not raise exception if ENV['PATH'] is nil
149
+ * do not add change_table behavior for ActiveRecord 2.0 (to avoid exception during loading)
150
+ * move foreign key definitions after definition of all tables in schema.rb
151
+ (to avoid definition of foreign keys before all tables are created)
152
+ * changed timestamp format mask to use ':' before fractional seconds
153
+ (workaround to avoid table detection in tables_in_string method in ActiveRecord associations.rb file)
154
+ * fixed custom create/update/delete methods with ActiveRecord 2.3+ and timestamps
155
+ * do not call oracle_enhanced specific schema dump methods when using other database adapters
156
+
157
+ ### 1.2.2 / 2009-09-28
158
+
159
+ * Enhancements
160
+ * improved RDoc documentation of public methods
161
+ * structure dump optionally (database.yml environment has db_stored_code: yes) extracts
162
+ packages, procedures, functions, views, triggers and synonyms
163
+ * automatically generated too long index names are shortened down to 30 characters
164
+ * create tables with primary key triggers
165
+ * use 'set_sequence_name :autogenerated' for inserting into legacy tables with trigger populated primary keys
166
+ * access to tables over database link (need to define local synonym to remote table and use local synonym in set_table_name)
167
+ * [JRuby] support JDBC connection using TNS_ADMIN environment variable and TNS database alias
168
+ * changed cursor_sharing option default from 'similar' to 'force'
169
+ * optional dbms_output logging to ActiveRecord log file (requires ruby-plsql gem)
170
+ * use add_foreign_key and remove_foreign_key to define foreign key constraints
171
+ (the same syntax as in http://github.com/matthuhiggins/foreigner and similar
172
+ to http://github.com/eyestreet/active_record_oracle_extensions)
173
+ * raise RecordNotUnique and InvalidForeignKey exceptions if caused by corresponding ORA errors
174
+ (these new exceptions are supported just by current ActiveRecord master branch)
175
+ * implemented disable_referential_integrity
176
+ (enables safe loading of fixtures in schema with foreign key constraints)
177
+ * use add_synonym and remove_synonym to define database synonyms
178
+ * add_foreign_key and add_synonym are also exported to schema.rb
179
+ * Bug fixes:
180
+ * [JRuby] do not raise LoadError if ojdbc14.jar cannot be required (rely on application server to add it to class path)
181
+ * [JRuby] 'execute' can be used to create triggers with :NEW reference
182
+ * support create_table without a block
183
+ * support create_table with Symbol table name
184
+ * use ActiveRecord functionality to do time zone conversion
185
+ * rake tasks such as db:test:clone are redefined only if oracle_enhanced is current adapter in use
186
+ * VARCHAR2 and CHAR column sizes are defined in characters and not in bytes (expected behavior from ActiveRecord)
187
+ * set_date_columns, set_datetime_columns, ignore_table_columns will work after reestablishing connection
188
+ * ignore :limit option for :text and :binary columns in migrations
189
+ * patches for ActiveRecord schema dumper to remove table prefixes and suffixes from schema.rb
190
+
191
+ ### 1.2.1 / 2009-06-07
192
+
193
+ * Enhancements
194
+ * caching of table indexes query which makes schema dump much faster
195
+ * Bug fixes:
196
+ * return Date (and not DateTime) values for :date column value before year 1970
197
+ * fixed after_create/update/destroy callbacks with plsql custom methods
198
+ * fixed creation of large integers in JRuby
199
+ * Made test tasks respect RAILS_ENV
200
+ * fixed support for composite primary keys for tables with LOBs
201
+
202
+ ### 1.2.0 / 2009-03-22
203
+
204
+ * Enhancements
205
+ * support for JRuby and JDBC
206
+ * support for Ruby 1.9.1 and ruby-oci8 2.0
207
+ * support for Rails 2.3
208
+ * quoting of Oracle reserved words in table names and column names
209
+ * emulation of OracleAdapter (for ActiveRecord unit tests)
210
+ * Bug fixes:
211
+ * several bug fixes that were identified during running of ActiveRecord unit tests
212
+
213
+ ### 1.1.9 / 2009-01-02
214
+
215
+ * Enhancements
216
+ * Added support for table and column comments in migrations
217
+ * Added support for specifying sequence start values
218
+ * Added :privilege option (e.g. :SYSDBA) to ActiveRecord::Base.establish_connection
219
+ * Bug fixes:
220
+ * Do not mark empty decimals, strings and texts (stored as NULL in database) as changed when reassigning them (starting from Rails 2.1)
221
+ * Create booleans as VARCHAR2(1) columns if emulate_booleans_from_strings is true
222
+
223
+ ### 1.1.8 / 2008-10-10
224
+
225
+ * Bug fixes:
226
+ * Fixed storing of serialized LOB columns
227
+ * Prevent from SQL injection in :limit and :offset
228
+ * Order by LOB columns (by replacing column with function which returns first 100 characters of LOB)
229
+ * Sequence creation for tables with non-default primary key in create_table block
230
+ * Do count distinct workaround only when composite_primary_keys gem is used
231
+ (otherwise count distinct did not work with ActiveRecord 2.1.1)
232
+ * Fixed rake db:test:clone_structure task
233
+ (see http://rsim.lighthouseapp.com/projects/11468/tickets/11-rake-dbtestclone_structure-fails-in-117)
234
+ * Fixed bug when ActiveRecord::Base.allow_concurrency = true
235
+ (see http://dev.rubyonrails.org/ticket/11134)
236
+
237
+ ### 1.1.7 / 2008-08-20
238
+
239
+ * Bug fixes:
240
+ * Fixed that adapter works without ruby-plsql gem (in this case just custom create/update/delete methods are not available)
241
+
242
+ ### 1.1.6 / 2008-08-19
243
+
244
+ * Enhancements:
245
+ * Added support for set_date_columns and set_datetime_columns
246
+ * Added support for set_boolean_columns
247
+ * Added support for schema prefix in set_table_name (removed table name quoting)
248
+ * Added support for NVARCHAR2 column type
249
+ * Bug fixes:
250
+ * Do not call write_lobs callback when custom create or update methods are defined
251
+
252
+ ### 1.1.5 / 2008-07-27
253
+
254
+ * Bug fixes:
255
+ * Fixed that write_lobs callback works with partial_updates enabled (added additional record lock before writing BLOB data to database)
256
+ * Enhancements:
257
+ * Changed SQL SELECT in indexes method so that it will execute faster on some large data dictionaries
258
+ * Support for other date and time formats when assigning string to :date or :datetime column
259
+
260
+ ### 1.1.4 / 2008-07-14
261
+
262
+ * Enhancements:
263
+ * Date/Time quoting changes to support composite_primary_keys
264
+ * Added additional methods that are used by composite_primary_keys
265
+
266
+ ### 1.1.3 / 2008-07-10
267
+
268
+ * Enhancements:
269
+ * Added support for custom create, update and delete methods when working with legacy databases where
270
+ PL/SQL API should be used for create, update and delete operations
271
+
272
+ ### 1.1.2 / 2008-07-08
273
+
274
+ * Bug fixes:
275
+ * Fixed after_save callback addition for session store in ActiveRecord version 2.0.2
276
+ * Changed date column name recognition - now should match regex /(^|_)date(_|$)/i
277
+ (previously "updated_at" was recognized as :date column and not as :datetime)
278
+
279
+ ### 1.1.1 / 2008-06-28
280
+
281
+ * Enhancements:
282
+ * Added ignore_table_columns option
283
+ * Added support for TIMESTAMP columns (without fractional seconds)
284
+ * NLS_DATE_FORMAT and NLS_TIMESTAMP_FORMAT independent DATE and TIMESTAMP columns support
285
+ * Bug fixes:
286
+ * Checks if CGI::Session::ActiveRecordStore::Session does not have enhanced_write_lobs callback before adding it
287
+ (Rails 2.0 does not add this callback, Rails 2.1 does)
288
+
289
+ ### 1.1.0 / 2008-05-05
290
+
291
+ * Forked from original activerecord-oracle-adapter-1.0.0.9216
292
+ * Renamed oracle adapter to oracle_enhanced adapter
293
+ * Added "enhanced" to method and class definitions so that oracle_enhanced and original oracle adapter
294
+ could be used simultaniously
295
+ * Added Rails rake tasks as a copy from original oracle tasks
296
+ * Enhancements:
297
+ * Improved perfomance of schema dump methods when used on large data dictionaries
298
+ * Added LOB writing callback for sessions stored in database
299
+ * Added emulate_dates_by_column_name option
300
+ * Added emulate_integers_by_column_name option
301
+ * Added emulate_booleans_from_strings option
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2011 Graham Jenkins, Michael Schoen, Raimonds Simanovskis
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ activerecord-oracle_enhanced-adapter
2
+ ====================================
3
+
4
+ Oracle enhanced adapter for ActiveRecord (with support to specify schema in database.yml). All credit goes to rsim (http://github.com/rsim). I just added some additional code, so that you can specify the required schema in your database.yml to make a specific schema DB Connection. This is very useful in certain situations like -
5
+ When you need to use two different users in your database. One user is to create/modify tables (Data Definition) in your schema, and one is to use that tables (Data Manipulation) within in the app. (I agree it doesnt make any sense, but when there is a policy, you cant go beyond that unfortunately, if you cant change the policy)
6
+
7
+ You will see these kind of scenarios in organizations where you have a DBA policy that app user should not be allowed to created/edit tables. And those DDL operations should be done by a separate ADMIN user account.
8
+
9
+ DESCRIPTION
10
+ -----------
11
+
12
+ This repo is forked from rsim/oracle-enhanced repo. So please refer this page [rsim's Oracle Enhanced](http://www.github.com/rsim/oracle-enhanced) for more details.
13
+
14
+ I just added the additional code, so that we can mention the schema details in our database.yml file, e.g.
15
+
16
+ development:
17
+ adapter: oracle_enhanced
18
+ database: xe
19
+ username: dml_user
20
+ password: secret
21
+ schema: your_schema_name
22
+
23
+ PENDING
24
+ -------
25
+
26
+ * Adding support to run two types of migrations (DML migration script and DDL migration script) separately without mixing it with each other.
27
+
28
+
29
+ INSTALLATION
30
+ ------------
31
+
32
+ ### Rails 3
33
+
34
+ When using Ruby on Rails version 3 then in Gemfile include
35
+
36
+ gem 'activerecord-oracle_enhanced-adapter-with-schema'
37
+
38
+
39
+ After specifying necessary gems in Gemfile run
40
+
41
+ bundle install
42
+
43
+
44
+ USAGE
45
+ -----
46
+
47
+ ### Database connection
48
+
49
+ In Rails application `config/database.yml` use oracle_enhanced as adapter name, e.g.
50
+
51
+ development:
52
+ adapter: oracle_enhanced
53
+ database: xe
54
+ username: user
55
+ password: secret
56
+ schema: schemaName
57
+
58
+ If you're connecting to a service name, indicate the service with a
59
+ leading slash on the database parameter:
60
+
61
+ development:
62
+ adapter: oracle_enhanced
63
+ database: /xe
64
+ username: user
65
+ password: secret
66
+ schema: schemaName
67
+
68
+ If `TNS_ADMIN` environment variable is pointing to directory where `tnsnames.ora` file is located then you can use TNS connection name in `database` parameter. Otherwise you can directly specify database host, port (defaults to 1521) and database name in the following way:
69
+
70
+ development:
71
+ adapter: oracle_enhanced
72
+ host: localhost
73
+ port: 1521
74
+ database: xe
75
+ username: user
76
+ password: secret
77
+ schema: schemaName
78
+
79
+ or you can use Oracle specific format in `database` parameter:
80
+
81
+ development:
82
+ adapter: oracle_enhanced
83
+ database: //localhost:1521/xe
84
+ username: user
85
+ password: secret
86
+ schema: schemaName
87
+
88
+ or you can even use Oracle specific TNS connection description:
89
+
90
+ development:
91
+ adapter: oracle_enhanced
92
+ database: "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=xe)))"
93
+ username: user
94
+ password: secret
95
+ schema: schemaName
96
+
97
+
98
+
99
+ LICENSE
100
+ -------
101
+
102
+ (The MIT License)
103
+
104
+ Copyright (c) 2008-2011 Arunkumar Balu
105
+
106
+ Permission is hereby granted, free of charge, to any person obtaining
107
+ a copy of this software and associated documentation files (the
108
+ 'Software'), to deal in the Software without restriction, including
109
+ without limitation the rights to use, copy, modify, merge, publish,
110
+ distribute, sublicense, and/or sell copies of the Software, and to
111
+ permit persons to whom the Software is furnished to do so, subject to
112
+ the following conditions:
113
+
114
+ The above copyright notice and this permission notice shall be
115
+ included in all copies or substantial portions of the Software.
116
+
117
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
118
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
119
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
120
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
121
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
122
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
123
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.