From 69d476386d149117ced7c77f9f383646a33bcd38 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:21:03 -0400 Subject: v5 v6: db, --maintenance sql, separated out postgresql & sqlite * could share "maintenance" db import sql file (as done previously), consider --- lib/sisu/v5/dbi_discrete.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/sisu/v5/dbi_discrete.rb') diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index 50ef97b4..e50f5646 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -81,7 +81,9 @@ module SiSU_DBI_Discrete #% database building @md=@particulars.md if @opt.act[:sqlite][:set]==:on @sql_type=:sqlite - maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + maintenance_check(@opt,__FILE__,__LINE__) + end end @output_path=@md.file.output_path.sqlite_discrete.dir @filename=@md.file.base_filename.sqlite_discrete @@ -180,13 +182,19 @@ module SiSU_DBI_Discrete #% database building def populate end def sql_maintenance_file - file=if @opt.inspect =~/M/ + file=if @opt.act[:maintenance][:set]==:on 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 + if @sql_type ==:sqlite + puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" + end @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+') + if @sql_type ==:sqlite + File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + else + File.new("#{@env.processing_path.postgresql}/#{@opt.fns}.sql",'w+') + end elsif @opt.fns \ and @opt.fns.inspect =~/create/ nil #sort variations later -- cgit v1.2.3