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


Python Server.disconnect方法代碼示例

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


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

示例1: check_audit_log

# 需要導入模塊: from mysql.utilities.common.server import Server [as 別名]
# 或者: from mysql.utilities.common.server.Server import disconnect [as 別名]
    def check_audit_log(self):
        """Verify if the audit log plugin is installed on the server.
        Return the message error if not, or None.
        """
        error = None
        server = Server({'conn_info': self.options.get("server_vals", None)})
        server.connect()
        # Check to see if the plug-in is installed
        if not server.supports_plugin("audit"):
            error = "The audit log plug-in is not installed on this " + \
                    "server or is not enabled."
        server.disconnect()

        return error
開發者ID:abooitt,項目名稱:mysql-utilities,代碼行數:16,代碼來源:audit_log.py

示例2: show_options

# 需要導入模塊: from mysql.utilities.common.server import Server [as 別名]
# 或者: from mysql.utilities.common.server.Server import disconnect [as 別名]
 def show_options(self):
     """ Show all audit log variables.
     """
     server = Server({'conn_info': self.options.get("server_vals", None)})
     server.connect()
     rows = server.show_server_variable("audit%")
     server.disconnect()
     if rows:
         print "#\n# Audit Log Variables and Options\n#"
         print_list(sys.stdout, "GRID", ['Variable_name', 'Value'],
                    rows)
         print
     else:
         raise UtilError("No audit log variables found.")
開發者ID:abooitt,項目名稱:mysql-utilities,代碼行數:16,代碼來源:audit_log.py

示例3: do_command

# 需要導入模塊: from mysql.utilities.common.server import Server [as 別名]
# 或者: from mysql.utilities.common.server.Server import disconnect [as 別名]
    def do_command(self):
        """ Check and execute the audit log command (previously set by the the
        options of the object constructor).
        """
        # Check for valid command
        command = self.options.get("command", None)
        if not command in VALID_COMMANDS:
            raise UtilError("Invalid command.")

        command_value = self.options.get("value", None)
        # Check for valid value if needed
        if (command_requires_value(command)
           and not check_command_value(command, command_value)):
            raise UtilError("Please provide the correct value for the %s "
                            "command." % command)

        # Copy command does not need the server
        if command == "COPY":
            self._copy_log()
            return True

        # Connect to server
        server = Server({'conn_info': self.options.get("server_vals", None)})
        server.connect()

        # Now execute the command
        print "#\n# Executing %s command.\n#\n" % command
        try:
            if command == "POLICY":
                server.exec_query("SET @@GLOBAL.audit_log_policy = %s" %
                                  command_value)
            elif command == "ROTATE":
                self._rotate_log(server)
            else:  # "ROTATE_ON_SIZE":
                server.exec_query("SET @@GLOBAL.audit_log_rotate_on_size = %s"
                                  % command_value)
        finally:
            server.disconnect()

        return True
開發者ID:akhan786,項目名稱:LaunchDevelopment,代碼行數:42,代碼來源:audit_log.py


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