aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/dbi.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-05-18 08:49:03 -0400
committerRalph Amissah <ralph@amissah.com>2014-05-18 08:49:03 -0400
commit307ecb4df591aa675b71839014debf6e81d462e1 (patch)
tree647e6738bc5868f09c62e07cc03c45ab64e3c1cd /lib/sisu/v5/dbi.rb
parentv6: utils, add ok code marker (diff)
v5 v6: db, use symbols to identify sql engine
Diffstat (limited to 'lib/sisu/v5/dbi.rb')
-rw-r--r--lib/sisu/v5/dbi.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb
index 1ab9bc9c..737f02fd 100644
--- a/lib/sisu/v5/dbi.rb
+++ b/lib/sisu/v5/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