Method: DBGeni::Migrator::Oracle#code_errors
- Defined in:
- lib/dbgeni/migrators/oracle.rb
#code_errors ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/dbgeni/migrators/oracle.rb', line 62 def code_errors # The error part of the file file either looks like: # SQL> show err # No errors. # SQL> spool off # or # SQL> show err # Errors for PACKAGE BODY PKG1: # LINE/COL ERROR # -------- ----------------------------------------------------------------- # 5/1 PLS-00103: Encountered the symbol "END" when expecting one of the # following: # Error messages here # SQL> spool off # In the first case, return nil, but in the second case get everything after show err error_msg = '' start_search = false File.open(@logfile, 'r').each_line do |l| if !start_search && l =~ /^SQL> show err/ start_search = true next end if start_search if l =~ /^No errors\./ error_msg = nil break elsif l =~ /^SQL> spool off/ break else error_msg << l end end end error_msg end |