首页 \ 问答 \ 如何在Windows中从Oracle RDB for OpenVMS迁移到MySQL?(How to migrate from Oracle RDB for OpenVMS to MySQL in Windows?)

如何在Windows中从Oracle RDB for OpenVMS迁移到MySQL?(How to migrate from Oracle RDB for OpenVMS to MySQL in Windows?)

我有一个带有RDB数据库的传统Alpha服务器。 这个数据库在MySQL数据库中被复制,其中包含许多错误的PHP脚本,这些脚本会丢弃所有表并从Alpha中获取所有内容。

这工作非常缓慢,并且变得不可维护。 除了再次编程脚本之外,还有更好的方法来解决这个问题吗? 像MySQL Migration Toolkit这样的东西?


I have a legacy Alpha server with a RDB database. This db is replicated in a MySQL db with many bad php scripts that drops all the tables and takes everything from the Alpha.

This works very slow and is becoming unmaintainable. Is there a better way to fix this than programming again the scripts? Anything like MySQL Migration Toolkit?


原文:https://stackoverflow.com/questions/1340913
更新时间:2023-09-16 15:09

最满意答案

同意这两个答案; 您对模板#2的评估将不会被正确处理。

请注意,节点的子节点(即其子节点元素,注释,文本和处理指令,但不包含属性)只有两种方式:

  1. select属性的缺省值是“ node() ”,用于选择子项的XPath,以及
  2. 内置的根节点和元素节点的模板规则是处理子节点。

除了这两方面,在选择要处理的节点时,孩子没有特殊的地位。 你可以选择你想要的任何节点,包括祖先。 你可以按你喜欢的顺序遍历一棵树。 证明这一点的极端方法是编写一个反转文档层次结构的样式表(将其颠倒)。 (您可能想使用另一种模式,以便在处理父节点时调用不同的规则,而不是处理子级时)。

我也想检查并确保你理解“根节点”(XPath / XSLT 2.0中的“文档节点”)和根(或文档) 元素之间的区别。 在您的示例XML中,<person> 不是根节点; 它是最外层的元素 ,它本身就是根节点的子元素 ,XPath / XSLT数据模型中每个树根上的不可见外层容器。

如果你想控制bat的处理权限,你总是可以使用<xsl:template match =“/”>或者(假设源代码树代表格式良好的XML文档而不是片段)<xsl:template match = “/ *”>。 他们是替代方法来做到这一点。 后者的一个特点是,包含匹配=“/”规则的导入代码将更早触发,因为显式模板规则(即使它们具有最低导入优先级)始终优先于内置模板规则。 如果您在导入样式表中没有显式地使用<xsl:template match =“/”>,那么,直到您导入包含它的代码为止,您将依赖内置的根节点模板规则(将模板应用于儿童 - 在这种情况下,将模板应用于<person>元素子元素)。

在这个例子中,另一种控制蝙蝠控制的方法是使用match =“/ person”。 这样的规则可以匹配任何<person>元素,只要它是根节点的子元素。 如果XML没有<person>作为它的最外层元素,那么它将不会被调用。 如果你还有<xsl:template match =“/”,那么它会首先被调用; match =“/ person”(或match =“/ *”)只会在match =“/”规则明确将模板应用于子级时调用。


Agreed to both answers so far; your assessment that Template #2 won't get processed as such is exactly right.

Note that a node's children (i.e. its child elements, comments, text, and processing instructions, but not attributes) are only special in two ways:

  1. The default value of the select attribute is "node()", the XPath for selecting children, and
  2. The built-in template rules for root nodes and element nodes is to process children.

Other than in those two respects, children have no special status when it comes to selecting nodes to process. You can select whatever nodes you want, including ancestors. You can traverse a tree in any order you like. An extreme way to demonstrate this would be to write a stylesheet that reverses the hierarchy of a document (turns it upside down). (You'd probably want to use another mode so that a different rule is invoked when parent nodes are processed than when children are processed.)

I also want to check and make sure you understand the distinction between the "root node" (renamed the "document node" in XPath/XSLT 2.0) and the root (or document) element. In your example XML, <person> is not the root node; it's the outermost element, which itself is a child of the root node, the invisible outer container at the root of every tree in the XPath/XSLT data model.

If you want to take control of processing right of the bat, you can always use <xsl:template match="/"> or (assuming the source tree represents a well-formed XML document and not a fragment) <xsl:template match="/*">. They're alternative ways to do it. One feature of the latter is that imported code that includes a rule for match="/" would be triggered earlier, since explicit template rules (even if they have the lowest import precedence) always take precedence over built-in template rules. If you don't explicitly have <xsl:template match="/"> in the importing stylesheet, then, until you import code that has it, you're relying on the built-in template rule for root nodes (apply templates to children--in this case, apply templates to the <person> element child).

An alternative way to take control off the bat, for this example, would be to use match="/person". Such a rule would match any <person> element, provided that it's the child of the root node. If the XML doesn't have <person> as its outermost element, then it won't get invoked. And if you also have <xsl:template match="/", then it would get invoked first; the match="/person" (or match="/*") would only get invoked if the match="/" rule explicitly applied templates to children.

相关问答

更多