aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/dbi_discrete.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-10-12 10:21:03 -0400
committerRalph Amissah <ralph@amissah.com>2014-10-12 10:21:03 -0400
commit69d476386d149117ced7c77f9f383646a33bcd38 (patch)
tree68edfd4da7d6e32bd1611d139d712b31363a5e80 /lib/sisu/v5/dbi_discrete.rb
parentv5 v6: epub tune, --maintenance, fix (diff)
v5 v6: db, --maintenance sql, separated out postgresql & sqlite
* could share "maintenance" db import sql file (as done previously), consider
Diffstat (limited to 'lib/sisu/v5/dbi_discrete.rb')
-rw-r--r--lib/sisu/v5/dbi_discrete.rb16
1 files changed, 12 insertions, 4 deletions
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