Class: OracleToMysql::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/oracle_to_mysql/command.rb,
lib/oracle_to_mysql/command/delete_temp_files.rb,
lib/oracle_to_mysql/command/write_sqlplus_commands_to_file.rb,
lib/oracle_to_mysql/command/fork_and_execute_sqlplus_command.rb,
lib/oracle_to_mysql/command/write_and_execute_mysql_commands_to_bash_file.rb,
lib/oracle_to_mysql/command/write_and_execute_mysql_commands_to_bash_file_in_replace_mode.rb

Defined Under Namespace

Classes: DeleteTempFiles, ForkAndExecuteSqlplusCommand, WriteAndExecuteMysqlCommandsToBashFile, WriteAndExecuteMysqlCommandsToBashFileInReplaceMode, WriterSqlplusCommandsToFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#client_classObject

Returns the value of attribute client_class.



2
3
4
# File 'lib/oracle_to_mysql/command.rb', line 2

def client_class
  @client_class
end

Instance Method Details

#error(msg) ⇒ Object



6
7
8
9
# File 'lib/oracle_to_mysql/command.rb', line 6

def error(msg)
  self.output("[ERROR] #{msg}")
  raise OracleToMysql::CommandError.new("#{self.client_class.to_s}#otm_execute died on command=#{self.class.to_s}")
end

#executeObject

Client classes call this method



29
30
31
32
33
# File 'lib/oracle_to_mysql/command.rb', line 29

def execute
  self.started
  self.execute_internal
  self.finished
end

#execute_internalObject



42
43
44
# File 'lib/oracle_to_mysql/command.rb', line 42

def execute_internal
  raise "CHILDREN MUST OVERRIDE THIS"
end

#finished(msg = '') ⇒ Object



18
19
20
# File 'lib/oracle_to_mysql/command.rb', line 18

def finished(msg='')
  self.output("[finished t=#{self.client_class.otm_time_elapsed_since_otm_timestamp}]#{msg}")
end

#info(msg) ⇒ Object



3
4
5
# File 'lib/oracle_to_mysql/command.rb', line 3

def info(msg)
  self.output("[info] #{msg}")
end

#output(msg) ⇒ Object

USE THE ones above if possible, it makes the output more uniform and easier to read/parse Stuff funnels to here, which propogates up to the client class



24
25
26
# File 'lib/oracle_to_mysql/command.rb', line 24

def output(msg)
  self.client_class.otm_output("[#{self.class.to_s}]#{msg}")
end

#started(msg = '') ⇒ Object



14
15
16
# File 'lib/oracle_to_mysql/command.rb', line 14

def started(msg='')
  self.output("[started t=#{self.client_class.otm_time_elapsed_since_otm_timestamp}]#{msg}")
end

#temp_file_symbolsObject

Commands should override this if they use temp files that need to be cleaned up The cleanup_temp_files_and_tables command reflects on all commands to find and delete things referenced in here



38
39
40
# File 'lib/oracle_to_mysql/command.rb', line 38

def temp_file_symbols
  []
end

#warn(msg) ⇒ Object



10
11
12
# File 'lib/oracle_to_mysql/command.rb', line 10

def warn(msg)
  self.output("[WARN] #{msg}")
end