aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-12-17 20:57:46 -0500
committerRalph Amissah <ralph@amissah.com>2008-12-20 22:54:44 -0500
commit2f97cf3f9e13280da9d161d39b8d9b0d66555307 (patch)
tree07ee35d65bb4d79fc69ccbc7595c08e8635928be
parenthtml & css cosmetic changes (index & concordance), run "sisu -CC"; changelog (diff)
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
-rw-r--r--CHANGELOG3
-rw-r--r--lib/sisu/v0/db_dbi.rb20
-rw-r--r--lib/sisu/v0/db_import.rb20
-rw-r--r--lib/sisu/v0/db_load_tuple.rb4
-rw-r--r--lib/sisu/v0/db_remove.rb3
-rw-r--r--lib/sisu/v0/db_select.rb16
-rw-r--r--lib/sisu/v0/dbi.rb20
-rw-r--r--lib/sisu/v0/urls.rb4
8 files changed, 67 insertions, 23 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9cb6caf1..7b1b22dd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -17,6 +17,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.70.3.orig.tar.gz
* html and css, cosmetic changes (and the closing of a tag)
+ * sqlite module remains broken, inconsistent ruby dbi api - made explicit
+ when run
+
%% sisu_0.70.2.orig.tar.gz (2008-12-16:50/2)
http://www.jus.uio.no/sisu/pkg/src/sisu_0.70.2.orig.tar.gz
c4ec17c3f50b629a33afcb3d343e111172bf56b656fa892d82936f86dfde281a 1545482 sisu_0.70.2.orig.tar.gz
diff --git a/lib/sisu/v0/db_dbi.rb b/lib/sisu/v0/db_dbi.rb
index 3a54fd46..4256efb9 100644
--- a/lib/sisu/v0/db_dbi.rb
+++ b/lib/sisu/v0/db_dbi.rb
@@ -70,25 +70,25 @@ module SiSU_DB_DBI
require "#{SiSU_lib}/db_import"
class Column_size < SiSU_DB_columns::Column_size
end
- class Test < SiSU_DB_tests::Test
+ class Test < SiSU_DB_tests::Test #% db_tests.rb
end
- class Create <SiSU_DB_create::Create #<SiSU_DB::Column_size
+ class Create <SiSU_DB_create::Create #<SiSU_DB::Column_size #% db_create.rb
end
- class Case <SiSU_DB_select::Case
+ class Case <SiSU_DB_select::Case #% db_select.rb
end
- class Index <SiSU_DB_index::Index # create documents Indexes def initialize(opt,conn='',sql_type='')
+ class Index <SiSU_DB_index::Index #% db_indexes.rb
end
- class Drop <SiSU_DB_drop::Drop
+ class Drop <SiSU_DB_drop::Drop #% db_drop.rb
end
- class Remove <SiSU_DB_remove::Remove
+ class Remove <SiSU_DB_remove::Remove #% db_remove.rb
end
- class Load_documents <SiSU_DB_tuple::Load_documents #% main database populate/update
+ class Load_documents <SiSU_DB_tuple::Load_documents #% db_load_tuple.rb
end
- class Load_metadata <SiSU_DB_tuple::Load_metadata #% update metadata
+ class Load_metadata <SiSU_DB_tuple::Load_metadata #% db_load_tuple.rb
end
- class Load_urls <SiSU_DB_tuple::Load_urls #% update urls
+ class Load_urls <SiSU_DB_tuple::Load_urls #% db_update urls
end
- class Import <SiSU_DB_import::Import #<SiSU_DB::Column_size #% main
+ class Import <SiSU_DB_import::Import #<SiSU_DB::Column_size #% db_import.rb
end
end
__END__
diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb
index 1e1e25d7..bcdfc497 100644
--- a/lib/sisu/v0/db_import.rb
+++ b/lib/sisu/v0/db_import.rb
@@ -112,7 +112,15 @@ module SiSU_DB_import
tell.print_grey if @opt.cmd =~/v/
case @sql_type
when /sqlite/ #fix logic for sqlite !
+#sqlite watch
+unless @opt.cmd =~/[MVv]/
+ puts "\nSiSU's sqlite module for the time being broken: inconsistent ruby dbi api for sqlite3, (unable to begin and commit transaction)\n".upcase
+ p @conn.methods.sort
+ #p "here #{__FILE__} #{__LINE__}"
+ exit
+else
#pf_db_import_transaction_open if @opt =~/M/
+ #@conn.begin
db_import_metadata
db_import_documents(@dal_array)
db_import_urls(@dal_array,@fnm) #import OID on/off
@@ -120,6 +128,14 @@ module SiSU_DB_import
#@conn.commit
#@conn.close
#@conn.disconnect
+ puts "\nSiSU's sqlite module for the time being broken: inconsistent ruby dbi api for sqlite3, (unable to begin and commit transaction)\n".upcase
+ p @conn.methods.sort
+ if @opt.cmd =~/M/
+ puts "\n" + @conn.inspect
+ puts "\nat #{__FILE__} #{__LINE__}"
+ end
+ exit
+end
#sqlite watch
else
file_exist=@conn.select_one(%{ SELECT metadata.tid FROM metadata WHERE metadata.filename ~ '#{@opt.fns}'; })
@@ -129,6 +145,10 @@ module SiSU_DB_import
db_import_documents(@dal_array)
db_import_urls(@dal_array,@fnm) #import OID on/off
@conn.execute('COMMIT')
+ if @opt.cmd =~/[MV]/
+ puts "\n" + @conn.inspect
+ puts "\nat #{__FILE__} #{__LINE__}"
+ end
else
@db=SiSU_Env::Info_db.new
puts "\n#{@cX.grey}file #{@cX.off} #{@cX.blue}#{@opt.fns}#{@cX.off} #{@cX.grey}already exists in database#{@cX.off} #{@cX.blue}#{@db.psql.db}#{@cX.off} #{@cX.brown}update instead?#{@cX.off}"
diff --git a/lib/sisu/v0/db_load_tuple.rb b/lib/sisu/v0/db_load_tuple.rb
index aefa10c4..512d5933 100644
--- a/lib/sisu/v0/db_load_tuple.rb
+++ b/lib/sisu/v0/db_load_tuple.rb
@@ -85,6 +85,10 @@ module SiSU_DB_tuple
"INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
end
if @opt.cmd =~/M/
+ if @opt.cmd =~/V/
+ puts @file.inspect
+ puts sql_entry
+ end
@file.puts sql_entry
else @conn.execute(sql_entry)
end
diff --git a/lib/sisu/v0/db_remove.rb b/lib/sisu/v0/db_remove.rb
index 93680f2c..fef4e797 100644
--- a/lib/sisu/v0/db_remove.rb
+++ b/lib/sisu/v0/db_remove.rb
@@ -79,9 +79,10 @@ DELETE FROM documents WHERE metadata_tid = '#{del_id}';
DELETE FROM urls WHERE metadata_tid = '#{del_id}';
DELETE FROM metadata WHERE tid = '#{del_id}';
SQL
+ @conn.execute(%{#{sql_entry}})
if @opt.cmd =~/M/
@file.puts sql_entry if @opt.cmd =~/M/
- else @conn.execute(%{#{sql_entry}})
+ #else @conn.execute(%{#{sql_entry}})
end
else
tell=SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}")
diff --git a/lib/sisu/v0/db_select.rb b/lib/sisu/v0/db_select.rb
index a596d4e3..675a89e4 100644
--- a/lib/sisu/v0/db_select.rb
+++ b/lib/sisu/v0/db_select.rb
@@ -65,9 +65,9 @@ module SiSU_DB_select
#@conn.execute("BEGIN;")
#@sdb=Create.new(@conn)
@file=sql_maintenance_file
- @sdb=SiSU_DB_DBI::Create.new(@opt,@conn,@file,@sql_type)
- @sdb_index=SiSU_DB_DBI::Index.new(@opt,@conn,@file,@sql_type)
- @sdb_no=SiSU_DB_DBI::Drop.new(@opt,@conn,@file,@sql_type)
+ @sdb=SiSU_DB_DBI::Create.new(@opt,@conn,@file,@sql_type) # db_dbi.rb
+ @sdb_index=SiSU_DB_DBI::Index.new(@opt,@conn,@file,@sql_type) # db_dbi.rb
+ @sdb_no=SiSU_DB_DBI::Drop.new(@opt,@conn,@file,@sql_type) # db_dbi.rb
@sdb_import=SiSU_DB_DBI::Import.new(@opt,@conn,@file,@sql_type) if @opt.mod.inspect =~/update|import/
@sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file) if @opt.mod.inspect =~/update|remove/
@db=SiSU_Env::Info_db.new
@@ -155,13 +155,13 @@ module SiSU_DB_select
else '???'
end
tell.puts_grey if @opt.cmd =~/v/
- when /^--remove$/
- @sdb_remove_doc.remove
when /^--update$/
@sdb_remove_doc.remove
@sdb_import.marshal_load
tell=SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?")
tell.puts_grey if @opt.cmd =~/v/
+ when /^--remove$/
+ @sdb_remove_doc.remove
when /^--index$/
@sdb_index.create_indexes
when /^droptable(s)?$/
@@ -185,7 +185,11 @@ module SiSU_DB_select
end
end
begin
- @conn.commit if @sql_type =~/sqlite/
+ #if @sql_type =~/sqlite/
+ # #p @conn.methods.sort
+ # @conn.commit
+ # ##@conn.disconnect
+ #end
rescue; @sdb.output_dir?
end
end
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
diff --git a/lib/sisu/v0/urls.rb b/lib/sisu/v0/urls.rb
index 05ffd969..6d78d4fe 100644
--- a/lib/sisu/v0/urls.rb
+++ b/lib/sisu/v0/urls.rb
@@ -109,7 +109,7 @@ module SiSU_urls
'b (XHTML)'=>@fn[:xhtml],
#'B (Docbook XML)'=>@fn[:docbook],
'D[iu] (DBI import/update postgresql)'=>'dbi psql',
- 'd[iu] (DBI import/update sqlite)'=>'dbi sqlite',
+ 'd[iu] (DBI import/update sqlite)'=>'dbi sqlite3',
'e (Plain-text (endnotes))'=>@fn[:plain],
'E (Plain-text (endnotes) dos)'=>@fn[:plain],
'h (HTML segmented)'=>@fn[:toc],
@@ -221,7 +221,7 @@ module SiSU_urls
end
if x=~/^d/ \
and @opt.cmd =~/d/
- tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite #{@env.path.output}/sisu_sqlite.db", "#{y}")
+ tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite3 #{@env.path.output}/sisu_sqlite.db", "#{y}")
tell.result unless @opt.cmd =~/q/
@opt.cmd.gsub!(/d[iu]/,'')
end