lib/influxdb/rails/sql/normalizer.rb in influxdb-rails-1.0.1.beta2 vs lib/influxdb/rails/sql/normalizer.rb in influxdb-rails-1.0.1.beta3
- old
+ new
@@ -6,12 +6,12 @@
@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!(/(\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