本文整理汇总了Python中src.tools.db.DB.query_all方法的典型用法代码示例。如果您正苦于以下问题:Python DB.query_all方法的具体用法?Python DB.query_all怎么用?Python DB.query_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.tools.db.DB
的用法示例。
在下文中一共展示了DB.query_all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query_answer_list_by_question_id
# 需要导入模块: from src.tools.db import DB [as 别名]
# 或者: from src.tools.db.DB import query_all [as 别名]
def query_answer_list_by_question_id(self, question_id):
raw_answer_list = DB.query_all(
u'select * from Answer where question_id="{question_id}" {order_by} '.format(question_id=question_id, order_by=Config.answer_order_by))
answer_list = []
for raw_answer in raw_answer_list:
answer_list.append(self.format_answer(raw_answer))
return answer_list
示例2: query_question_list
# 需要导入模块: from src.tools.db import DB [as 别名]
# 或者: from src.tools.db.DB import query_all [as 别名]
def query_question_list(self, question_id_list):
raw_question_list = DB.query_all(
u'select * from Question where question_id in ({question_id_list})'.format(question_id_list=','.join(question_id_list)))
question_list = []
for raw_question in raw_question_list:
question_list.append(self.format_question(raw_question))
return question_list
示例3: query_article_list_by_column_id
# 需要导入模块: from src.tools.db import DB [as 别名]
# 或者: from src.tools.db.DB import query_all [as 别名]
def query_article_list_by_column_id(self, column_id):
# 根据发表时间正序获取文章列表,方便浏览
raw_article_list = DB.query_all(u'select * from Article where column_id="{column_id}" {order_by}'.format(column_id=column_id, order_by=Config.article_order_by))
article_list = []
for raw_article in raw_article_list:
article = self.format_article(raw_article)
article_list.append(article)
return article_list
示例4: query_answer_list_by_author_page_id
# 需要导入模块: from src.tools.db import DB [as 别名]
# 或者: from src.tools.db.DB import query_all [as 别名]
def query_answer_list_by_author_page_id(self, author_page_id):
# 需要先查出来对应的author_id
author_info = DB.query_row(u'select author_id from Author where author_page_id="{author_page_id}"'.format(author_page_id=author_page_id))
author_id = author_info[u'author_id']
raw_answer_list = DB.query_all(u'select * from Answer where author_id="{author_id}" {order_by} '.format(author_id=author_id, order_by=Config.answer_order_by))
answer_list = []
for raw_answer in raw_answer_list:
answer_list.append(self.format_answer(raw_answer))
return answer_list
示例5: query_answer_list
# 需要导入模块: from src.tools.db import DB [as 别名]
# 或者: from src.tools.db.DB import query_all [as 别名]
def query_answer_list(self, answer_id_list):
raw_answer_list = DB.query_all(u'select * from Answer where answer_id in ({answer_id_list}) {order_by} '.format(answer_id_list=','.join(answer_id_list), order_by=Config.topic_or_collection_answer_order_by))
answer_list = []
for raw_answer in raw_answer_list:
answer_list.append(self.format_answer(raw_answer))
return answer_list