|
64 | 64 |
|
65 | 65 | module ActiveRecord
|
66 | 66 | module ConnectionHandling # :nodoc:
|
67 |
| - # Establishes a connection to the database that's used by all Active Record objects. |
68 |
| - def oracle_enhanced_connection(config) # :nodoc: |
| 67 | + def oracle_enhanced_connection_class # :nodoc: |
69 | 68 | if config[:emulate_oracle_adapter] == true
|
70 | 69 | # allows the enhanced adapter to look like the OracleAdapter. Useful to pick up
|
71 | 70 | # conditionals in the rails activerecord test suite
|
72 | 71 | require "active_record/connection_adapters/emulation/oracle_adapter"
|
73 |
| - ConnectionAdapters::OracleAdapter.new( |
74 |
| - ConnectionAdapters::OracleEnhanced::Connection.create(config), logger, config) |
| 72 | + ConnectionAdapters::OracleAdapter |
75 | 73 | else
|
76 |
| - ConnectionAdapters::OracleEnhancedAdapter.new( |
77 |
| - ConnectionAdapters::OracleEnhanced::Connection.create(config), logger, config) |
| 74 | + ConnectionAdapters::OracleEnhancedAdapter |
78 | 75 | end
|
79 | 76 | end
|
| 77 | + |
| 78 | + # Establishes a connection to the database that's used by all Active Record objects. |
| 79 | + def oracle_enhanced_connection(config) # :nodoc: |
| 80 | + oracle_enhanced_connection_class.new( |
| 81 | + ConnectionAdapters::OracleEnhanced::Connection.create(config), logger, config) |
| 82 | + end |
80 | 83 | end
|
81 | 84 |
|
82 | 85 | module ConnectionAdapters # :nodoc:
|
@@ -275,6 +278,19 @@ def arel_visitor # :nodoc:
|
275 | 278 | end
|
276 | 279 | end
|
277 | 280 |
|
| 281 | + def self.dbconsole(config, options = {}) |
| 282 | + oracle_config = config.configuration_hash |
| 283 | + logon = "" |
| 284 | + |
| 285 | + if config[:username] |
| 286 | + logon = oracle_config[:username].dup |
| 287 | + logon << "/#{oracle_config[:password]}" if oracle_config[:password] && options[:include_password] |
| 288 | + logon << "@#{config.database}" if config.database |
| 289 | + end |
| 290 | + |
| 291 | + find_cmd_and_exec("sqlplus", logon) |
| 292 | + end |
| 293 | + |
278 | 294 | def build_statement_pool
|
279 | 295 | StatementPool.new(self.class.type_cast_config_to_integer(@config[:statement_limit]))
|
280 | 296 | end
|
|
0 commit comments