'Only for last_executed_query! Don\'t use this to execute SQL queries!'

def _quote_params_for_last_executed_query(self, params):

    BATCH_SIZE = 999
    if (len(params) > BATCH_SIZE):
        results = ()
        for index in range(0, len(params), BATCH_SIZE):
            chunk = params[index:(index + BATCH_SIZE)]
            results += self._quote_params_for_last_executed_query(chunk)
        return results
    sql = ('SELECT    ' + ',    '.join((['QUOTE(?)'] * len(params))))
    cursor = self.connection.connection.cursor()
    try:
        return cursor.execute(sql, params).fetchone()
    finally:
        cursor.close()
