本文整理匯總了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')