'Converts boolean or byte arrays from MySQL Connector/J to longs.'

def result_processor(self, dialect, coltype):

    def process(value):
        if (value is None):
            return value
        if isinstance(value, bool):
            return int(value)
        v = 0
        for i in value:
            v = ((v << 8) | (i & 255))
        value = v
        return value
    return process
