本文整理汇总了Python中enarksh.DataLayer.DataLayer.execute_rows方法的典型用法代码示例。如果您正苦于以下问题:Python DataLayer.execute_rows方法的具体用法?Python DataLayer.execute_rows怎么用?Python DataLayer.execute_rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enarksh.DataLayer.DataLayer
的用法示例。
在下文中一共展示了DataLayer.execute_rows方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _drop_views
# 需要导入模块: from enarksh.DataLayer import DataLayer [as 别名]
# 或者: from enarksh.DataLayer.DataLayer import execute_rows [as 别名]
def _drop_views():
"""
Drops all views form the databases.
"""
rows = DataLayer.execute_rows('SELECT TABLE_NAME table_name '
'FROM information_schema.TABLES '
'WHERE TABLE_SCHEMA = database() '
'AND TABLE_TYPE = "VIEW" '
'ORDER BY table_name')
for row in rows:
print('Dropping view %s' % row['table_name'])
DataLayer.execute_none('drop view %s' % row['table_name'])
示例2: _drop_routines
# 需要导入模块: from enarksh.DataLayer import DataLayer [as 别名]
# 或者: from enarksh.DataLayer.DataLayer import execute_rows [as 别名]
def _drop_routines():
"""
Drops all stored routines form the databases.
"""
rows = DataLayer.execute_rows('select ROUTINE_TYPE routine_type '
', ROUTINE_NAME routine_name '
'from information_schema.ROUTINES '
'where ROUTINE_SCHEMA = database() '
'and ROUTINE_TYPE = "PROCEDURE" '
'order by ROUTINE_NAME')
for row in rows:
print('Dropping %s %s' % (row['routine_type'], row['routine_name']))
DataLayer.execute_none('drop %s %s' % (row['routine_type'], row['routine_name']))
示例3: _drop_tables
# 需要导入模块: from enarksh.DataLayer import DataLayer [as 别名]
# 或者: from enarksh.DataLayer.DataLayer import execute_rows [as 别名]
def _drop_tables():
"""
Drops all tables form the databases.
"""
DataLayer.execute_none('set foreign_key_checks = off')
rows = DataLayer.execute_rows('SELECT TABLE_NAME table_name '
'FROM information_schema.TABLES '
'WHERE TABLE_SCHEMA = database() '
'AND TABLE_TYPE = "BASE TABLE" '
'ORDER BY TABLE_NAME')
for row in rows:
print('Dropping table %s' % row['table_name'])
DataLayer.execute_none('drop table %s cascade' % row['table_name'])
DataLayer.execute_none('set foreign_key_checks = on')