def execute_query(self, statement):
    results = self.get_connection().fetch_all(statement.text)
    query_type = statement.s_type.query_type
    vals = []
    for (ri, row) in enumerate(results):
        for (i, v) in enumerate(row):
            if isinstance(v, NoneType):
                vals.append('NULL')
                continue
            if (query_type[i] == 'I'):
                if (not isinstance(v, int)):
                    log.error('Expected int, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            elif ((query_type[i] == 'F') or (query_type[i] == 'R')):
                if (not isinstance(v, float)):
                    log.error('Expected float, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            elif (query_type[i] == 'T'):
                if (not (isinstance(v, str) or isinstance(v, dict) or isinstance(v, list))):
                    log.error('Expected string, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            elif (query_type[i] == 'B'):
                if (not isinstance(v, bool)):
                    log.error('Expected bool, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            else:
                log.error('Unknown type {} in query {} row {} col {} value {}'.format(query_type[i], statement.text, ri, i, v))
            if isinstance(v, bool):
                v = str(v).lower()
            vals.append(str(v))
    return vals
def execute_query(self, statement):
    results = self.get_connection().fetch_all(statement.text)
    query_type = statement.s_type.query_type
    vals = []
    for (ri, row) in enumerate(results):
        for (i, v) in enumerate(row):
            if isinstance(v, NoneType):
                vals.append('NULL')
                continue
            if (query_type[i] == 'I'):
                if (not isinstance(v, int)):
                    log.error('Expected int, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            elif ((query_type[i] == 'F') or (query_type[i] == 'R')):
                if (not isinstance(v, float)):
                    log.error('Expected float, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            elif (query_type[i] == 'T'):
                if (not (isinstance(v, str) or isinstance(v, dict) or isinstance(v, list))):
                    log.error('Expected string, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            elif (query_type[i] == 'B'):
                if (not isinstance(v, bool)):
                    log.error('Expected bool, got type {} in query {} row {} col {} value {}'.format(type(v), statement.text, ri, i, v))
            else:
                log.error('Unknown type {} in query {} row {} col {} value {}'.format(query_type[i], statement.text, ri, i, v))
            if isinstance(v, bool):
                v = str(v).lower()
            vals.append(str(v))
    return vals