[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5090 - trunk/gnue-common/utils/xml2sql
From: |
johannes |
Subject: |
r5090 - trunk/gnue-common/utils/xml2sql |
Date: |
Tue, 10 Feb 2004 06:43:58 -0600 (CST) |
Author: johannes
Date: 2004-02-10 06:43:53 -0600 (Tue, 10 Feb 2004)
New Revision: 5090
Modified:
trunk/gnue-common/utils/xml2sql/gadfly.xsl
trunk/gnue-common/utils/xml2sql/interbase.xsl
trunk/gnue-common/utils/xml2sql/mssql.xsl
trunk/gnue-common/utils/xml2sql/mysql.xsl
trunk/gnue-common/utils/xml2sql/sqlite.xsl
trunk/gnue-common/utils/xml2sql/sybase.xsl
Log:
Added column-list support to the tabledata section, and implemented the
string-type translation in interbase.xsl, sybase.xsl, mssql.xsl, sqllite.xsl.
Fixed an unmatched-tag-error in gadfly.xsl
Modified: trunk/gnue-common/utils/xml2sql/gadfly.xsl
===================================================================
--- trunk/gnue-common/utils/xml2sql/gadfly.xsl 2004-02-10 09:17:38 UTC (rev
5089)
+++ trunk/gnue-common/utils/xml2sql/gadfly.xsl 2004-02-10 12:43:53 UTC (rev
5090)
@@ -22,6 +22,8 @@
<xsl:when test="@type = "float""><xsl:text> float</xsl:text>
</xsl:when>
<xsl:when test="@type = "decimal""><xsl:text>
float</xsl:text> </xsl:when>
+ <xsl:when test="@type = "string""><xsl:text>
varchar</xsl:text>
+ </xsl:when>
<xsl:when test="@type = "varchar""><xsl:text>
varchar</xsl:text>
</xsl:when>
<xsl:when test="@type = "char""><xsl:text> varchar</xsl:text>
@@ -37,6 +39,7 @@
<xsl:when test="@type = "datetime""><xsl:text>
varchar</xsl:text>
</xsl:when>
<xsl:when test="@type = "timestamp""><xsl:text>
varchar</xsl:text>
+ </xsl:when>
<xsl:when test="@type = "boolean""><xsl:text>
integer</xsl:text>
</xsl:when>
<xsl:otherwise><xsl:text> UNHANDLED TYPE(</xsl:text><xsl:value-of
select="@type"/>)</xsl:otherwise>
Modified: trunk/gnue-common/utils/xml2sql/interbase.xsl
===================================================================
--- trunk/gnue-common/utils/xml2sql/interbase.xsl 2004-02-10 09:17:38 UTC
(rev 5089)
+++ trunk/gnue-common/utils/xml2sql/interbase.xsl 2004-02-10 12:43:53 UTC
(rev 5090)
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
+<!-- $Id: $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/schema"><sql>
<xsl:for-each select="tables/table">
@@ -163,10 +164,25 @@
<xsl:for-each select="rows/row">
<command><xsl:text>Insert into </xsl:text>
<xsl:value-of select="$tableName"/>
+ <xsl:variable name="numFDefs" select="count(value/@field)"/>
+ <xsl:variable name="numValues" select="count(value)"/>
+
+ <xsl:if test="$numFDefs > 0">
+ <!-- list of columns -->
+ <xsl:text> (</xsl:text>
+ <xsl:for-each select="value">
+ <xsl:value-of select="@field"/>
+ <xsl:if test="position() < $numValues">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <!-- -->
<xsl:text> values (</xsl:text>
- <xsl:variable name="numValues" select="count(value)"/>
+ <!-- values -->
<xsl:for-each select="value">
- <xsl:value-of select="."/>
+ <xsl:value-of select="."/>
<xsl:if test="position() < $numValues">
<xsl:text>, </xsl:text>
</xsl:if>
Modified: trunk/gnue-common/utils/xml2sql/mssql.xsl
===================================================================
--- trunk/gnue-common/utils/xml2sql/mssql.xsl 2004-02-10 09:17:38 UTC (rev
5089)
+++ trunk/gnue-common/utils/xml2sql/mssql.xsl 2004-02-10 12:43:53 UTC (rev
5090)
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
+<!-- $Id: $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/schema"><sql>
<xsl:for-each select="tables/table">
@@ -59,6 +60,7 @@
<xsl:when test="@type = "text""><xsl:text>
</xsl:text><xsl:value-of select="@type"/></xsl:when>
<xsl:when test="@type = "timestamp""><xsl:text>
timestamp</xsl:text></xsl:when>
<xsl:when test="@type = "boolean""><xsl:text>
boolean</xsl:text></xsl:when>
+ <xsl:when test="@type = "string""><xsl:text>
varchar(</xsl:text><xsl:value-of
select="@length"/><xsl:text>)</xsl:text></xsl:when>
<xsl:otherwise><xsl:text> UNHANDLED TYPE(</xsl:text><xsl:value-of
select="@type"/>)</xsl:otherwise>
</xsl:choose>
<xsl:choose>
@@ -147,10 +149,25 @@
<xsl:for-each select="rows/row">
<command><xsl:text>Insert into </xsl:text>
<xsl:value-of select="$tableName"/>
+ <xsl:variable name="numFDefs" select="count(value/@field)"/>
+ <xsl:variable name="numValues" select="count(value)"/>
+
+ <xsl:if test="$numFDefs > 0">
+ <!-- list of columns -->
+ <xsl:text> (</xsl:text>
+ <xsl:for-each select="value">
+ <xsl:value-of select="@field"/>
+ <xsl:if test="position() < $numValues">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <!-- -->
<xsl:text> values (</xsl:text>
- <xsl:variable name="numValues" select="count(value)"/>
+ <!-- values -->
<xsl:for-each select="value">
- <xsl:value-of select="."/>
+ <xsl:value-of select="."/>
<xsl:if test="position() < $numValues">
<xsl:text>, </xsl:text>
</xsl:if>
Modified: trunk/gnue-common/utils/xml2sql/mysql.xsl
===================================================================
--- trunk/gnue-common/utils/xml2sql/mysql.xsl 2004-02-10 09:17:38 UTC (rev
5089)
+++ trunk/gnue-common/utils/xml2sql/mysql.xsl 2004-02-10 12:43:53 UTC (rev
5090)
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
+<!-- $Id: $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/schema"><sql>
<xsl:for-each select="tables/table">
@@ -155,10 +156,25 @@
<xsl:for-each select="rows/row">
<command><xsl:text>Insert into </xsl:text>
<xsl:value-of select="$tableName"/>
+ <xsl:variable name="numFDefs" select="count(value/@field)"/>
+ <xsl:variable name="numValues" select="count(value)"/>
+
+ <xsl:if test="$numFDefs > 0">
+ <!-- list of columns -->
+ <xsl:text> (</xsl:text>
+ <xsl:for-each select="value">
+ <xsl:value-of select="@field"/>
+ <xsl:if test="position() < $numValues">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <!-- -->
<xsl:text> values (</xsl:text>
- <xsl:variable name="numValues" select="count(value)"/>
+ <!-- values -->
<xsl:for-each select="value">
- <xsl:value-of select="."/>
+ <xsl:value-of select="."/>
<xsl:if test="position() < $numValues">
<xsl:text>, </xsl:text>
</xsl:if>
Modified: trunk/gnue-common/utils/xml2sql/sqlite.xsl
===================================================================
--- trunk/gnue-common/utils/xml2sql/sqlite.xsl 2004-02-10 09:17:38 UTC (rev
5089)
+++ trunk/gnue-common/utils/xml2sql/sqlite.xsl 2004-02-10 12:43:53 UTC (rev
5090)
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
+<!-- $Id: $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/schema"><sql>
<xsl:for-each select="tables/table">
@@ -43,6 +44,7 @@
<xsl:when test="@type = "int""><xsl:text>
</xsl:text><xsl:value-of select="@type"/><xsl:value-of
select="@size"/></xsl:when>
<xsl:when test="@type = "float""><xsl:text>
</xsl:text><xsl:value-of select="@type"/><xsl:value-of
select="@size"/></xsl:when>
<xsl:when test="@type = "decimal""><xsl:text>
</xsl:text><xsl:value-of select="@type"/>(<xsl:value-of
select="@precision"/>,<xsl:value-of select="@scale"/>)</xsl:when>
+ <xsl:when test="@type = "string""><xsl:text>
varchar(</xsl:text><xsl:value-of select="@length"/>)</xsl:when>
<xsl:when test="@type = "varchar""><xsl:text>
</xsl:text><xsl:value-of select="@type"/>(<xsl:value-of
select="@size"/>)</xsl:when>
<xsl:when test="@type = "char""><xsl:text>
</xsl:text><xsl:value-of select="@type"/>(<xsl:value-of
select="@size"/>)</xsl:when>
<xsl:when test="@type = "blob""><xsl:text>
</xsl:text>text</xsl:when>
@@ -131,10 +133,25 @@
<xsl:for-each select="rows/row">
<command><xsl:text>Insert into </xsl:text>
<xsl:value-of select="$tableName"/>
+ <xsl:variable name="numFDefs" select="count(value/@field)"/>
+ <xsl:variable name="numValues" select="count(value)"/>
+
+ <xsl:if test="$numFDefs > 0">
+ <!-- list of columns -->
+ <xsl:text> (</xsl:text>
+ <xsl:for-each select="value">
+ <xsl:value-of select="@field"/>
+ <xsl:if test="position() < $numValues">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <!-- -->
<xsl:text> values (</xsl:text>
- <xsl:variable name="numValues" select="count(value)"/>
+ <!-- values -->
<xsl:for-each select="value">
- <xsl:value-of select="."/>
+ <xsl:value-of select="."/>
<xsl:if test="position() < $numValues">
<xsl:text>, </xsl:text>
</xsl:if>
Modified: trunk/gnue-common/utils/xml2sql/sybase.xsl
===================================================================
--- trunk/gnue-common/utils/xml2sql/sybase.xsl 2004-02-10 09:17:38 UTC (rev
5089)
+++ trunk/gnue-common/utils/xml2sql/sybase.xsl 2004-02-10 12:43:53 UTC (rev
5090)
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
+<!-- $Id: $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/schema"><sql>
<xsl:for-each select="tables/table">
@@ -50,6 +51,7 @@
</xsl:choose>
</xsl:when>
<xsl:when test="@type = "decimal""><xsl:text>
</xsl:text><xsl:value-of select="@type"/>(<xsl:value-of
select="@precision"/>,<xsl:value-of select="@scale"/>)</xsl:when>
+ <xsl:when test="@type = "string""><xsl:text>
varchar(</xsl:text><xsl:value-of select="@length"/>)</xsl:when>
<xsl:when test="@type = "varchar""><xsl:text>
</xsl:text><xsl:value-of select="@type"/>(<xsl:value-of
select="@size"/>)</xsl:when>
<xsl:when test="@type = "char""><xsl:text>
</xsl:text><xsl:value-of select="@type"/>(<xsl:value-of
select="@size"/>)</xsl:when>
<xsl:when test="@type = "blob""><xsl:text>
image</xsl:text></xsl:when>
@@ -147,10 +149,25 @@
<xsl:for-each select="rows/row">
<command><xsl:text>Insert into </xsl:text>
<xsl:value-of select="$tableName"/>
+ <xsl:variable name="numFDefs" select="count(value/@field)"/>
+ <xsl:variable name="numValues" select="count(value)"/>
+
+ <xsl:if test="$numFDefs > 0">
+ <!-- list of columns -->
+ <xsl:text> (</xsl:text>
+ <xsl:for-each select="value">
+ <xsl:value-of select="@field"/>
+ <xsl:if test="position() < $numValues">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <!-- -->
<xsl:text> values (</xsl:text>
- <xsl:variable name="numValues" select="count(value)"/>
+ <!-- values -->
<xsl:for-each select="value">
- <xsl:value-of select="."/>
+ <xsl:value-of select="."/>
<xsl:if test="position() < $numValues">
<xsl:text>, </xsl:text>
</xsl:if>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5090 - trunk/gnue-common/utils/xml2sql,
johannes <=