protected function isQueryType($sql, $type)
    {
        if (!preg_match('/^(?<operation>\w+)\b/', $sql, $matches)) {
            return false;
        }
        $operation = $matches['operation'];
        if (is_array($type)) {
            return in_array(strtolower($operation), $type);
        } else {
            return strcasecmp($sql, $type) === 0;
        }
    }