diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-07-22 21:39:25 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-07-22 21:39:25 -0400 |
commit | f36e8bf79f92b0be3d87788e6a48605f031698da (patch) | |
tree | 5b2c783fd8b08d2208dcff7a09fea6ebd67a1b5b /lib/sisu/v5/dbi.rb | |
parent | v5 v6: db, pg import, fix (diff) |
v5 v6: db, pqsl, sqlite, reorganise triggers
Diffstat (limited to 'lib/sisu/v5/dbi.rb')
-rw-r--r-- | lib/sisu/v5/dbi.rb | 18 |
1 files changed, 7 insertions, 11 deletions
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 |