(query)
return retVal
Switch all SQL statement (alike) keywords to upper case
Switch all SQL statement (alike) keywords to upper case
Switch all SQL statement ( alike ) keywords to upper case
def cleanQuery(query):
    """
    Switch all SQL statement (alike) keywords to upper case
    """

    retVal = query

    for sqlStatements in SQL_STATEMENTS.values():
        for sqlStatement in sqlStatements:
            sqlStatementEsc = sqlStatement.replace("(", "\\(")
            queryMatch = re.search("(%s)" % sqlStatementEsc, query, re.I)

            if queryMatch and "sys_exec" not in query:
                retVal = retVal.replace(queryMatch.group(1), sqlStatement.upper())

    return retVal
def cleanQuery ( query ) : retVal = query for sqlStatements in SQL_STATEMENTS . values ( ) : for sqlStatement in sqlStatements : sqlStatementEsc = sqlStatement . replace ( "(" , "\\(" ) queryMatch = re . search ( "(%s)" % sqlStatementEsc , query , re . I ) if queryMatch and "sys_exec" not in query : retVal = retVal . replace ( queryMatch . group ( 1 ) , sqlStatement . upper ( ) ) return retVal