From dd13f639ddc54bc9d5519c41d685dd9b23500702 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 29 Aug 2012 21:58:48 -0400 Subject: v3: dbi, pgsql, report need for instructions when none given --- data/doc/sisu/CHANGELOG_v3 | 3 +++ lib/sisu/v3/db_import.rb | 2 +- lib/sisu/v3/db_select.rb | 7 +++++-- lib/sisu/v3/dbi.rb | 2 -- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 0fdf55c3..03061b08 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -37,6 +37,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.3.3.orig.tar.xz * v3: bin/sisu, hub, reorganize call +* v3: dbi, pgsql, report need for instructions when none given, rather than + fail silently + * v3: some pre-unicode meddling sorted (covers bug reported as middle dot changed to asterisk by chals) diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index 03f5d221..225e9da2 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -76,7 +76,7 @@ module SiSU_DbImport if @opt.fns.empty? or @opt.cmd.empty?; @fnb='' else @md=SiSU_Param::Parameters.new(@opt).get - @fnb=@md.fnb + @md.fnb end @suffix=@opt.fns[/(?:.+?)(?:\.ssm\.sst|\.-?sst)/,1] @fnc="#{@dal}/#{@opt.fns}.content.rbm" diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb index 932bc551..e446c48a 100644 --- a/lib/sisu/v3/db_select.rb +++ b/lib/sisu/v3/db_select.rb @@ -181,14 +181,13 @@ module SiSU_DbSelect else '???' end tell.puts_grey if @opt.cmd =~/v/ - when /^--update$/ when /^--remove$/ db_exist? @sdb_remove_doc.remove when /^--index$/ db_exist? @sdb_index.create_indexes - when /^droptable(s)?$/ + when /^--droptable(s)?$/ db_exist? @sdb_no.drop.tables when /^--dropindex(es)?$/ @@ -209,6 +208,10 @@ module SiSU_DbSelect puts @job end end + if @opt.act[:psql][:set]==:on \ + and @opt.mod.inspect !~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables?|recreate|cr(eate)?lex|cr(eate)?metadata|import|update|remove|index|droptable(s)?|dropindex(es)?|dropall|drop)/ + SiSU_Screen::Ansi.new(@opt.cmd,"--pg requires further instruction").warn unless @opt.cmd =~/[q]/ + end begin rescue; @sdb.output_dir? end diff --git a/lib/sisu/v3/dbi.rb b/lib/sisu/v3/dbi.rb index 535ab0f2..cd44b808 100644 --- a/lib/sisu/v3/dbi.rb +++ b/lib/sisu/v3/dbi.rb @@ -107,8 +107,6 @@ module SiSU_DBI puts %{manually create the database: "#{@db.db}" if it does not yet exist} #sudo su -p postgres; createdb #{@db.db}; #[createuser?] end - SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases - @conn=DBI.connect(@db.dbi,@db.user,@db.db) ensure end end -- cgit v1.2.3