Sha256: 0efec44a424ca9e916b19fc69bbc29bb0e7c211fec105b0526651badaf342c00
Contents?: true
Size: 839 Bytes
Versions: 7
Compression:
Stored size: 839 Bytes
Contents
# encoding: utf-8 require 'ting_yun/support/helper' module TingYun module Instrumentation module Support module Database extend self KNOWN_OPERATIONS = [ 'SELECT', 'UPDATE', 'DELETE', 'INSERT', 'SHOW', 'CALL', 'PRAGMA' ] SQL_COMMENT_REGEX = Regexp.new('/\*.*?\*/', Regexp::MULTILINE).freeze EMPTY_STRING = ''.freeze def parse_operation_from_query(sql) sql =TingYun::Helper.correctly_encoded(sql).gsub(SQL_COMMENT_REGEX, EMPTY_STRING) if sql =~ /(\w+)/ op = $1.upcase if KNOWN_OPERATIONS.include?(op) return op else return "CALL" end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems