dal.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:spc 作者: whbrewer 项目源码 文件源码
def CASE(self,query,t,f):
        def represent(x):
            types = {type(True):'boolean',type(0):'integer',type(1.0):'double'}
            if x is None: return 'NULL'
            elif isinstance(x,Expression): return str(x)
            else: return self.represent(x,types.get(type(x),'string'))
        return Expression(self.db,'CASE WHEN %s THEN %s ELSE %s END' % \
                              (self.expand(query),represent(t),represent(f)))

###################################################################################
# List of all the available adapters; they all extend BaseAdapter.
###################################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号