#NEWLINE# def patch_CursorWrapper_execute( ) : #NEWLINE# #INDENT# if getattr ( CursorWrapper , '_has_django_mysql_execute' , False ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# orig_execute = CursorWrapper . execute #NEWLINE# @ functools . wraps ( orig_execute ) #NEWLINE# def execute( self , sql , args = None ) : #NEWLINE# #INDENT# if ( getattr ( settings , 'DJANGO_MYSQL_REWRITE_QUERIES' , False ) and ( REWRITE_MARKER in sql ) ) : #NEWLINE# #INDENT# sql = rewrite_query ( sql ) #NEWLINE# #UNINDENT# return orig_execute ( self , sql , args ) #NEWLINE# #UNINDENT# CursorWrapper . execute = orig_execute #NEWLINE# CursorWrapper . _has_django_mysql_execute = True