Class: ActiveRecord::Tasks::IbmDbDatabaseTasks
- Inherits:
-
Object
- Object
- ActiveRecord::Tasks::IbmDbDatabaseTasks
- Defined in:
- lib/active_record/connection_adapters/ibm_db_adapter.rb
Overview
:nodoc:
Instance Method Summary collapse
- #charset ⇒ Object
- #collation ⇒ Object
- #configuration ⇒ Object
- #create ⇒ Object
- #drop ⇒ Object
-
#initialize(configuration) ⇒ IbmDbDatabaseTasks
constructor
A new instance of IbmDbDatabaseTasks.
- #log(msg) ⇒ Object
- #log_end ⇒ Object
- #log_start ⇒ Object
- #purge ⇒ Object
- #structure_dump(filename = nil) ⇒ Object
- #structure_load(filename = nil) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ IbmDbDatabaseTasks
Returns a new instance of IbmDbDatabaseTasks.
32 33 34 35 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 32 def initialize(configuration) @configuration = configuration self.log_start end |
Instance Method Details
#charset ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 68 def charset begin establish_connection configuration connection.task_charset(self) rescue Exception => e puts e. self.log(e.) # puts e.backtrace.inspect end end |
#collation ⇒ Object
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 78 def collation begin establish_connection configuration connection.task_collation(self) rescue Exception => e puts e. self.log(e.) # puts e.backtrace.inspect end end |
#configuration ⇒ Object
110 111 112 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 110 def configuration @configuration end |
#create ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 36 def create self.log_start begin establish_connection configuration connection.task_create(self) rescue Exception => e puts e. self.log(e.) # puts e.backtrace.inspect end end |
#drop ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 47 def drop self.log_start begin establish_connection configuration connection.task_drop(self) rescue Exception => e puts e. self.log(e.) # puts e.backtrace.inspect end end |
#log(msg) ⇒ Object
120 121 122 123 124 125 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 120 def log(msg) self.log_end log_time_diff = ((@log_time_end - @log_time_start) * 10000.0).to_i/10.0 logger.info " (#{log_time_diff}ms) #{msg}" self.log_start end |
#log_end ⇒ Object
117 118 119 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 117 def log_end @log_time_end = Time.now end |
#log_start ⇒ Object
113 114 115 116 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 113 def log_start @log_time_start = Time.now @log_time_end = Time.now end |
#purge ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 58 def purge begin establish_connection configuration connection.task_purge(self) rescue Exception => e puts e. self.log(e.) # puts e.backtrace.inspect end end |
#structure_dump(filename = nil) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 88 def structure_dump(filename=nil) self.log_start begin establish_connection configuration connection.task_structure_dump(self,filename) rescue Exception => e puts e. self.log(e.) # puts e.backtrace.inspect end end |
#structure_load(filename = nil) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 99 def structure_load(filename=nil) self.log_start begin establish_connection configuration connection.task_structure_load(self,filename) rescue Exception => e puts e. self.log(e.) # puts e.backtrace.inspect end end |