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 --- lib/sisu/v5/cgi_pgsql.rb | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'lib/sisu/v5/cgi_pgsql.rb') diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 53c73c8d..6c4385e4 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -128,12 +128,9 @@ module SiSU_CGI_PgSQL default database name: #{@cX.green}#{Db[:name_prefix]}#{@name_of[:db]}#{@cX.off} (#{@name_of[:db]}) db user: #{@cX.green}#{@name_of[:user]}#{@cX.off} to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@name_of[:user]}'#{@cX.off} - cgi & db host on: #{@cX.blue}#{@name_of[:host_url_cgi]}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-search='#{@name_of[:host_url_cgi]}'#{@cX.off} - sisu output on: #{@cX.blue}#{@name_of[:host_url_docs]}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-output='#{@name_of[:host_url_docs]}'#{@cX.off} - cgi search form link name: #{@cX.green}#{@name_of[:cgi_script]}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@name_of[:cgi_script]}'#{@cX.off} + to create static cgi & db host use: #{@cX.brown}sisu --db-pg --webserv-search='#{@name_of[:host_url_cgi]}'#{@cX.off} + for static location for sisu output use: #{@cX.brown}sisu --db-pg --webserv-output='#{@name_of[:host_url_docs]}'#{@cX.off} + for static cgi search form link name use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@name_of[:cgi_script]}'#{@cX.off} #{@cX.fuchsia}(settings priority: command line; sisurc.yml; else defaults)#{@cX.off} #{@cX.fuchsia}BASED ON ALREADY EXISTING databases#{@cX.off} (default database name: #{@db.psql.db}) @@ -151,7 +148,7 @@ module SiSU_CGI_PgSQL #{@cX.brown}createdb #{@db.psql.db}#{@cX.off} [for a list of existing databases try 'psql --list']" - now you can use sisu to create the database tables and populate the database with documents + you can use sisu to create the database tables and populate the database with documents sisu --pg --dropall # removes existing postgresql db & tables sisu --pg --createall -v # creates postgresql db & tables @@ -195,9 +192,9 @@ module SiSU_CGI_PgSQL begin require 'cgi' require 'fcgi' - require 'dbi' + require 'pg' rescue LoadError - puts 'cgi, fcgi or dbi NOT FOUND (LoadError)' + puts 'cgi, fcgi or pg NOT FOUND (LoadError)' end @stub_default='#{@name_of[:db]}' @image_src="#{@image_src}" @@ -277,10 +274,10 @@ module SiSU_CGI_PgSQL %{#{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 WOK_SQL @@ -292,8 +289,7 @@ module SiSU_CGI_PgSQL end def dbi_connect <<-'WOK_SQL' - dbi="dbi:Pg:database=#{@db};port=#{@port}" - @conn=DBI.connect(dbi,@user) + @conn=PG::Connection.open(dbname: @db, port: @port, user: @user) WOK_SQL end end -- cgit v1.2.3