From 41796e30e4597c74e7e42c3144dbe5d4fb0687c5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Jul 2014 21:30:56 -0400 Subject: v5 v6: cosmetic code --- lib/sisu/v5/dbi.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/sisu/v5/dbi.rb') diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index 0e438c3e..d6454f48 100644 --- a/lib/sisu/v5/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -136,7 +136,11 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet when :pg then read_psql #read_pg when :sqlite then read_sqlite end - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fno).dbi_title unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "DBI (#{@sql_type}) #{@opt.mod}", + @opt.fno + ).dbi_title unless @opt.act[:quiet][:set]==:on begin SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases rescue -- cgit v1.2.3 From f36e8bf79f92b0be3d87788e6a48605f031698da Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Jul 2014 21:39:25 -0400 Subject: v5 v6: db, pqsl, sqlite, reorganise triggers --- lib/sisu/v5/dbi.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib/sisu/v5/dbi.rb') diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index d6454f48..83021b20 100644 --- a/lib/sisu/v5/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -73,22 +73,18 @@ module SiSU_DBI def initialize(opt) @opt=opt @db=SiSU_Env::InfoDb.new - if @opt.cmd =~/[Dd]/ \ - or @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/ - @sql_type=if @opt.cmd=~/D/ \ - or @opt.mod.inspect =~/--pg(?:sql)?/ + if @opt.act[:psql][:set]==:on \ + or @opt.act[:sqlite][:set]==:on + @sql_type=if @opt.act[:psql][:set]==:on maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on :pg - elsif @opt.cmd =~/d/ \ - and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/ + elsif @opt.act[:psql][:set]==:on maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on :pg - elsif @opt.cmd=~/d/ \ - or @opt.mod.inspect =~/--(?:sq)?lite/ + elsif @opt.act[:sqlite][:set]==:on maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on :sqlite - elsif @opt.cmd =~/d/ \ - and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/ + elsif @opt.act[:sqlite][:set]==:on maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on :sqlite else @@ -110,7 +106,7 @@ module SiSU_DBI require 'pg' @conn=@db.psql.conn_pg rescue - if @opt.mod.inspect=~/--(?:createall|create)/ + if @opt.act[:psql_create][:set]==:on cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX puts <<-WOK manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet exist -- cgit v1.2.3