Commits

Yury Shulaev committed 270a1d4

improve output.xsl for MySQL

Comments (0)

Files changed (1)

db/mysql/output.xsl

 
 <xsl:template match="/sql">
 
-<xsl:text>
--- ---
--- Globals
--- ---
-
--- SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+<xsl:text>-- SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 -- SET FOREIGN_KEY_CHECKS=0;
 
 </xsl:text>
     <xsl:text>-- ---
 -- Table '</xsl:text>
     <xsl:value-of select="@name" />
-    <xsl:text>'
--- </xsl:text>
     <xsl:if test="comment">
 	    <xsl:call-template name="replace-substring">
 		    <xsl:with-param name="value" select="comment" />
 		<xsl:text>` (
 </xsl:text>
 		<xsl:for-each select="row">
-			<xsl:text>  `</xsl:text>
+			<xsl:text>    `</xsl:text>
 			<xsl:value-of select="@name" />
 			<xsl:text>` </xsl:text>
 
 			<xsl:text>,
 </xsl:text>
 			<xsl:choose>
-				<xsl:when test="@type = 'PRIMARY'">  PRIMARY KEY (</xsl:when>
-				<xsl:when test="@type = 'FULLTEXT'">  FULLTEXT KEY (</xsl:when>
-				<xsl:when test="@type = 'UNIQUE'">  UNIQUE KEY (</xsl:when>
-				<xsl:otherwise>KEY (</xsl:otherwise>
+				<xsl:when test="@type = 'PRIMARY'">    PRIMARY KEY (</xsl:when>
+				<xsl:when test="@type = 'FULLTEXT'">    FULLTEXT KEY (</xsl:when>
+				<xsl:when test="@type = 'UNIQUE'">    UNIQUE KEY (</xsl:when>
+				<xsl:otherwise>    KEY (</xsl:otherwise>
 			</xsl:choose>
 
 			<xsl:for-each select="part">
 
 </xsl:text>
 	<xsl:for-each select="table">
-    <xsl:text>-- ALTER TABLE `</xsl:text><xsl:value-of select="@name" />
+    <xsl:text>ALTER TABLE `</xsl:text><xsl:value-of select="@name" />
     <xsl:text>` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 </xsl:text>
 	</xsl:for-each>
 
-
-
-<xsl:text>
--- ---
--- Test Data
--- ---
-
-</xsl:text>
-        <xsl:for-each select="table">
-    <xsl:text>-- INSERT INTO `</xsl:text><xsl:value-of select="@name" />
-    <xsl:text>` (</xsl:text>
-                    <xsl:for-each select="row">
-                            <xsl:text>`</xsl:text>
-                            <xsl:value-of select="@name" />
-                            <xsl:text>`</xsl:text>
-                            <xsl:if test="not (position()=last())">
-    <xsl:text>,</xsl:text>
-                            </xsl:if>
-                    </xsl:for-each>
-    <xsl:text>) VALUES
--- (</xsl:text>
-                    <xsl:for-each select="row">
-                            <xsl:text>''</xsl:text>
-
-                            <xsl:if test="not (position()=last())">
-    <xsl:text>,</xsl:text>
-                            </xsl:if>
-                    </xsl:for-each>
-
-    <xsl:text>);
-</xsl:text>
-        </xsl:for-each>
-
-
 </xsl:template>
 </xsl:stylesheet>
-