当前位置: 首页>>代码示例>>Python>>正文


Python Flavor.get方法代码示例

本文整理汇总了Python中sql.Flavor.get方法的典型用法代码示例。如果您正苦于以下问题:Python Flavor.get方法的具体用法?Python Flavor.get怎么用?Python Flavor.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql.Flavor的用法示例。


在下文中一共展示了Flavor.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __str__

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
    def __str__(self):
        Mapping = Flavor.get().function_mapping.get(self.__class__)
        if Mapping:
            return str(Mapping(*self.args))
        param = Flavor.get().param

        def format(arg):
            if isinstance(arg, basestring):
                return param
            else:
                return str(arg)
        return self._function + '(' + ', '.join(map(format, self.args)) + ')'
开发者ID:zilberstein,项目名称:visit_counter,代码行数:14,代码来源:functions.py

示例2: __str__

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
    def __str__(self):
        Mapping = Flavor.get().function_mapping.get(self.__class__)
        if Mapping:
            return str(Mapping(self.string, self.position, self.characters))
        param = Flavor.get().param

        def format(arg):
            if isinstance(arg, basestring):
                return param
            else:
                return str(arg)

        return self._function + "(%s %s FROM %s)" % (self.position, format(self.characters), format(self.string))
开发者ID:ernestoluisrojas,项目名称:ShnergleServer,代码行数:15,代码来源:functions.py

示例3: __str__

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def __str__(self):
     flavor = Flavor.get()
     Mapping = flavor.function_mapping.get(self.__class__)
     if Mapping:
         return str(Mapping(self.field, self.zone))
     param = flavor.param
     return str(self.field) + " AT TIME ZONE " + param
开发者ID:Shoreray,项目名称:bss_final,代码行数:9,代码来源:functions.py

示例4: test_select_union_flavor

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def test_select_union_flavor(self):
     flavor = Flavor.get()
     prev = flavor.quote_character
     flavor.quote_character = '`'
     self._test_select_union_quote('`')
     flavor.quote_character = prev
     Flavor.set(flavor)
开发者ID:jiaxiaolei,项目名称:python-sql,代码行数:9,代码来源:test_select.py

示例5: _format

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def _format(self, operand, param=None):
     if param is None:
         param = Flavor.get().param
     if isinstance(operand, Expression):
         return str(operand)
     elif isinstance(operand, (Select, CombiningQuery)):
         return '(' + operand + ')'
         # return '(%s)' % operand
     elif isinstance(operand, (list, tuple)):
         subStrings = []
         for o in operand:
             subStrings.append(self._format(o, param))
         joinedString = ""
         for joiningIndex in range(len(subStrings)):
             joinedString = joinedString + subStrings[joiningIndex]
             if joiningIndex != len(subStrings) - 1:
                 joinedString = joinedString + ", "
         return '(' + joinedString + ')'
     elif isinstance(operand, array):
         subStrings = (param,) * len(operand)
         joinedString = ""
         for joiningIndex in range(len(subStrings)):
             joinedString = joinedString + subStrings[joiningIndex]
             if joiningIndex != len(subStrings) - 1:
                 joinedString = joinedString + ", "
         return '(' + joinedString + ')'
     else:
         return param
开发者ID:Shoreray,项目名称:bss_final,代码行数:30,代码来源:operators.py

示例6: __str__

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def __str__(self):
     Mapping = Flavor.get().function_mapping.get(self.__class__)
     if Mapping:
         return str(Mapping(*self.args))
     return (self._function + '('
         + ' '.join(chain(*zip(
                     self._keywords,
                     map(self._format, self.args))))[1:]
         + ')')
开发者ID:michaelfarrell76,项目名称:ExpertmentPlanner2,代码行数:11,代码来源:functions.py

示例7: __str__

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
    def __str__(self):
        param = Flavor.get().param

        def format(value):
            if isinstance(value, basestring):
                return param
            else:
                return str(value)
        return (self._conditional
            + '(' + ', '.join(map(format, self.values)) + ')')
开发者ID:zilberstein,项目名称:visit_counter,代码行数:12,代码来源:conditionals.py

示例8: _format

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def _format(self, operand):
     param = Flavor.get().param
     if isinstance(operand, Expression):
         return str(operand)
     elif isinstance(operand, (Select, CombiningQuery)):
         return '(%s)' % operand
     elif isinstance(operand, (list, tuple)):
         return '(' + ', '.join(self._format(o) for o in operand) + ')'
     else:
         return param
开发者ID:ernestoluisrojas,项目名称:ShnergleServer,代码行数:12,代码来源:operators.py

示例9: params

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def params(self):
     Mapping = Flavor.get().function_mapping.get(self.__class__)
     if Mapping:
         return Mapping(self.string, self.position, self.characters).params
     p = []
     for arg in (self.characters, self.string):
         if isinstance(arg, basestring):
             p.append(arg)
         elif hasattr(arg, 'params'):
             p.extend(arg.params)
     return tuple(p)
开发者ID:Shoreray,项目名称:bss_final,代码行数:13,代码来源:functions.py

示例10: create_sql_sequence

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def create_sql_sequence(self, number_next=None):
     'Create the SQL sequence'
     cursor = Transaction().connection.cursor()
     param = Flavor.get().param
     if self.type != 'incremental':
         return
     if number_next is None:
         number_next = self.number_next
     cursor.execute('CREATE SEQUENCE "' + self._sql_sequence_name
         + '" INCREMENT BY ' + param + ' START WITH ' + param,
         (self.number_increment, number_next))
开发者ID:coopengo,项目名称:trytond,代码行数:13,代码来源:sequence.py

示例11: params

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def params(self):
     Mapping = Flavor.get().function_mapping.get(self.__class__)
     if Mapping:
         return Mapping(*self.args).params
     p = ()
     for arg in (self.characters, self.string):
         if isinstance(arg, basestring):
             p += (arg,)
         elif hasattr(arg, "params"):
             p += arg.params
     return p
开发者ID:ernestoluisrojas,项目名称:ShnergleServer,代码行数:13,代码来源:functions.py

示例12: _format

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def _format(operand):
     param = Flavor.get().param
     if isinstance(operand, Column):
         return str(operand)
     elif isinstance(operand, Select):
         return '(%s)' % operand
     elif isinstance(operand, (list, tuple)):
         return '(' + ', '.join((param,) * len(operand)) + ')'
     elif operand is None:
         return ''
     else:
         return param
开发者ID:zilberstein,项目名称:visit_counter,代码行数:14,代码来源:operators.py

示例13: _format

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def _format(self, operand, param=None):
     if param is None:
         param = Flavor.get().param
     if isinstance(operand, Expression):
         return str(operand)
     elif isinstance(operand, (Select, CombiningQuery)):
         return "(%s)" % operand
     elif isinstance(operand, (list, tuple)):
         return "(" + ", ".join(self._format(o, param) for o in operand) + ")"
     elif isinstance(operand, array):
         return "(" + ", ".join((param,) * len(operand)) + ")"
     else:
         return param
开发者ID:tcard,项目名称:python-sql,代码行数:15,代码来源:operators.py

示例14: update_sql_sequence

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def update_sql_sequence(self, number_next=None):
     'Update the SQL sequence'
     TableHandler = backend.get('TableHandler')
     cursor = Transaction().connection.cursor()
     param = Flavor.get().param
     exist = TableHandler.sequence_exist(self._sql_sequence_name)
     if self.type != 'incremental':
         if exist:
             self.delete_sql_sequence()
         return
     if not exist:
         self.create_sql_sequence(number_next)
         return
     if number_next is None:
         number_next = self.number_next
     cursor.execute('ALTER SEQUENCE "' + self._sql_sequence_name
         + '" INCREMENT BY ' + param + ' RESTART WITH ' + param,
         (self.number_increment, number_next))
开发者ID:coopengo,项目名称:trytond,代码行数:20,代码来源:sequence.py

示例15: _operands

# 需要导入模块: from sql import Flavor [as 别名]
# 或者: from sql.Flavor import get [as 别名]
 def _operands(self):
     operands = super(ILike, self)._operands
     if not Flavor.get().ilike:
         from .functions import Upper
         operands = tuple(Upper(o) for o in operands)
     return operands
开发者ID:jefurry,项目名称:python-sql,代码行数:8,代码来源:operators.py


注:本文中的sql.Flavor.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。