1<?xml version='1.0'?> 2<!-- 3 * Copyright (C) 2012 VoIP Embedded, Inc. 4 * 5 * This file is part of Kamailio, a free SIP server. 6 * 7 * Kamailio is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version 11 * 12 * Kamailio is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20--> 21 22<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 23 version='1.0' 24 xmlns:xi="http://www.w3.org/2001/XInclude"> 25 26 <xsl:import href="sql.xsl"/> 27 28 <!-- Create the file for the table in pi_http subdirectory --> 29 <xsl:template match="/"> 30 31 <xsl:variable name="path" select="concat($dir, concat('/', concat($prefix, 'table')))"/> 32 <xsl:document href="{$path}" method="text" indent="no" omit-xml-declaration="yes"> 33 <xsl:apply-templates select="/database[1]"/> 34 </xsl:document> 35 </xsl:template> 36 37 <xsl:template match="table"> 38 <xsl:variable name="table.name"> 39 <xsl:call-template name="get-name"/> 40 </xsl:variable> 41 <xsl:text>	<!-- Declaration of </xsl:text> 42 <xsl:value-of select="$table.name"/> 43 <xsl:text> table-->
</xsl:text> 44 <xsl:text>	<db_table id="</xsl:text> 45 <xsl:value-of select="$table.name"/> 46 <xsl:text>">
</xsl:text> 47 <xsl:text>		<table_name></xsl:text> 48 <xsl:value-of select="$table.name"/> 49 <xsl:text></table_name>
</xsl:text> 50 <xsl:text>		<db_url_id>mysql</db_url_id>
</xsl:text> 51 <xsl:apply-templates select="column"/> 52 <xsl:text>	</db_table>
</xsl:text> 53 </xsl:template> 54 55 <xsl:template match="column"> 56 <xsl:text>		<column><field></xsl:text> 57 <xsl:call-template name="get-name"/> 58 <xsl:text></field><type></xsl:text> 59 <xsl:call-template name="column.type"/> 60 <xsl:text></type></column>
</xsl:text> 61 </xsl:template> 62 63 <xsl:template name="column.type"> 64 <xsl:variable name="type"> 65 <xsl:call-template name="get-type"/> 66 </xsl:variable> 67 <xsl:choose> 68 <xsl:when test="type[@db='mysql']"> 69 <xsl:value-of select="normalize-space(type[@db='mysql'])"/> 70 </xsl:when> 71 <xsl:when test="$type='char'"> 72 <xsl:text>DB1_INT</xsl:text> 73 </xsl:when> 74 <xsl:when test="$type='short'"> 75 <xsl:text>DB1_INT</xsl:text> 76 </xsl:when> 77 <xsl:when test="$type='int'"> 78 <xsl:text>DB1_INT</xsl:text> 79 </xsl:when> 80 <xsl:when test="$type='long'"> 81 <xsl:text>DB1_BIGINT</xsl:text> 82 </xsl:when> 83 <xsl:when test="$type='datetime'"> 84 <xsl:text>DB1_DATETIME</xsl:text> 85 </xsl:when> 86 <xsl:when test="$type='double'"> 87 <xsl:text>DB1_DOUBLE</xsl:text> 88 </xsl:when> 89 <xsl:when test="$type='float'"> 90 <xsl:text>DB1_DOUBLE</xsl:text> 91 </xsl:when> 92 <xsl:when test="$type='string'"> 93 <xsl:text>DB1_STR</xsl:text> 94 </xsl:when> 95 <xsl:when test="$type='binary'"> 96 <xsl:text>DB1_BLOB</xsl:text> 97 </xsl:when> 98 <xsl:when test="$type='largebinary'"> 99 <xsl:text>DB1_BLOB</xsl:text> 100 </xsl:when> 101 <xsl:when test="$type='text'"> 102 <xsl:text>DB1_BLOB</xsl:text> 103 </xsl:when> 104 <xsl:when test="$type='largetext'"> 105 <xsl:text>DB1_BLOB</xsl:text> 106 </xsl:when> 107 <xsl:otherwise> 108 <xsl:call-template name="type-error"/> 109 </xsl:otherwise> 110 </xsl:choose> 111 </xsl:template> 112 113</xsl:stylesheet> 114 115