diff options
Diffstat (limited to 'lib/sisu/v5/dbi.rb')
-rw-r--r-- | lib/sisu/v5/dbi.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index 0e438c3e..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 @@ -136,7 +132,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 |