sql.py 文件源码

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

项目:annotated-py-sqlalchemy 作者: hhstore 项目源码 文件源码
def __init__(self, text = "", engine=None, bindparams=None, typemap=None, escape=True):
        self.parens = False
        self._engine = engine
        self.id = id(self)
        self.bindparams = {}
        self.typemap = typemap
        if typemap is not None:
            for key in typemap.keys():
                typemap[key] = engine.type_descriptor(typemap[key])
        def repl(m):
            self.bindparams[m.group(1)] = bindparam(m.group(1))
            return self.engine.bindtemplate % m.group(1)

        if escape: 
            self.text = re.compile(r':([\w_]+)', re.S).sub(repl, text)
        else:
            self.text = text
        if bindparams is not None:
            for b in bindparams:
                self.bindparams[b.key] = b
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号