python类sqlite_db()的实例源码

database.py 文件源码 项目:pubchem-ranker 作者: jacobwindsor 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def get_db():
    """Opens a new database connection if there is none yet for the
    current application context.
    """
    if not hasattr(g, 'sqlite_db'):
        g.sqlite_db = connect_db()
    return g.sqlite_db
database.py 文件源码 项目:pubchem-ranker 作者: jacobwindsor 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def close_db(error):
    """Closes the database again at the end of the request."""
    if hasattr(g, 'sqlite_db'):
        g.sqlite_db.close()
model.py 文件源码 项目:sel 作者: tiagoamartins 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_db():
    """
    Opens a new database connection if there is none yet for the
    current application context.
    """
    if not hasattr(g, 'sqlite_db'):
        g.sqlite_db = connect_db()
    return g.sqlite_db
utils.py 文件源码 项目:recon-ng 作者: captainhooligan 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def get_db():
    '''Opens a new database connection if there is none yet for the
    current application context.'''
    if not hasattr(g, 'sqlite_db'):
        g.sqlite_db = connect_db()
        debug('Database connection created.')
    return g.sqlite_db
utils.py 文件源码 项目:recon-ng 作者: captainhooligan 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def close_db(error):
    '''Closes the database again at the end of the request.'''
    if hasattr(g, 'sqlite_db'):
        g.sqlite_db.close()
        debug('Database connection destroyed.')
app.py 文件源码 项目:flask-product-scraper 作者: livgrhm 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def get_db():
    # g is a general purpose variable associated with the current application context
    if not hasattr(g, 'sqlite_db'):
        g.sqlite_db = connect_db()
    return g.sqlite_db

# initialise the db
app.py 文件源码 项目:flask-product-scraper 作者: livgrhm 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def close_db(error):
    """Closes the database again at the end of the request."""
    if hasattr(g, 'sqlite_db'):
        g.sqlite_db.close()
server.py 文件源码 项目:hackenei16 作者: mcasx 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def db_open():
    """Opens a new database connection if there is none yet for the
    current application context.
    """
    if not hasattr(g, 'sqlite_db'):
        g.sqlite_db = db_connect()
    return g.sqlite_db
server.py 文件源码 项目:hackenei16 作者: mcasx 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def close_db(error):
    """Closes the database again at the end of the request."""
    if hasattr(g, 'sqlite_db'):
        g.sqlite_db.close()

################################################################################
# Intersections
################################################################################
__init__.py 文件源码 项目:rmcontrol 作者: ericmagnuson 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def get_db():
    if not hasattr(g, 'sqlite_db'):
        g.sqlite_db = connect_db()
    return g.sqlite_db
__init__.py 文件源码 项目:rmcontrol 作者: ericmagnuson 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def close_db(error):
    if hasattr(g, 'sqlite_db'):
        g.sqlite_db.close()


问题


面经


文章

微信
公众号

扫码关注公众号