當前位置: 首頁>>代碼示例>>Python>>正文


Python DBManager.execute方法代碼示例

本文整理匯總了Python中DBManager.DBManager.execute方法的典型用法代碼示例。如果您正苦於以下問題:Python DBManager.execute方法的具體用法?Python DBManager.execute怎麽用?Python DBManager.execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBManager.DBManager的用法示例。


在下文中一共展示了DBManager.execute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TracerouteManager

# 需要導入模塊: from DBManager import DBManager [as 別名]
# 或者: from DBManager.DBManager import execute [as 別名]
class TracerouteManager(threading.Thread):
    def __init__(self, request, logger, common):
        super(TracerouteManager, self).__init__()
        self.__request = request  #json request
        self.__raw = ''  #raw result for traceroute
        self.__logger = logger
        self.__common = common
        self.__dbmanager = DBManager(self.__common)

        self.__stop = False

        self.loginfo("Traceroute Manager for " + str(self.__request) + "  started.")


    def loginfo(self, text):
        self.__logger.info("[TRManager][" + str(self.__request["target"]) + "] " + text)

    def logerror(self, text):
        self.__logger.error("[TRManager][" + str(self.__request["target"]) + "] " + text, exc_info=True)

    def logwarn(self, text):
        self.__logger.warning("[TRManager][" + str(self.__request["target"]) + "] " + text)

    def logdebug(self, text):
        self.__logger.debug("[TRManager][" + str(self.__request["target"]) + "] " + text)

    def stopme(self):
        self.loginfo("Stopping.")
        self.__stop = True

    def remove_node(self, vp):
        """ set as unactive a node in case of failure """

        cc = None
        sql = "UPDATE vps SET fails=fails+1 WHERE vp='%s'" % (vp)
        self.logdebug(sql)

        try:
            cc = self.__dbmanager.execute(sql)

        except Exception, ee:
            self.__request['status'] != "failed"
            self.__request['errors'].append(str(ee))
            self.logerror("Failure: " + json.dumps(self.__request))

        finally:
開發者ID:MarchettaPietro,項目名稱:TRAgent,代碼行數:48,代碼來源:TracerouteManager.py


注:本文中的DBManager.DBManager.execute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。