aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v2/cgi_pgsql.rb8
-rw-r--r--lib/sisu/v2/cgi_sqlite.rb10
-rw-r--r--lib/sisu/v3/cgi_pgsql.rb10
-rw-r--r--lib/sisu/v3/cgi_sql_common.rb20
-rw-r--r--lib/sisu/v3/cgi_sqlite.rb12
5 files changed, 30 insertions, 30 deletions
diff --git a/lib/sisu/v2/cgi_pgsql.rb b/lib/sisu/v2/cgi_pgsql.rb
index 416a7d88..2cac69f6 100644
--- a/lib/sisu/v2/cgi_pgsql.rb
+++ b/lib/sisu/v2/cgi_pgsql.rb
@@ -172,11 +172,11 @@ module SiSU_CGI_pgsql
def search_query1
<<-'WOK_SQL'
@search_text,@search_endnotes=[],[]
- search[:text].each{|x| @search_text << "#{x} AND " }
- @search_text=@search_text.join.gsub!(/AND\s+$/,'') #watch
+ search[:text].flatten.each {|x| @search_text << "#{x} AND " }
+ @search_text=@search_text.join.gsub!(/AND\s+$/m,'') #watch
@search_text.gsub!(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
- search[:endnotes].each{|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') #watch
+ search[:endnotes].flatten.each{|x| @search_endnotes << "#{x} AND " }
+ @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/m,'') #watch
@search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
end
WOK_SQL
diff --git a/lib/sisu/v2/cgi_sqlite.rb b/lib/sisu/v2/cgi_sqlite.rb
index d7e131d3..8ef65015 100644
--- a/lib/sisu/v2/cgi_sqlite.rb
+++ b/lib/sisu/v2/cgi_sqlite.rb
@@ -163,12 +163,12 @@ module SiSU_CGI_sqlite
def search_query1
<<-'WOK_SQL'
@search_text,@search_endnotes=[],[]
- search[:text].each{|x| @search_text << "#{x} AND " }
- @search_text=@search_text.join.gsub!(/AND\s+$/,'')
+ search[:text].flatten.each{|x| @search_text << "#{x} AND " }
+ @search_text=@search_text.join.gsub!(/AND\s+$/m,'')
@search_text.gsub!(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
- search[:endnotes].each{|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'')
- @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
+ search[:endnotes].flatten.each{|x| @search_endnotes << "#{x} AND " }
+ @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/m,'')
+ @search_endnotes.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
end
WOK_SQL
end
diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb
index 3821f402..48211068 100644
--- a/lib/sisu/v3/cgi_pgsql.rb
+++ b/lib/sisu/v3/cgi_pgsql.rb
@@ -171,12 +171,12 @@ module SiSU_CGI_pgsql
end
def search_query1
<<-'WOK_SQL'
- @search_text,@search_endnotes=[],[]
- search[:text].each {|x| @search_text << "#{x} AND " }
- @search_text=@search_text.join.gsub!(/AND\s+$/,'') #watch
+ @search_text,@search_endnotes='',''
+ search[:text].flatten.each {|x| @search_text << "#{x} AND " }
+ @search_text=@search_text.gsub!(/AND\s+$/m,'') #watch
@search_text.gsub!(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
- search[:endnotes].each {|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') #watch
+ search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " }
+ @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'') #watch
@search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
end
WOK_SQL
diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb
index 0ca9dca2..924b1533 100644
--- a/lib/sisu/v3/cgi_sql_common.rb
+++ b/lib/sisu/v3/cgi_sql_common.rb
@@ -299,9 +299,9 @@ module SiSU_CGI_sql
end
def text_to_match(identifier='')
m={
- :string => /#{identifier}\s*(.+?)/,
- :string => /#{identifier}\s*(.+?)(?:;|\n|\r|$)/,
- :word => /#{identifier}[\s(]*(\S+)/
+ string: /#{identifier}\s*(.+?)/,
+ string: /#{identifier}\s*(.+?)(?:;|\n|\r|$)/,
+ word: /#{identifier}[\s(]*(\S+)/
}
search_string=if @search_field =~m[:word]
search_string=if @search_field =~m[:braces]; m[:braces].match(@search_field)[1]
@@ -328,10 +328,10 @@ module SiSU_CGI_sql
def initialize(conn,search_for,q,c)
@conn=conn
@text_search_flag=false
- @sql_statement={ :body=>'',:endnotes=>'',:range=>'' }
+ @sql_statement={ body: '', endnotes: '',range: '' }
#@offset||=@@offset
#@offset+=@@limit
- search={ :text => [],:endnotes => [] }
+ search={ text: [], endnotes: [] }
cse=(c =~/\S/) ? true : false
st=Dbi_search_string.new('doc_objects.clean',search_for.text1,q['s1'],cse).string
se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1'],cse).string
@@ -645,7 +645,7 @@ module SiSU_CGI_sql
@counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','',''
FCGI.each_cgi do |cgi|
begin # all code goes in begin section
- @search={ :text => [],:endnotes => [] }
+ @search={ text: [], endnotes: [] }
q=CGI.new
@db=if cgi['db'] =~/\S+/;
@stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1]
@@ -656,13 +656,13 @@ module SiSU_CGI_sql
end
checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','',''
result_type=(cgi['view']=~/text/) \
- ? result_type={:index=>'',:text=>'checked'} \
- : result_type={:index=>'checked',:text=>''}
+ ? result_type={ index: '', text: 'checked'} \
+ : result_type={ index: 'checked', text: ''}
@@limit=if cgi['sql_match_limit'].to_s=~/2500/
- checked_sql_limit={:l1000=>'',:l2500=>'checked'}
+ checked_sql_limit={ l1000: '', l2500: 'checked'}
'2500'
else
- checked_sql_limit={:l1000=>'checked',:l2500=>''}
+ checked_sql_limit={ l1000: 'checked', l2500: ''}
'1000'
end
checked_echo='checked' if cgi['echo'] =~/\S/
diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb
index 7251c81a..5a415b0d 100644
--- a/lib/sisu/v3/cgi_sqlite.rb
+++ b/lib/sisu/v3/cgi_sqlite.rb
@@ -162,13 +162,13 @@ module SiSU_CGI_sqlite
end
def search_query1
<<-'WOK_SQL'
- @search_text,@search_endnotes=[],[]
- search[:text].each {|x| @search_text << "#{x} AND " }
- @search_text=@search_text.join.gsub!(/AND\s+$/,'')
+ @search_text,@search_endnotes='',''
+ search[:text].flatten.each {|x| @search_text << "#{x} AND " }
+ @search_text=@search_text.gsub!(/AND\s+$/m,'')
@search_text.gsub!(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
- search[:endnotes].each {|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'')
- @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
+ search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " }
+ @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'')
+ @search_endnotes.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
end
WOK_SQL
end