def analyze_join_match(self, t1, t2, t1_field, t2_field, t1_filter='1=1', t2_filter='1=1', as_sql=False, as_text=True, lowercase=True):

    def get_kwargs(t1, t2, t1_field, t2_field, t1_filter, t2_filter):
        t1_field_arr = [('t1.' + f) for f in t1_field.split(',')]
        t2_field_arr = [('t2.' + f) for f in t2_field.split(',')]
        t1_field_concat = self._concat_fields(t1_field_arr, as_text=as_text)
        t2_field_concat = self._concat_fields(t2_field_arr, as_text=as_text)
        to_text = self._to_text
        if lowercase:
            conds = ' and '.join(['lower({}) = lower({})'.format(to_text(f), to_text(t2_field_arr[i])) for (i, f) in enumerate(t1_field_arr)])
        else:
            conds = ' and '.join(['{} = {}'.format(to_text(f), to_text(t2_field_arr[i])) for (i, f) in enumerate(t1_field_arr)])
        t1_fields1 = t1_field
        t2_fields1 = t2_field
        t1_field = ', '.join([('t1.' + f) for f in t1_field_arr])
        t2_field = ', '.join([('t2.' + f) for f in t2_field_arr])
        return dict(t1=t1, t1_field=t1_field_concat, t1_fields1=t1_fields1, t1_filter=t1_filter, t2=t2, t2_field=t2_field_concat, t2_fields1=t2_fields1, t2_filter=t2_filter, conds=conds)
    kwargs = get_kwargs(t1=t1, t2=t2, t1_field=t1_field, t2_field=t2_field, t1_filter=t1_filter, t2_filter=t2_filter)
    sql = self.analyze_fields('table_join_match', t1, [''], as_sql=True, **kwargs)
    return (sql if as_sql else self.query(sql, 'table_join_match', echo=False))
def analyze_join_match(self, t1, t2, t1_field, t2_field, t1_filter='1=1', t2_filter='1=1', as_sql=False, as_text=True, lowercase=True):

    def get_kwargs(t1, t2, t1_field, t2_field, t1_filter, t2_filter):
        t1_field_arr = [('t1.' + f) for f in t1_field.split(',')]
        t2_field_arr = [('t2.' + f) for f in t2_field.split(',')]
        t1_field_concat = self._concat_fields(t1_field_arr, as_text=as_text)
        t2_field_concat = self._concat_fields(t2_field_arr, as_text=as_text)
        to_text = self._to_text
        if lowercase:
            conds = ' and '.join(['lower({}) = lower({})'.format(to_text(f), to_text(t2_field_arr[i])) for (i, f) in enumerate(t1_field_arr)])
        else:
            conds = ' and '.join(['{} = {}'.format(to_text(f), to_text(t2_field_arr[i])) for (i, f) in enumerate(t1_field_arr)])
        t1_fields1 = t1_field
        t2_fields1 = t2_field
        t1_field = ', '.join([('t1.' + f) for f in t1_field_arr])
        t2_field = ', '.join([('t2.' + f) for f in t2_field_arr])
        return dict(t1=t1, t1_field=t1_field_concat, t1_fields1=t1_fields1, t1_filter=t1_filter, t2=t2, t2_field=t2_field_concat, t2_fields1=t2_fields1, t2_filter=t2_filter, conds=conds)
    kwargs = get_kwargs(t1=t1, t2=t2, t1_field=t1_field, t2_field=t2_field, t1_filter=t1_filter, t2_filter=t2_filter)
    sql = self.analyze_fields('table_join_match', t1, [], as_sql=True, **kwargs)
    return (sql if as_sql else self.query(sql, 'table_join_match', echo=False))