diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-08-20 19:04:47 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-08-20 19:04:47 -0400 |
commit | 29fc7f3c14b36770caad64cb82ec9177384ab61a (patch) | |
tree | c2079e8bf5d2944d7bc10b55c1b3fb76dcb07cc0 /lib/sisu/v6/db_create.rb | |
parent | v5 v6: hub options, introduce "error override" --no-stop or --errors-as-warnings (diff) |
v5 v6: start making use of --no-stop command
Diffstat (limited to 'lib/sisu/v6/db_create.rb')
-rw-r--r-- | lib/sisu/v6/db_create.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/sisu/v6/db_create.rb b/lib/sisu/v6/db_create.rb index 55eab144..a9083b61 100644 --- a/lib/sisu/v6/db_create.rb +++ b/lib/sisu/v6/db_create.rb @@ -117,10 +117,38 @@ module SiSU_DbCreate end end def conn_exec_pg(sql) - @conn.exec_params(sql) + begin + @conn.exec_params(sql) + rescue + if @conn.is_a?(NilClass) + errmsg="No pg connection (check pg dependencies)" + if @opt.act[:no_stop][:set]==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error("#{errmsg}, proceeding without pg output (as requested)") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error("#{errmsg}, STOPPING") + exit + end + end + end end def conn_exec_sqlite(sql) + begin @conn.execute(sql) + rescue + if @conn.is_a?(NilClass) + errmsg="No sqlite3 connection (check sqlite3 dependencies)" + if @opt.act[:no_stop][:set]==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error("#{errmsg}, proceeding without sqlite output (as requested)") + else + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error("#{errmsg}, STOPPING") + exit + end + end + end end def metadata_and_text if (@opt.act[:verbose_plus][:set]==:on \ |