def isBlogExistByTitle(self, title): dao = DaoBaseService() obj = dao.query(SqlConstants.IS_BLOG_EXIST_BY_TITLE % title) num = obj[0][0] if num == 0: return False else: return True
def query_categories(self): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_CATEGORIES_BY_ID % 2) return CommonUtils.query_result_to_categories(obj)
def delete_blog(self, blog_id): dao = DaoBaseService() dao.delete(SqlConstants.DELETE_BLOG % blog_id)
def update_portal_show(self, blog_id): dao = DaoBaseService() dao.update(SqlConstants.UPDATE_PORTAL_SHOW % blog_id)
def update_time_category(self, category_id, next_run_time): dao = DaoBaseService() dao.update(SqlConstants.UPDATE_TIME_CATEGORY % (next_run_time, category_id))
def insert_html_tags(self, parms): dao = DaoBaseService() dao.insert(SqlConstants.INSERT_HTML_TAGS, parms)
def update_time_t_crawler(self, crawler_id, next_run_time): dao = DaoBaseService() dao.update(SqlConstants.UPDATE_TIME_T_CRAWLER % (next_run_time, crawler_id))
def query_tcrawler_by_id(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_TCRAWLER_BY_ID % (id)) return CommonUtils.query_result_to_t_crawler(obj[0])
def query_all_tcrawlers_category(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_ALL_TCRAWLERS_CATEGORY % (id)) return CommonUtils.query_result_to_t_crawlers(obj)
def insert_blog(self, blog): dao = DaoBaseService() parm = (blog._Blog__title, blog._Blog__author, blog._Blog__content, blog._Blog__weight, blog._Blog__url, blog._Blog__category_id) return dao.insert_id(SqlConstants.INSERT_BLOG, parm)
def query_tag_by_id(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_HTML_TAG_BY_ID % id) return CommonUtils.query_result_to_tag(obj[0])
def query_tags_by_crawler_id(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_HTML_TAGS_BY_T_CRAWLER_ID % id) return CommonUtils.query_result_to_tags(obj)
def insert_t_crawler(self, parm): dao = DaoBaseService() return dao.insert_id(SqlConstants.INSERT_T_CRAWLER, parm)
def insert_html_tag(self, parm): dao = DaoBaseService() return dao.insert_id(SqlConstants.INSERT_HTML_TAGS, parm)