コード例 #1
0
ファイル: persistence.py プロジェクト: yoku0825/mikasafabric
    def exec_stmt(self, stmt_str, options=None):
        """Execute statements against the server.

        If a new transaction is about to be started, this method checks whether
        the connection is valid or not. If the connection is invalid, it tries
        to restablish it as MySQL might disconnect inactive connections.

        See :meth:`~mysql.fabric.server_utils.exec_stmt`.
        """
        while True:
            if self.__check_connection and \
                not is_valid_mysql_connection(self.__cnx):
                self._try_to_fix_connection()
            return exec_mysql_stmt(self.__cnx, stmt_str, options)
コード例 #2
0
    def exec_stmt(self, stmt_str, options=None):
        """Execute statements against the server.

        If a new transaction is about to be started, this method checks whether
        the connection is valid or not. If the connection is invalid, it tries
        to restablish it as MySQL might disconnect inactive connections.

        See :meth:`~mysql.fabric.server_utils.exec_stmt`.
        """
        while True:
            if self.__check_connection and \
                not is_valid_mysql_connection(self.__cnx):
                self._try_to_fix_connection()
            return exec_mysql_stmt(
                self.__cnx, stmt_str, options
            )