From 307ecb4df591aa675b71839014debf6e81d462e1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 18 May 2014 08:49:03 -0400 Subject: v5 v6: db, use symbols to identify sql engine --- lib/sisu/v6/dbi.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/sisu/v6/dbi.rb') diff --git a/lib/sisu/v6/dbi.rb b/lib/sisu/v6/dbi.rb index acb75e0f..5bd98b8a 100644 --- a/lib/sisu/v6/dbi.rb +++ b/lib/sisu/v6/dbi.rb @@ -79,22 +79,22 @@ module SiSU_DBI @sql_type=if @opt.cmd=~/D/ \ or @opt.mod.inspect =~/--pg(?:sql)?/ maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on - 'pg' + :pg elsif @opt.cmd =~/d/ \ and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/ maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on - 'pg' + :pg elsif @opt.cmd=~/d/ \ or @opt.mod.inspect =~/--(?:sq)?lite/ maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on - 'sqlite' + :sqlite elsif @opt.cmd =~/d/ \ and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/ maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on - 'sqlite' + :sqlite else maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on - 'sqlite' + :sqlite end end end @@ -107,7 +107,7 @@ module SiSU_DBI begin @conn=@db.psql.conn_dbi rescue - if @opt.mod.inspect=~/--(createall|create)/ + if @opt.mod.inspect=~/--(?:createall|create)/ 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 @@ -130,8 +130,8 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet end def connect case @sql_type - when /pg/ then read_psql - when /sqlite/ then read_sqlite + 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 begin -- cgit v1.2.3