sql.py 文件源码

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

项目:flask 作者: bobohope 项目源码 文件源码
def as_string(self, context):
        # is it a connection or cursor?
        if isinstance(context, ext.connection):
            conn = context
        elif isinstance(context, ext.cursor):
            conn = context.connection
        else:
            raise TypeError("context must be a connection or a cursor")

        a = ext.adapt(self._wrapped)
        if hasattr(a, 'prepare'):
            a.prepare(conn)

        rv = a.getquoted()
        if sys.version_info[0] >= 3 and isinstance(rv, bytes):
            rv = rv.decode(ext.encodings[conn.encoding])

        return rv
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号