aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/dbi.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/dbi.rb')
-rw-r--r--lib/sisu/v0/dbi.rb27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/sisu/v0/dbi.rb b/lib/sisu/v0/dbi.rb
index 1f161724..14b3e059 100644
--- a/lib/sisu/v0/dbi.rb
+++ b/lib/sisu/v0/dbi.rb
@@ -64,7 +64,7 @@ module SiSU_DBI
include SiSU_Screen
require "#{SiSU_lib}/param"
include SiSU_Param
- require "#{SiSU_lib}/db_dbi"
+ require "#{SiSU_lib}/db_dbi" # db_dbi.rb
include SiSU_DB_DBI
require "#{SiSU_lib}/shared_html_lite"
include SiSU_Format_Shared
@@ -74,27 +74,38 @@ module SiSU_DBI
@opt=opt
@db=SiSU_Env::Info_db.new
if @opt.cmd =~/d/i \
- or @opt.mod.inspect =~/--pg(?:sql)?|(?:sq)?lite/
+ or @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/
@sql_type=if @opt.cmd=~/D/ \
or @opt.mod.inspect =~/--pg(?:sql)?/
+ maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/
'pg'
elsif @opt.cmd =~/d/ \
and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/
+ maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/
'pg'
- elsif @opt.mod.inspect =~/--(?:sq)?lite/
+ elsif @opt.cmd=~/d/ \
+ or @opt.mod.inspect =~/--(?:sq)?lite/
+ maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/
'sqlite'
elsif @opt.cmd =~/d/ \
and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/
+ maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/
'sqlite'
#elsif @opt.cmd =~/d/ and @opt.mod.select =~/--my(?:sql)?/; 'mysql'
- else 'sqlite'
+ else
+ maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/
+ 'sqlite'
end
end
end
+ def maintenance_check(opt,file,line)
+ p opt.mod
+ p opt.cmd
+ p "at #{file} #{line}"
+ end
def read_psql
begin
- db,user,dbi,pass=@db.psql.db,@db.psql.user,@db.psql.dbi,@db.psql.password
- @conn=DBI.connect(dbi,user,pass)
+ @conn=@db.psql.conn_dbi
rescue
if @opt.mod.inspect=~/--(createall|create)/
puts %{manually create the database: "#{db}" if it does not yet exist}
@@ -108,8 +119,8 @@ module SiSU_DBI
def read_sqlite
begin
sql_type='sqlite'
- dbi=@db.sqlite.dbi
- @conn=DBI.connect(dbi)
+ @conn=@db.sqlite.conn_sqlite3
+ #@conn=@db.sqlite.conn_dbi #issue with dbi sqlite api, when fixed revert to using, KEEP
rescue
ensure
end