Esempio n. 1
0
 def __str__(self):
     context = {}
     for key, querypart in self._queryparts.items():
         is_set = getattr(querypart, 'is_set', True)
         if is_set:
             context[key] = ' ' + force_text(querypart)
         else:
             context[key] = ''
     return (self._query_template % context).strip()
Esempio n. 2
0
 def __unicode__(self):
     context = {}
     for key, querypart in six.iteritems(self._queryparts):
         is_set = getattr(querypart, 'is_set', True)
         if is_set:
             context[key] = ' ' + force_text(querypart)
         else:
             context[key] = ''
     return self._query_template % context
Esempio n. 3
0
 def __unicode__(self):
     context = {}
     for key, querypart in six.iteritems(self._queryparts):
         is_set = getattr(querypart, "is_set", True)
         if is_set:
             context[key] = " " + force_text(querypart)
         else:
             context[key] = ""
     return (self._query_template % context).strip()
Esempio n. 4
0
 def __unicode__(self):
     context = {}
     for key, querypart in six.iteritems(self._queryparts):
         is_set = getattr(querypart, 'is_set', True)
         if is_set:
             context[key] = ' ' + force_text(querypart)
         else:
             context[key] = ''
     return self._query_template % context
Esempio n. 5
0
    def __str__(self):
        if self.alias:
            table = '{} AS {}'.format(
                SqlReference(self.table_name),
                SqlReference(self.alias),
            )
        else:
            table = force_text(SqlReference(self.table_name))

        if self._joins:
            self._minimize_joins()
            table += ' ' + ' '.join(
                '{} {}{}'.format(
                    JOIN_TYPES[join['type']],
                    join['table'],
                    ' ON {}'.format(join['ons']) if join['ons'].is_set else '',
                ) for join in self._joins
            )

        return table
Esempio n. 6
0
    def __unicode__(self):
        if self.alias:
            table = six.u('%s AS %s') % (
                SqlReference(self.table_name),
                SqlReference(self.alias),
            )
        else:
            table = force_text(SqlReference(self.table_name))

        if self._joins:
            self._minimize_joins()
            table += six.u(' ') + six.u(' ').join(
                six.u('%s %s%s') % (
                    JOIN_TYPES[join['type']],
                    join['table'],
                    six.u(' ON %s') % join['ons'] if join['ons'].is_set else '',
                ) for join in self._joins
            )

        return table
Esempio n. 7
0
    def __unicode__(self):
        if self.alias:
            table = six.u('%s AS %s') % (
                SqlReference(self.table_name),
                SqlReference(self.alias),
            )
        else:
            table = force_text(SqlReference(self.table_name))

        if self._joins:
            self._minimize_joins()
            table += six.u(' ') + six.u(' ').join(
                six.u('%s %s%s') % (
                    JOIN_TYPES[join['type']],
                    join['table'],
                    six.u(' ON %s') %
                    join['ons'] if join['ons'].is_set else '',
                ) for join in self._joins)

        return table
Esempio n. 8
0
 def has(self, value):
     return has(self, force_text(value).upper())
Esempio n. 9
0
 def has(self, value):
     return has(self, force_text(value).upper())
Esempio n. 10
0
 def __str__(self):
     return self._separator.join(force_text(f) for f in self)
Esempio n. 11
0
def has(part, value):
    value = force_text(value)
    #  If I look for example for "distinct", I don't want to say "hey, there is
    #+ distinct!", if there is actually "distinctrow".
    res = re.search(r'([^\w]|^){}([^\w]|$)'.format(value), str(part))
    return bool(res)
Esempio n. 12
0
def has(part, value):
    value = force_text(value)
    #  If I look for example for "distinct", I don't want to say "hey, there is
    #+ distinct!", if there is actually "distinctrow".
    res = re.search('([^\w]|^)%s([^\w]|$)' % value, six.text_type(part))
    return bool(res)
Esempio n. 13
0
 def __unicode__(self):
     return self._separator.join(force_text(f) for f in self)
Esempio n. 14
0
 def __unicode__(self):
     return self._separator.join(force_text(f) for f in self)
Esempio n. 15
0
def has(part, value):
    value = force_text(value)
    #  If I look for example for "distinct", I don't want to say "hey, there is
    #+ distinct!", if there is actually "distinctrow".
    res = re.search('([^\w]|^)%s([^\w]|$)' % value, six.text_type(part))
    return bool(res)
Esempio n. 16
0
 def _get_expr_as_string(self):
     if isinstance(self.expr, (list, tuple)):
         return six.u(', ').join(force_text(SqlReference(e)) for e in self.expr)
     return SqlReference(self.expr)