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