mirror of https://github.com/sipwise/kamailio.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
5.9 KiB
148 lines
5.9 KiB
<?xml version='1.0'?>
|
|
<!--
|
|
* Copyright (C) 2012 VoIP Embedded, Inc.
|
|
*
|
|
* This file is part of Kamailio, a free SIP server.
|
|
*
|
|
* Kamailio is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version
|
|
*
|
|
* Kamailio is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
-->
|
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
version='1.0'
|
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
|
|
<xsl:import href="sql.xsl"/>
|
|
|
|
<!-- Create the file for the mod in pi_http subdirectory -->
|
|
<xsl:template match="/">
|
|
<xsl:variable name="path" select="concat($dir, concat('/', concat($prefix, 'mod')))"/>
|
|
<xsl:document href="{$path}" method="text" indent="no" omit-xml-declaration="yes">
|
|
<xsl:apply-templates select="/database[1]"/>
|
|
</xsl:document>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="table">
|
|
<xsl:variable name="table.name">
|
|
<xsl:call-template name="get-name"/>
|
|
</xsl:variable>
|
|
<xsl:text>	<!-- </xsl:text>
|
|
<xsl:value-of select="$table.name"/>
|
|
<xsl:text> provisioning -->
</xsl:text>
|
|
<xsl:text>	<mod><mod_name></xsl:text>
|
|
<xsl:value-of select="$table.name"/>
|
|
<xsl:text></mod_name>
</xsl:text>
|
|
|
|
<!-- show/DB1_QUERY -->
|
|
<xsl:text>		<cmd><cmd_name>show</cmd_name>
</xsl:text>
|
|
<xsl:text>			<db_table_id></xsl:text>
|
|
<xsl:value-of select="$table.name"/>
|
|
<xsl:text></db_table_id>
</xsl:text>
|
|
<xsl:text>			<cmd_type>DB1_QUERY</cmd_type>
</xsl:text>
|
|
<xsl:text>			<query_cols>
</xsl:text>
|
|
<xsl:for-each select="column">
|
|
<xsl:choose>
|
|
<xsl:when test="primary">
|
|
<xsl:text>				<col><field></xsl:text>
|
|
<xsl:call-template name="get-name"/>
|
|
<xsl:text></field><link_cmd>update</link_cmd></col>
</xsl:text>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>				<col><field></xsl:text>
|
|
<xsl:call-template name="get-name"/>
|
|
<xsl:text></field></col>
</xsl:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
<xsl:text>			</query_cols>
</xsl:text>
|
|
<xsl:text>		</cmd>
</xsl:text>
|
|
|
|
<!-- add/DB1_INSERT -->
|
|
<xsl:text>		<cmd><cmd_name>add</cmd_name>
</xsl:text>
|
|
<xsl:text>			<db_table_id></xsl:text>
|
|
<xsl:value-of select="$table.name"/>
|
|
<xsl:text></db_table_id>
</xsl:text>
|
|
<xsl:text>			<cmd_type>DB1_INSERT</cmd_type>
</xsl:text>
|
|
<xsl:text>			<query_cols>
</xsl:text>
|
|
<xsl:for-each select="column">
|
|
<xsl:choose>
|
|
<xsl:when test="autoincrement">
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>				<col><field></xsl:text>
|
|
<xsl:call-template name="get-name"/>
|
|
<xsl:text></field></col>
</xsl:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
<xsl:text>			</query_cols>
</xsl:text>
|
|
<xsl:text>		</cmd>
</xsl:text>
|
|
|
|
<!-- update/DB1_UPDATE -->
|
|
<xsl:if test="column/primary">
|
|
<xsl:text>		<cmd><cmd_name>update</cmd_name>
</xsl:text>
|
|
<xsl:text>			<db_table_id></xsl:text>
|
|
<xsl:value-of select="$table.name"/>
|
|
<xsl:text></db_table_id>
</xsl:text>
|
|
<xsl:text>			<cmd_type>DB1_UPDATE</cmd_type>
</xsl:text>
|
|
<xsl:text>			<clause_cols>
</xsl:text>
|
|
<xsl:for-each select="column">
|
|
<xsl:if test="primary">
|
|
<xsl:text>				<col><field></xsl:text>
|
|
<xsl:call-template name="get-name"/>
|
|
<xsl:text></field><operator>=</operator></col>
</xsl:text>
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
<xsl:text>			</clause_cols>
</xsl:text>
|
|
<xsl:text>			<query_cols>
</xsl:text>
|
|
<xsl:for-each select="column">
|
|
<xsl:choose>
|
|
<xsl:when test="primary">
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:text>				<col><field></xsl:text>
|
|
<xsl:call-template name="get-name"/>
|
|
<xsl:text></field></col>
</xsl:text>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:for-each>
|
|
<xsl:text>			</query_cols>
</xsl:text>
|
|
<xsl:text>		</cmd>
</xsl:text>
|
|
</xsl:if>
|
|
|
|
<!-- delete/DB1_DELETE -->
|
|
<xsl:if test="column/primary">
|
|
<xsl:text>		<cmd><cmd_name>delete</cmd_name>
</xsl:text>
|
|
<xsl:text>			<db_table_id></xsl:text>
|
|
<xsl:value-of select="$table.name"/>
|
|
<xsl:text></db_table_id>
</xsl:text>
|
|
<xsl:text>			<cmd_type>DB1_DELETE</cmd_type>
</xsl:text>
|
|
<xsl:text>			<clause_cols>
</xsl:text>
|
|
<xsl:for-each select="column">
|
|
<xsl:if test="primary">
|
|
<xsl:text>				<col><field></xsl:text>
|
|
<xsl:call-template name="get-name"/>
|
|
<xsl:text></field><operator>=</operator></col>
</xsl:text>
|
|
</xsl:if>
|
|
</xsl:for-each>
|
|
<xsl:text>			</clause_cols>
</xsl:text>
|
|
<xsl:text>		</cmd>
</xsl:text>
|
|
</xsl:if>
|
|
|
|
<xsl:text>	</mod>
</xsl:text>
|
|
</xsl:template>
|
|
|
|
</xsl:stylesheet>
|
|
|