aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/db_select.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/db_select.rb')
-rw-r--r--lib/sisu/v5/db_select.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb
index 06d8c429..3aebe828 100644
--- a/lib/sisu/v5/db_select.rb
+++ b/lib/sisu/v5/db_select.rb
@@ -63,7 +63,7 @@
=end
module SiSU_DbSelect
class Case
- def initialize(opt,conn='',sql_type='pg')
+ def initialize(opt,conn='',sql_type=:pg)
@opt,@conn,@sql_type=opt,conn,sql_type
@db=SiSU_Env::InfoDb.new
@file_maint=sql_maintenance_file
@@ -78,13 +78,13 @@ module SiSU_DbSelect
end
end
def db_exist?
- if @sql_type=='sqlite' \
+ if @sql_type==:sqlite \
and (not (FileTest.file?(@db.sqlite.db)) or FileTest.zero?(@db.sqlite.db))
puts %{no connection with #{@sql_type} database established, createdb "#{@db.sqlite.db}"?}
exit
end
if @conn.is_a?(NilClass)
- db=@sql_type=='sqlite' \
+ db=@sql_type==:sqlite \
? @db.sqlite.db
: @db.psql.db
puts %{no connection with #{@sql_type} database established, createdb "#{db}"?}
@@ -95,7 +95,7 @@ module SiSU_DbSelect
file=if @opt.inspect =~/M/
if @opt.fns and not @opt.fns.empty?
@env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns
- puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.act[:maintenance][:set]==:on
+ puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on
@db=SiSU_Env::InfoDb.new
@job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql"
File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+')
@@ -173,8 +173,8 @@ module SiSU_DbSelect
db_exist?
@sdb_import.marshal_load
tell=case @sql_type
- when /sqlite/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?")
- when /pg/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?")
+ when :sqlite then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?")
+ when :pg then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?")
else '???'
end
tell.puts_grey if @opt.act[:verbose][:set]==:on
@@ -183,8 +183,8 @@ module SiSU_DbSelect
@sdb_remove_doc.remove
@sdb_import.marshal_load
tell=case @sql_type
- when /sqlite/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?")
- when /pg/ then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?")
+ when :sqlite then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?")
+ when :pg then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?")
else '???'
end
tell.puts_grey if @opt.act[:verbose][:set]==:on