示例#1
0
    def redo(self, ignore=[], base_dir=""):
        Container.put("is_undo", True)

        # get some values from transaction log
        timestamp = self.get_value("timestamp")

        ticket = self.get_value("ticket", no_exception=True)
        try:

            xml = self.get_xml_value("transaction")

            nodes = xml.get_nodes("transaction/*")
            for node in nodes:
                node_name = xml.get_node_name(node)
                if node_name == "sobject":
                    xml.set_attribute(node, "timestamp", timestamp)
                    SObjectUndo.redo(node)

                elif node_name == "file" and "file" not in ignore:
                    FileUndo.redo(node, ticket, base_dir=base_dir)
                elif node_name == "table":
                    action = Xml.get_attribute(node, "action")
                    if action == 'drop':
                        TableDropUndo.redo(node)
                    else:
                        TableUndo.redo(node)
                elif node_name == "alter":
                    AlterTableUndo.redo(node)
        finally:
            Container.put("is_undo", False)
    def redo(my, ignore=[], base_dir=""):
        Container.put("is_undo", True)

        # get some values from transaction log
        timestamp = my.get_value("timestamp")


        ticket = my.get_value("ticket", no_exception=True)
        try:

            xml = my.get_xml_value("transaction")

            nodes = xml.get_nodes("transaction/*")
            for node in nodes:
                node_name = xml.get_node_name(node)
                if node_name == "sobject":
                    xml.set_attribute(node, "timestamp", timestamp)
                    SObjectUndo.redo(node)

                elif node_name == "file" and "file" not in ignore:
                    FileUndo.redo(node, ticket, base_dir=base_dir)
                elif node_name == "table":
                    action = Xml.get_attribute(node,"action")
                    if action == 'drop':
                        TableDropUndo.redo(node)
                    else:
                        TableUndo.redo(node)
                elif node_name == "alter":
                    AlterTableUndo.redo(node)
        finally:
            Container.put("is_undo", False)
示例#3
0
    def undo(self, ignore_files=False):
        Container.put("is_undo", True)

        ticket = self.get_value("ticket", no_exception=True)

        try:

            xml = self.get_xml_value("transaction")

            nodes = xml.get_nodes("transaction/*")
            nodes.reverse()

            # if there is an error, report it but do what you can
            for node in nodes:
                node_name = xml.get_node_name(node)
                if node_name == "sobject":
                    SObjectUndo.undo(node)
                elif not ignore_files and node_name == "file":
                    FileUndo.undo(node, ticket)
                elif node_name == "table":
                    action = Xml.get_attribute(node, "action")
                    if action == 'drop':
                        TableDropUndo.undo(node)
                    else:
                        TableUndo.undo(node)

                elif node_name == "alter":
                    AlterTableUndo.undo(node)

        finally:
            Container.put("is_undo", False)
    def undo(my, ignore_files=False):
        Container.put("is_undo", True)

        ticket = my.get_value("ticket", no_exception=True)

        try:

            xml = my.get_xml_value("transaction")

            nodes = xml.get_nodes("transaction/*")
            nodes.reverse()

            # if there is an error, report it but do what you can
            for node in nodes:
                node_name = xml.get_node_name(node)
                if node_name == "sobject":
                    SObjectUndo.undo(node)
                elif not ignore_files and node_name == "file":
                    FileUndo.undo(node, ticket)
                elif node_name == "table":
                    action = Xml.get_attribute(node,"action")
                    if action == 'drop':
                        TableDropUndo.undo(node)
                    else:
                        TableUndo.undo(node)
              
                elif node_name == "alter":
                    AlterTableUndo.undo(node)

        finally:
            Container.put("is_undo", False)