def get_sample_results(cls):
read = """QUERY - 'SELECT "auth_user"."id" FROM "auth_group"'""" \
"""- PARAMS = ()"""
write = """QUERY - 'UPDATE "auth_group" SET "name" = %s'""" \
"""- PARAMS = ('bar',)"""
other = """QUERY - 'BEGIN TRANSACTION' - PARAMS = ()"""
def to_query(sql):
return {'sql': sql, 'time': '%.3f' % random.random()}
def to_single_result(*sqls):
qc = cls()
qc.queries = [to_query(sql) for sql in sqls]
return qc.get_results_to_send()
return [
to_single_result(*sqls)
for sqls in [
[read], [read, write], [read, read], [write, write],
[other, other], [read, write, other]
]
]
评论列表
文章目录