From 06520be4633f7ee3463c92615be3e11f0f21fa08 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 21 Apr 2012 01:47:35 -0400 Subject: v3: db bugfix in maintenance mode (variable name reused) --- lib/sisu/v3/dbi_discreet.rb | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'lib/sisu/v3/dbi_discreet.rb') diff --git a/lib/sisu/v3/dbi_discreet.rb b/lib/sisu/v3/dbi_discreet.rb index 61ab3a3d..8f7f0c53 100644 --- a/lib/sisu/v3/dbi_discreet.rb +++ b/lib/sisu/v3/dbi_discreet.rb @@ -81,6 +81,7 @@ module SiSU_DBI_Discreet #% database building end @output_path=@md.file.output_path.sqlite_discreet.dir @filename=@md.file.base_filename.sqlite_discreet + @file_maint=sql_maintenance_file @file="#{@output_path}/#{@filename}" end def build @@ -114,8 +115,8 @@ module SiSU_DBI_Discreet #% database building def create_and_populate db=SiSU_Env::DbOp.new(@md) conn=db.sqlite_discreet.conn_sqlite3 - sdb=SiSU_DbDBI::Create.new(@opt,conn,@file,'sqlite') - sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,'sqlite') + sdb=SiSU_DbDBI::Create.new(@opt,conn,@file_maint,'sqlite') + sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file_maint,'sqlite') sdb.output_dir? begin SiSU_Screen::Ansi.new(@opt.cmd,'SQLite',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi unless @opt.cmd =~/q/ @@ -128,7 +129,7 @@ module SiSU_DBI_Discreet #% database building sdb.create_table.urls sdb_index.create_indexes db_exist?(db,conn) - sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file,'sqlite') + sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file_maint,'sqlite') sdb_import.marshal_load tell=SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{db.sqlite.db} database?") tell.puts_grey if @opt.cmd =~/v/ @@ -154,6 +155,21 @@ module SiSU_DBI_Discreet #% database building end def populate end + def sql_maintenance_file + file=if @opt.inspect =~/M/ + x=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.cmd =~/M/ + @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+') + elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later + else nil + end + else nil + end + file + end end end __END__ -- cgit v1.2.3