Example #1
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)
Example #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
            )