コード例 #1
0
ファイル: sql.py プロジェクト: fm4d/python-sqlpuzzle
 def reference(cls, value):
     """
     Convert as reference on column.
     table => "table"
     table.column => "table"."column"
     db.table.column => "db"."table"."column"
     table."col.umn" => "table"."col.umn"
     "table"."col.umn" => "table"."col.umn"
     """
     from sqlpuzzle._common.utils import force_text
     value = force_text(value)
     parts = re.split('%(quote)s([^%(quote)s]+)%(quote)s|\.' % {'quote': cls._reference_quote}, value)
     parts = (six.u('%(quote)s%(i)s%(quote)s') % {'quote': cls._reference_quote, 'i': i} if i != '*' else i for i in parts if i)
     return six.u('.').join(parts)
コード例 #2
0
 def reference(cls, value):
     """
     Convert as reference on column.
     table => "table"
     table.column => "table"."column"
     db.table.column => "db"."table"."column"
     table."col.umn" => "table"."col.umn"
     "table"."col.umn" => "table"."col.umn"
     """
     from sqlpuzzle._common.utils import force_text
     value = force_text(value)
     parts = re.split(r'{quote}([^{quote}]+){quote}|\.'.format(quote=cls.reference_quote), value)
     parts = ('{quote}{i}{quote}'.format(quote=cls.reference_quote, i=i) if i != '*' else i for i in parts if i)
     return '.'.join(parts)
コード例 #3
0
 def reference(cls, value):
     """
     Convert as reference on column.
     table => "table"
     table.column => "table"."column"
     db.table.column => "db"."table"."column"
     table."col.umn" => "table"."col.umn"
     "table"."col.umn" => "table"."col.umn"
     """
     from sqlpuzzle._common.utils import force_text
     value = force_text(value)
     parts = re.split(
         '%(quote)s([^%(quote)s]+)%(quote)s|\.' %
         {'quote': cls._reference_quote}, value)
     parts = (six.u('%(quote)s%(i)s%(quote)s') % {
         'quote': cls._reference_quote,
         'i': i
     } if i != '*' else i for i in parts if i)
     return six.u('.').join(parts)
コード例 #4
0
 def __str__(self):
     return '"{} {}"'.format(
         self._string_representation,
         force_text(self._value),
     )
コード例 #5
0
 def __str__(self):
     return '"%s %s"' % (
         self._string_representation,
         force_text(self._value),
     )
コード例 #6
0
 def __str__(self):
     return '"{} {}"'.format(
         self._string_representation,
         force_text(self._value),
     )