Module: NOne::Query

Defined in:
lib/n_one/query.rb

Overview

Abstract SQL fingerprinting

Class Method Summary collapse

Class Method Details

.fingerprint(query) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/n_one/query.rb', line 10

def fingerprint(query)
  raise 'MySQL is not supported' if ActiveRecord::Base.connection.adapter_name.downcase.include?('mysql')

  begin
    PgQuery.fingerprint(query)
  rescue PgQuery::ParseError
    nil
  end
end