helpers/dataminer_helpers.rb
# Remove artifacts from old dataminer WHERE clause specifications.
#
# @param sql [String] the sql to be cleaned.
# @return [String] the sql with +paramname={paramname}+ artifacts removed.
Remove artifacts from old dataminer WHERE clause specifications.
Remove artifacts from old dataminer WHERE clause specifications .
def clean_where(sql)
    rems = sql.scan(/\{(.+?)\}/).flatten.map { |s| "#{s}={#{s}}" }
    rems.each { |r| sql.gsub!(/and\s+#{r}/i, '') }
    rems.each { |r| sql.gsub!(r, '') }
    sql.sub!(/where\s*\(\s+\)/i, '')
    sql
  end
def clean_where ( sql ) rems = sql . scan ( / \{ (.+?) \} / ) . flatten . map { | s | "#{s}={#{s}}" } rems . each { | r | sql . gsub! ( / and \s + #{ r } /i , '' ) } rems . each { | r | sql . gsub! ( r , '' ) } sql . sub! ( / where \s * \( \s + \) /i , '' ) sql end
Remove artifacts from old dataminer WHERE clause specifications.
Remove artifacts from old dataminer WHERE clause specifications .
the sql with +paramname={paramname}+ artifacts removed.
the sql with + paramname = { paramname } + artifacts removed .
String
sql
the sql to be cleaned.
the sql to be cleaned .