From bcb074af136731ff36e479090447f21dd13aa218 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 18 May 2014 08:57:10 -0400 Subject: v5 v6: cgi, sample search forms: use ruby-pg & ruby-sqlite3; remove ruby-dbi --- data/doc/sisu/CHANGELOG_v5 | 5 +++++ data/doc/sisu/CHANGELOG_v6 | 5 +++++ data/doc/sisu/sisu.org | 16 +++++++++----- data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi | 19 ++++++++-------- data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi | 32 +++++++++++++-------------- 5 files changed, 46 insertions(+), 31 deletions(-) (limited to 'data') diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 1e958203..08796bbe 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -44,6 +44,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.3.6.orig.tar.xz * for pg: require 'pg' (use ruby-pg directly) * for sqlite: require 'sqlite3' (use ruby-sqlite3 directly) [already the case] +* cgi, sample search form generator + * remove require 'dbi' (ruby-dbi) + * for pg: require 'pg' (use ruby-pg directly) + * for sqlite: require 'sqlite3' (use ruby-sqlite3 directly) + %% 5.3.5.orig.tar.xz (2014-05-12:19/1) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.3.5 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.3.5-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 0c533432..b39da757 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -34,6 +34,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.6.orig.tar.xz * for pg: require 'pg' (use ruby-pg directly) * for sqlite: require 'sqlite3' (use ruby-sqlite3 directly) [already the case] +* cgi, sample search form generator + * remove require 'dbi' (ruby-dbi) + * for pg: require 'pg' (use ruby-pg directly) + * for sqlite: require 'sqlite3' (use ruby-sqlite3 directly) + %% 6.0.5.orig.tar.xz (2014-05-12:19/1) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.5 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.5-1 diff --git a/data/doc/sisu/sisu.org b/data/doc/sisu/sisu.org index 0e4b0bf6..f8817e68 100644 --- a/data/doc/sisu/sisu.org +++ b/data/doc/sisu/sisu.org @@ -1179,7 +1179,7 @@ revisit, *** DBT Outstanding bugs -- sisu caught by removal of ruby-dbi -**** TODO [#B] sisu 5.3.4-1 marked for autoremoval from debian testing on 2014-06-10, for depending on ruby-dbi +**** DONE (pending acceptance) [#B] sisu 5.3.4-1 marked for autoremoval from debian testing on 2014-06-10, for depending on ruby-dbi sisu 5.3.4-1 is marked for autoremoval from testing on 2014-06-10 It (build-)depends on packages with these RC bugs: @@ -1221,7 +1221,7 @@ http://lists.sisudoc.org/pipermail/sisu/2014-May/000818.html * code tests passed (create tables, populate db etc. work fine) (closes) -***** TODO [#B] sample cgi search forms +***** DONE [#B] sample cgi search forms there is a sample cgi search form facility within sisu that uses ruby-dbi to query sqlite3 or pg databases. @@ -1239,7 +1239,12 @@ http://lists.sisudoc.org/pipermail/sisu/2014-May/000818.html > eventually using ruby-sqlite3 and ruby-pg directly). Solution Implemented: - (pending) + * sample cgi search froms (cgi database query forms) fixed :) + * pg sample uses 'pg' (dbi dropped) + generate sample form using: sisu --sample-search-form --db-pg + * sqlite sample uses 'sqlite3' (dbi dropped) + generate sample form using: sisu --sample-search-form --db-sqlite + (closes) ***** NOTES/COMMENTS @@ -1248,8 +1253,9 @@ debian/control, remove dependency on ruby-dbi, contained in sisu-postgresql and Current status * sisu-sqlite ok, uses 'sqlite3' (superflous dbi loading dropped) * sisu-postgresql ok, uses 'pg' (dbi dropped) - * sample cgi search froms (cgi database query forms) are broken till they work - off ruby-pg & ruby-sqlite3 respectively instead of ruby-dbi + * sample cgi search froms (cgi database query forms) ok :) + * pg sample uses 'pg' (dbi dropped) + * sqlite sample uses 'sqlite3' (dbi dropped) *** DBT Outstanding bugs -- Normal bugs; Unclassified (2 bugs) :debian:dbt:normal: diff --git a/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi b/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi index 2f6f93e4..704ea154 100644 --- a/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi +++ b/data/sisu/conf/cgi-bin/sisu_search_pgsql.cgi @@ -60,7 +60,7 @@ begin require 'cgi' require 'fcgi' - require 'dbi' + require 'pg' rescue LoadError puts 'cgi, fcgi or dbi NOT FOUND (LoadError)' end @@ -71,7 +71,7 @@ @output_dir_structure_by='language' @lingual='multi' @port='5432' - @db_name_prefix='SiSUv6a_' + @db_name_prefix='SiSUv6b_' @user='ralph' # check user name for access to pg database: e.g. www-data or 'ralph' @base="http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}#{ENV['SCRIPT_NAME']}" #Common TOP @@ -141,9 +141,9 @@
index @@ -520,10 +520,10 @@ %{#{sql_select_endnotes}} end def contents - @conn.select_all(sql_select_body) + @conn.exec(sql_select_body) end def endnotes - @conn.select_all(sql_select_endnotes) + @conn.exec(sql_select_endnotes) end end def tail @@ -547,7 +547,7 @@

Generated by - SiSU 6.0.3 2014-02-06 (2014w05/4) + SiSU 6.0.6 2014-05-18 (2014w19/7)
SiSU © Ralph Amissah @@ -679,8 +679,7 @@ checked_searched=checked_tip=checked_case=checked_sql='' end selected_db=%{} - dbi="dbi:Pg:database=#{@db};port=#{@port}" - @conn=DBI.connect(dbi,@user) + @conn=PG::Connection.open(dbname: @db, port: @port, user: @user) search_field=cgi['find'] if cgi['find'] # =~/\S+/ @search_for=SearchRequest.new(search_field,q) #.analyze #% search_for #% searches diff --git a/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi b/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi index 2bd9c09a..526ac974 100644 --- a/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi +++ b/data/sisu/conf/cgi-bin/sisu_search_sqlite.cgi @@ -60,9 +60,9 @@ begin require 'cgi' require 'fcgi' - require 'dbi' + require 'sqlite3' rescue LoadError - puts 'cgi, fcgi or dbi NOT FOUND (LoadError)' + puts 'cgi, fcgi or sqlite3 NOT FOUND (LoadError)' end @stub_default='sisu_sqlite' @image_src="http://#{ENV['HTTP_HOST']}/_sisu/image_sys" @@ -70,7 +70,7 @@ @hosturl_files="http://#{ENV['HTTP_HOST']}" @output_dir_structure_by='language' @lingual='multi' - @db_name_prefix='SiSUv6a_' + @db_name_prefix='SiSUv6b_' @base="http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}#{ENV['SCRIPT_NAME']}" #Common TOP @@offset=0 @@ -118,7 +118,7 @@ - +

@@ -139,8 +139,8 @@
index @@ -511,10 +511,10 @@ %{#{sql_select_endnotes}} end def contents - @conn.select_all(sql_select_body) + @conn.execute(sql_select_body) end def endnotes - @conn.select_all(sql_select_endnotes) + @conn.execute(sql_select_endnotes) end end def tail @@ -538,7 +538,7 @@

Generated by - SiSU 6.0.3 2014-02-06 (2014w05/4) + SiSU 6.0.6 2014-05-18 (2014w19/7)
SiSU © Ralph Amissah @@ -670,17 +670,17 @@ checked_searched=checked_tip=checked_case=checked_sql='' end selected_db=case cgi['db'] - when /SiSUv6a_manual/ then '' - when /SiSUv6a_sisu/ then '' + when /SiSUv6b_manual/ then '' + when /SiSUv6b_sisu/ then '' end db_name='sisu_sqlite.db' db_sqlite=case cgi['db'] - when /SiSUv6a_manual/ then "/srv/www/manual/#{db_name}" - when /SiSUv6a_sisu/ then "/srv/www/sisu/#{db_name}" - else '/srv/www/manual/#{db_name}' + when /SiSUv6b_manual/ then "/srv/www/manual/#{db_name}" + when /SiSUv6b_sisu/ then "/srv/www/sisu/#{db_name}" + else '/srv/www/sisu/#{db_name}' end - @dbi="DBI:SQLite3:#{db_sqlite}" #sqlite3 ? - @conn=DBI.connect(@dbi) + @conn=SQLite3::Database.new(db_sqlite) + @conn.results_as_hash=true search_field=cgi['find'] if cgi['find'] # =~/\S+/ @search_for=SearchRequest.new(search_field,q) #.analyze #% search_for #% searches -- cgit v1.2.3