From 2f97cf3f9e13280da9d161d39b8d9b0d66555307 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 17 Dec 2008 20:57:46 -0500 Subject: SiSU's sqlite module still broken for the time being: inconsistent ruby dbi api for sqlite3, (unable to begin and commit transaction) provide explicit message problem noted already in v.0.66.2 (2008-04) and last in v.0.66.3 (2008-05) module (& rb dbi) apparently worked at end 2007 (v.0.62.4) and start of 2008 (v.0.64.0) ... (did not expect broken state to last, sorry) include maintenance mode info with -M flag --- lib/sisu/v0/dbi.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'lib/sisu/v0/dbi.rb') diff --git a/lib/sisu/v0/dbi.rb b/lib/sisu/v0/dbi.rb index 1f161724..9576fa74 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,23 +74,35 @@ 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 -- cgit v1.2.3 From 71223cf6cd035b3e395f6d4c3e4c41b79ed29510 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 22 Dec 2008 01:08:06 -0500 Subject: sqlite3 fix, populate do using rb sqlite3 driver directly (rb dbi problematic at present) sqlite fix, change ruby driver used to populate sisu sqlite3 db to rb sqlite3 for the time being. Use rb sqlite3 driver directly rather (than more convenient when working) rb dbi interface to populate content. Used to bypass problems with rb dbi sqlite3 interface noted in sisu 0.66.2 (2008-04-25) and 0.66.3 (2008-05-11) that have have persisted (apparently worked at end 2007 (v.0.62.4) and start of 2008 (v.0.64.0) * sqlite dropall, fix * fix to auto-generated sqlite cgi script sample, only works if at least one existing populated sisu sqlite database is found during the generation process --- lib/sisu/v0/dbi.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/sisu/v0/dbi.rb') diff --git a/lib/sisu/v0/dbi.rb b/lib/sisu/v0/dbi.rb index 9576fa74..14b3e059 100644 --- a/lib/sisu/v0/dbi.rb +++ b/lib/sisu/v0/dbi.rb @@ -105,8 +105,7 @@ module SiSU_DBI 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} @@ -120,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 -- cgit v1.2.3