'Sniff out identifier case sensitivity.
Cached per-connection. This value can not change without a server
restart.'

def _detect_casing(self, connection):

    charset = self._connection_charset
    row = self._compat_first(connection.execute("SHOW    VARIABLES    LIKE    'lower_case_table_names'"), charset=charset)
    if (not row):
        cs = 0
    elif (row[1] == 'OFF'):
        cs = 0
    elif (row[1] == 'ON'):
        cs = 1
    else:
        cs = int(row[1])
    return cs
