Sha256: a4490360b5c8712e57158e4eaa9933d79aaa42836df7212c5f7e5c4fdc6b5107
Contents?: true
Size: 772 Bytes
Versions: 9
Compression:
Stored size: 772 Bytes
Contents
module InfluxDB module Rails module Sql class Normalizer # :nodoc: def initialize(query) @query = query.dup end def perform query.squish! query.gsub!(/(\s(=|>|<|>=|<=|<>|!=)\s)('[^']+'|[\$\+\-\w\.]+)/, '\1xxx') query.gsub!(/(\sIN\s)\([^\(\)]+\)/i, '\1(xxx)') regex = /(\sBETWEEN\s)('[^']+'|[\+\-\w\.]+)(\sAND\s)('[^']+'|[\+\-\w\.]+)/i query.gsub!(regex, '\1xxx\3xxx') query.gsub!(/(\sVALUES\s)\(.+\)/i, '\1(xxx)') query.gsub!(/(\s(LIKE|ILIKE|SIMILAR TO|NOT SIMILAR TO)\s)('[^']+')/i, '\1xxx') query.gsub!(/(\s(LIMIT|OFFSET)\s)(\d+)/i, '\1xxx') query end private attr_reader :query end end end end
Version data entries
9 entries across 9 versions & 3 rubygems