本文整理汇总了Python中oasis.lib.DB.run_sql方法的典型用法代码示例。如果您正苦于以下问题:Python DB.run_sql方法的具体用法?Python DB.run_sql怎么用?Python DB.run_sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.DB
的用法示例。
在下文中一共展示了DB.run_sql方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: teardown
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import run_sql [as 别名]
def teardown():
"""
Remove testing configuration file and otherwise clean up.
"""
with open(os.path.join(OaConfig.homedir, "sql", "eraseexisting.sql")) as f:
sql = f.read()
print "Removing tables."
DB.run_sql(sql)
示例2: setup
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import run_sql [as 别名]
def setup():
""" Prepare database for testing.
"""
if not DB.check_safe():
print "Attempt to erase database with data."
sys.exit(-1)
with open(os.path.join(OaConfig.homedir, "sql", "eraseexisting.sql")) as f:
sql = f.read()
print "Removing existing tables."
DB.run_sql(sql)
with open(os.path.join(OaConfig.homedir, "sql", "emptyschema_396.sql")) as f:
sql = f.read()
DB.run_sql(sql)
print "Installed v3.9.6 table structure."
示例3: setup
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import run_sql [as 别名]
def setup():
""" Prepare database and configuration file for testing
"""
# Switch us to use a test database
test_config = """
"""
f = open(TESTINI, "w")
f.write(test_config)
f.close()
global DB
from oasis.lib import DB # Do this *after* writing the test ini file.
DB.run_sql("SELECT name, value FROM config WHERE name='test_status';")