mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Added script to validate XML Query/Schema Language files
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10544 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
532a6a0645
commit
6394a5c278
33 changed files with 4202 additions and 0 deletions
432
tools/dbxml_validator/connect_wrapper.php
Normal file
432
tools/dbxml_validator/connect_wrapper.php
Normal file
|
|
@ -0,0 +1,432 @@
|
|||
<?php
|
||||
/** @file
|
||||
|
||||
Extends XE db classes to allow parsing methods to work in the absence of
|
||||
a real db connection for the db type.
|
||||
|
||||
Included by XML Query/Schema Language validator
|
||||
*/
|
||||
|
||||
class DBMysqlConnectWrapper extends DBMysql
|
||||
{
|
||||
public $queries = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db_type = 'mysql';
|
||||
$this->_setDBInfo(); // Context::get() should indicate a mysql db
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return new DBMysqlConnectWrapper();
|
||||
}
|
||||
|
||||
public function actDBClassStart()
|
||||
{
|
||||
}
|
||||
|
||||
public function actStart($query)
|
||||
{
|
||||
}
|
||||
|
||||
public function actFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function actDBClassFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function isSupported()
|
||||
{
|
||||
// No need to actually check for 'mysql_connect' function
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function __connect($connection)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _afterConnect($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function _close($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function close($type = 'master', $indx = NULL)
|
||||
{
|
||||
}
|
||||
|
||||
public function _begin()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _rollback()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _commit()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function __query($query, $connection)
|
||||
{
|
||||
$this->queries .= "\n" . $query;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _fetch($result, $arrayIndexEndValue = NULL)
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
|
||||
public function isTableExists($target_name)
|
||||
{
|
||||
parent::isTableExists($target_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public function db_insert_id()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function db_fetch_object(&$result)
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
}
|
||||
|
||||
class DBMysqliConnectWrapper extends DBMysqli
|
||||
{
|
||||
public $queries = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db_type = 'mysqli';
|
||||
$this->_setDBInfo(); // Context::get() should indicate a mysqli db
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return new DBMysqlConnectWrapper();
|
||||
}
|
||||
|
||||
public function actDBClassStart()
|
||||
{
|
||||
}
|
||||
|
||||
public function actStart($query)
|
||||
{
|
||||
}
|
||||
|
||||
public function actFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function actDBClassFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function isSupported()
|
||||
{
|
||||
// No need to actually check for 'mysql_connect' function
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function isTableExists($target_name)
|
||||
{
|
||||
parent::isTableExists($target_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// use old mysql escape function, since the mysqli one uses
|
||||
// the connection resource (to get the current character set)
|
||||
public function addQuotes($string)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc())
|
||||
$string = stripslashes(str_replace("\\","\\\\",$string));
|
||||
|
||||
if (!is_numeric($string))
|
||||
$string = @mysql_real_escape_string($string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
public function __connect($connection)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _afterConnect($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function _close($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function close($type = 'master', $indx = NULL)
|
||||
{
|
||||
}
|
||||
|
||||
public function _begin()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _rollback()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _commit()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function __query($query, $connection)
|
||||
{
|
||||
$this->queries .= "\n" . $query;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _fetch($result, $arrayIndexEndValue = NULL)
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
|
||||
public function db_insert_id()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function db_fetch_object(&$result)
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
}
|
||||
|
||||
class DBCubridConnectWrapper extends DBCubrid
|
||||
{
|
||||
public $queries = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db_type = 'cubrid';
|
||||
$this->_setDBInfo(); // Context::get() should indicate a CUBRID db
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return new DBMysqlConnectWrapper();
|
||||
}
|
||||
|
||||
public function actDBClassStart()
|
||||
{
|
||||
}
|
||||
|
||||
public function actStart($query)
|
||||
{
|
||||
}
|
||||
|
||||
public function _makeSequence()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function actFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function actDBClassFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function isSupported()
|
||||
{
|
||||
// No need to actually check for 'cubrid_connect' function
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function isTableExists($target_name)
|
||||
{
|
||||
try
|
||||
{
|
||||
parent::isTableExists($target_name);
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public function __connect($connection)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _afterConnect($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function _close($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function close($type = 'master', $indx = NULL)
|
||||
{
|
||||
}
|
||||
|
||||
public function _begin()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _rollback()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _commit()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function __query($query, $connection)
|
||||
{
|
||||
$this->queries .= "\n" . $query;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _fetch($result, $arrayIndexEndValue = NULL)
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
|
||||
public function db_insert_id()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function &db_fetch_object()
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
}
|
||||
|
||||
class DBMssqlConnectWrapper extends DBMssql
|
||||
{
|
||||
public $queries = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db_type = 'mssql';
|
||||
$this->_setDBInfo(); // Context::get() should indicate a MS Sql db
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return new DBMssqlConnectWrapper();
|
||||
}
|
||||
|
||||
public function actDBClassStart()
|
||||
{
|
||||
}
|
||||
|
||||
public function actStart($query)
|
||||
{
|
||||
}
|
||||
|
||||
public function actFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function actDBClassFinish()
|
||||
{
|
||||
}
|
||||
|
||||
public function isSupported()
|
||||
{
|
||||
// No need to actually check for 'mssql_connect' function
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function isTableExists($target_name)
|
||||
{
|
||||
parent::isTableExists($target_name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public function __connect($connection)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _afterConnect($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function _close($connection)
|
||||
{
|
||||
}
|
||||
|
||||
public function close($type = 'master', $indx = NULL)
|
||||
{
|
||||
}
|
||||
|
||||
public function _begin()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _rollback()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _commit()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function __query($query, $connection)
|
||||
{
|
||||
if ($this->queries)
|
||||
$this->queries .= ";\n";
|
||||
|
||||
$this->queries .= $query;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function _fetch($result, $arrayIndexEndValue = NULL)
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
|
||||
public function db_insert_id()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function &db_fetch_object()
|
||||
{
|
||||
return new any_prop_obj_base();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
23
tools/dbxml_validator/tests/data/checkMissingPipe.xml
Normal file
23
tools/dbxml_validator/tests/data/checkMissingPipe.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<query id="checkMissingPipe" action="select">
|
||||
<tables>
|
||||
<table name="tableName" alias="alias" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group>
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
24
tools/dbxml_validator/tests/data/dupListCount.xml
Normal file
24
tools/dbxml_validator/tests/data/dupListCount.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<query id="dupListCount" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
25
tools/dbxml_validator/tests/data/dupPage.xml
Normal file
25
tools/dbxml_validator/tests/data/dupPage.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<query id="dupPage" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
||||
24
tools/dbxml_validator/tests/data/dupPageCount.xml
Normal file
24
tools/dbxml_validator/tests/data/dupPageCount.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<query id="dupPageCount" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
35
tools/dbxml_validator/tests/data/dupTblName.xml
Normal file
35
tools/dbxml_validator/tests/data/dupTblName.xml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<query id="dupTblName" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
<table query="true" alias="tableName">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" alias="member_srl" />
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<groups>
|
||||
<group column="member_srl" />
|
||||
</groups>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<query id="duplicateColumnsInSelect" action="select">
|
||||
<columns>
|
||||
<column name="count(*)" />
|
||||
<column name="count(*)" />
|
||||
</columns>
|
||||
<tables>
|
||||
<table name="tblName" />
|
||||
</tables>
|
||||
</query>
|
||||
27
tools/dbxml_validator/tests/data/emptyTableSubquery.xml
Normal file
27
tools/dbxml_validator/tests/data/emptyTableSubquery.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<query id="emptyTableSubquery" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
<table query="true">
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
||||
|
||||
38
tools/dbxml_validator/tests/data/joinedSubquery.xml
Normal file
38
tools/dbxml_validator/tests/data/joinedSubquery.xml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<query id="joinedSubquery" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
<table query="true" alias="tableSubquery" type="left join">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" alias="member_srl" />
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<groups>
|
||||
<group column="member_srl" />
|
||||
</groups>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
||||
|
||||
|
||||
29
tools/dbxml_validator/tests/data/joinedTableCondition.xml
Normal file
29
tools/dbxml_validator/tests/data/joinedTableCondition.xml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<query id="joinedTableCondition" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
<table alias="tableSubquery" type="left join">
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
||||
|
||||
|
||||
|
||||
36
tools/dbxml_validator/tests/data/namedTableSubquery.xml
Normal file
36
tools/dbxml_validator/tests/data/namedTableSubquery.xml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<query id="namedTableSubquery" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
<table query="true" name="tableSubqueryName">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" alias="member_srl" />
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<groups>
|
||||
<group column="member_srl" />
|
||||
</groups>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<table name="tbl">
|
||||
<column name="col_name" type="text" />
|
||||
<!-- only number and bignumber types can have attribute 'auto_increment' -->
|
||||
<column name="col_name2" type="date" auto_increment="auto_increment" />
|
||||
</table>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<table name="tbl">
|
||||
<column name="col_name" type="text" />
|
||||
<!-- only FLOAT, CHAR and VARCHAR have size -->
|
||||
<column name="col_name2" type="number" size="5" />
|
||||
</table>
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<table name="tbl">
|
||||
<column name="col_name" type="text" />
|
||||
<!-- VARCHAR type requires 'size' attribute -->
|
||||
<column name="col_name2" type="varchar" />
|
||||
</table>
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<table name="tbl">
|
||||
<column name="col_name" type="text" />
|
||||
<!-- 'auto_increment' only supported by mysql, MSSql -->
|
||||
<column name="col_name2" type="number" auto_increment="auto_increment" />
|
||||
</table>
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<table name="tbl">
|
||||
<column name="col_name" type="text" />
|
||||
|
||||
<!-- type="tinytext" only supported by CUBRID -->
|
||||
<column name="col_name2" type="tinytext" />
|
||||
</table>
|
||||
|
||||
36
tools/dbxml_validator/tests/data/tableSubquery.xml
Normal file
36
tools/dbxml_validator/tests/data/tableSubquery.xml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<query id="tableSubquery" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
<table name="tableSubquery" alias="tableName2">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" alias="member_srl" />
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<groups>
|
||||
<group column="member_srl" />
|
||||
</groups>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
||||
37
tools/dbxml_validator/tests/data/unnamedTableSubquery.xml
Normal file
37
tools/dbxml_validator/tests/data/unnamedTableSubquery.xml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<query id="unnamedTableSubquery" action="select">
|
||||
<tables>
|
||||
<table name="tableName" />
|
||||
<table query="true">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" alias="member_srl" />
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<groups>
|
||||
<group column="member_srl" />
|
||||
</groups>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="columnName" alias="alias" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="like_prefix" column="column1" var="variable" filter="user_id" default="default" notnull="notnull" minlength="10" maxlength="1000" pipe="AND"/>
|
||||
<group pipe="and">
|
||||
<condition operation="notlike_tail" column="column" var="variable" filter="numbers" default="default" notnull="notnull" minlength ="0" maxlength="10000" pipe="and"/>
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="var" default="default" order="desc|asc" />
|
||||
<list_count var="var" default="25" />
|
||||
<page_count var="var" default="5" />
|
||||
<page var="var" default="2" />
|
||||
</navigation>
|
||||
<groups>
|
||||
<group column="GroupBy daesang" />
|
||||
</groups>
|
||||
</query>
|
||||
|
||||
|
||||
26
tools/dbxml_validator/tests/data/update.xml
Normal file
26
tools/dbxml_validator/tests/data/update.xml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<query id="update" action="update">
|
||||
<tables>
|
||||
<table name="table1" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="column1" default="10"/>
|
||||
<column name="column2" default="12" />
|
||||
<column name="column3" default="13"/>
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="more" column="column4" default="100" var="condition_value">
|
||||
<query id="documentMaxRegdate">
|
||||
<tables>
|
||||
<table name="documents" alias="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="max(regdate)" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="documents.user_id" var="member.user_id" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
</condition>
|
||||
</conditions>
|
||||
</query>
|
||||
|
||||
6
tools/dbxml_validator/tests/data/wrongQueryId.xml
Normal file
6
tools/dbxml_validator/tests/data/wrongQueryId.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<query id="noQueryId" action="select">
|
||||
<columns />
|
||||
<tables>
|
||||
<table name="source_tbl" />
|
||||
</tables>
|
||||
</query>
|
||||
227
tools/dbxml_validator/tests/xmlQueriesTest.php
Normal file
227
tools/dbxml_validator/tests/xmlQueriesTest.php
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
<?php
|
||||
|
||||
if (!defined('__DIR__'))
|
||||
define('__DIR__', realpath(dirname(__FILE__)));
|
||||
|
||||
/** The tests here are meant only for the built-in checks in validator.php,
|
||||
and not for the entire syntax expressed by the .xsd files. */
|
||||
class XmlQueriesTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
// taken from validator.php
|
||||
|
||||
const RETCODE_VALIDATOR_INTERNAL = 60;
|
||||
const RETCODE_GENERIC_XML_SYNTAX = 50;
|
||||
const RETCODE_QUERY_ELEMENT = 40;
|
||||
const RETCODE_XSD_VALIDATION = 30;
|
||||
const RETCODE_BUILTIN_CHECKS = 20;
|
||||
const RETCODE_DB_SCHEMA_MATCH =10; // no schema match is currently implemented.
|
||||
const RETCODE_SUCCESS = 0;
|
||||
|
||||
public $validator_cmd;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " ";
|
||||
}
|
||||
|
||||
// recursive glob
|
||||
// On Windows glob() is case-sensitive.
|
||||
public function globr($sDir, $sPattern, $nFlags = NULL)
|
||||
{
|
||||
// Get the list of all matching files currently in the
|
||||
// directory.
|
||||
|
||||
$aFiles = glob("$sDir/$sPattern", $nFlags);
|
||||
|
||||
$this->assertTrue(is_array($aFiles), 'directory listing failed.');
|
||||
|
||||
$aDirs = glob("$sDir/*", GLOB_ONLYDIR | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR);
|
||||
$this->assertTrue(is_array($aDirs), 'directory listing failed.');
|
||||
|
||||
foreach ($aDirs as $sSubDir)
|
||||
{
|
||||
if ($sSubDir != '.' && $sSubDir != '..')
|
||||
{
|
||||
$aSubFiles = $this->globr($sSubDir, $sPattern, $nFlags);
|
||||
$aFiles = array_merge($aFiles, $aSubFiles);
|
||||
}
|
||||
}
|
||||
|
||||
// return merged array with all (recursive) files
|
||||
return $aFiles;
|
||||
}
|
||||
|
||||
/** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */
|
||||
public function invoke_testReleasedXMLLangFiles
|
||||
(
|
||||
$released_files,
|
||||
$expected_return_code,
|
||||
$validator_args = ''
|
||||
)
|
||||
{
|
||||
// this file is in tools/dbxml_validator/tests
|
||||
$xe_dir = __DIR__ . '/../../..';
|
||||
|
||||
$this->assertTrue(file_exists($xe_dir . '/index.php'), 'XE directory not found');
|
||||
|
||||
$cnt = 0;
|
||||
$cmd = $this->validator_cmd;
|
||||
$xml_files = array();
|
||||
|
||||
foreach ($released_files as $released_file_mask)
|
||||
$xml_files =
|
||||
array_merge
|
||||
(
|
||||
$xml_files,
|
||||
$this->globr
|
||||
(
|
||||
$xe_dir,
|
||||
$released_file_mask,
|
||||
GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
|
||||
)
|
||||
);
|
||||
|
||||
while ($cnt < count($xml_files))
|
||||
{
|
||||
$cmd = $this->validator_cmd . $validator_args;
|
||||
|
||||
// Validate 50 files at once
|
||||
foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
|
||||
$cmd .= " " . escapeshellarg($xml_file);
|
||||
|
||||
exec($cmd . ' 2>&1', $validator_output, $return_code);
|
||||
|
||||
$output_text = trim(trim(implode("\n", $validator_output)), "\n");
|
||||
|
||||
// Validator should not crash/exit-with-an-error.
|
||||
$this->assertLessThanOrEqual
|
||||
(
|
||||
$expected_return_code,
|
||||
$return_code,
|
||||
"{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}."
|
||||
);
|
||||
|
||||
$cnt += 50;
|
||||
}
|
||||
}
|
||||
|
||||
public function testReleasedXMLQueryLangFiles()
|
||||
{
|
||||
$this->invoke_testReleasedXMLLangFiles
|
||||
(
|
||||
array('queries/*.xml', 'xml_query/*.xml'),
|
||||
self::RETCODE_QUERY_ELEMENT
|
||||
);
|
||||
|
||||
$this->markTestIncomplete('XML Query Language files should be fixed first.');
|
||||
}
|
||||
|
||||
public function testReleasedXMLSchemaLangFiles()
|
||||
{
|
||||
$this->invoke_testReleasedXMLLangFiles
|
||||
(
|
||||
array('schemas/*.xml'),
|
||||
self::RETCODE_BUILTIN_CHECKS,
|
||||
' --schema-language'
|
||||
);
|
||||
|
||||
$this->markTestIncomplete('XML Schema Language files should be fixed first.');
|
||||
}
|
||||
|
||||
public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')
|
||||
{
|
||||
$cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);
|
||||
$validator_output = array();
|
||||
$return_code = 0;
|
||||
|
||||
exec($cmd . '2>&1', $validator_output, $return_code);
|
||||
|
||||
$output_text = trim(trim(implode("\n", $validator_output)), "\n");
|
||||
|
||||
// Validator should not crash/exit-with-an-error.
|
||||
$this->assertEquals
|
||||
(
|
||||
$err_code,
|
||||
$return_code,
|
||||
"{$cmd}\n{$output_text}\nValidator returned code {$return_code}."
|
||||
);
|
||||
|
||||
// Validator should output some error on the test files
|
||||
$basefilename = basename($filename);
|
||||
$this->assertNotEmpty($output_text, "Error reporting failed for {$basefilename} validation.");
|
||||
|
||||
}
|
||||
|
||||
public function testInvalidQueryId()
|
||||
{
|
||||
return $this->invoke_testInvalidXmlFiles(__DIR__.'/data/wrongQueryId.xml', self::RETCODE_QUERY_ELEMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilesList
|
||||
*/
|
||||
public function testInvalidXMLQueryFiles($filename)
|
||||
{
|
||||
return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS);
|
||||
}
|
||||
|
||||
public function getDirFilesList($dir_name)
|
||||
{
|
||||
$output = array();
|
||||
|
||||
$dir = opendir(__DIR__ . '/' . $dir_name);
|
||||
|
||||
if ($dir)
|
||||
{
|
||||
$entry = readdir($dir);
|
||||
|
||||
while ($entry !== FALSE)
|
||||
{
|
||||
$fname = __DIR__ . '/' . $dir_name .'/' . $entry;
|
||||
|
||||
if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')
|
||||
$output[] = array($fname);
|
||||
|
||||
$entry = readdir($dir);
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
}
|
||||
else
|
||||
$this->assertFalse(TRUE);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function getFilesList()
|
||||
{
|
||||
return $this->getDirFilesList('data');
|
||||
}
|
||||
|
||||
public function getSchemaFilesList()
|
||||
{
|
||||
return $this->getDirFilesList('data/schema');
|
||||
}
|
||||
|
||||
public function getSchemaWarningFilesList()
|
||||
{
|
||||
return $this->getDirFilesList('data/schema/warnings');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getSchemaFilesList
|
||||
*/
|
||||
public function testInvalidXMLSchemaFiles($filename)
|
||||
{
|
||||
return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS, '--schema-language');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getSchemaWarningFilesList
|
||||
*/
|
||||
public function testWarningXMLSchemaFiles($filename)
|
||||
{
|
||||
return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_SUCCESS, '--schema-language');
|
||||
}
|
||||
}
|
||||
|
||||
1728
tools/dbxml_validator/validate.php
Normal file
1728
tools/dbxml_validator/validate.php
Normal file
File diff suppressed because it is too large
Load diff
90
tools/dbxml_validator/xml_colassign.xsd
Normal file
90
tools/dbxml_validator/xml_colassign.xsd
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Add a ColumnAssignmentType to the schema definition for SQL data-change
|
||||
statements in XML Query Language in XpressEngine.
|
||||
|
||||
XpressEngine is an open source framework for creating web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 08 mar 2012
|
||||
|
||||
Include graph:
|
||||
|
||||
+-- xml_create_table.xsd
|
||||
+-- xml_query.xsd
|
||||
+-- xml_datachange.xsd
|
||||
+-- xml_colassign.xsd *****
|
||||
+-- xml_insert_generic.xsd
|
||||
| +-- xml_insert.xsd
|
||||
| +-- xml_insert_select.xsd
|
||||
|
|
||||
+-- xml_select.xsd
|
||||
+-- xml_update.xsd
|
||||
+-- xml_delete.xsd
|
||||
|
||||
The ColumnAssignamentType allows a column to be assigned a value, to be
|
||||
used to describe INSERT and UPDATE statements.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<!--
|
||||
The main schema definition for the SQL data-change statements in XML
|
||||
Query language (this in turn includes the generic schema definition
|
||||
for the language).
|
||||
-->
|
||||
<xsd:include schemaLocation="xml_datachange.xsd" />
|
||||
|
||||
<xsd:complexType name="BaseColumnAssignamentType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Basic type for a column assignament in an
|
||||
UPDATE/INSERT.
|
||||
|
||||
Maybe an expression sub-query could be allowed here as the new
|
||||
column value.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="ColumnType">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="alias" use="prohibited" />
|
||||
<xsd:attribute name="click_count" use="prohibited" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ColumnAssignamentType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A column in a column assignament for an SQL UPDATE/INSERT
|
||||
statement.
|
||||
|
||||
"var" attribute is optional, if omitted the column name is
|
||||
the variable name.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="BaseColumnAssignamentType">
|
||||
<xsd:attribute name="var" type="xsd:string" use="optional" />
|
||||
<xsd:attributeGroup ref="argumentAttrs" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ColumnsAssignamentType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The list of column assignaments in an INSERT/UPDATE statement.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:element name="column" type="ColumnAssignamentType" minOccurs="1" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
132
tools/dbxml_validator/xml_create_table.xsd
Normal file
132
tools/dbxml_validator/xml_create_table.xsd
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
XML Schema Definition (.xsd) for the XML Schema Language for XpressEngine.
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
XML Schema Language currently supports SQL CREATE TABLE statements only.
|
||||
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 22 mar 2012
|
||||
|
||||
The types defined here closely model the behavior of php classes in
|
||||
classes/db/DB*.class.php
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:simpleType name="ColumnTypeType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Possible column types. Value "tinytext" is only supported by
|
||||
CUBRID.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="number" />
|
||||
<xsd:enumeration value="bignumber" />
|
||||
<xsd:enumeration value="varchar" />
|
||||
<xsd:enumeration value="char" />
|
||||
<xsd:enumeration value="text" />
|
||||
<xsd:enumeration value="bigtext" />
|
||||
<xsd:enumeration value="tinytext" /> <!-- CUBRID only -->
|
||||
<xsd:enumeration value="date" />
|
||||
<xsd:enumeration value="float" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="NameString">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Non-empty string (to be used as a name).
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:pattern value=".+" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="ColumnType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
XML Element type to represent a column definition in a
|
||||
SQL CREATE TABLE statement.
|
||||
|
||||
Attribute 'size' should only be used for string and numeric
|
||||
column types.
|
||||
|
||||
Attribute 'auto_increment' is only supported by SQL Server
|
||||
and mysql.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="xsd:anyType">
|
||||
<xsd:attribute name="name" use="required">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="NameString">
|
||||
<xsd:pattern value="([^sS].*)|([sS](([^eE].*)|([eE](([^qQ].*)|([qQ](([^uU].*)|([uU](([^eE].*)|([eE](([^nN].*)|([nN](([^cC].*)|([cC](([^eE].*)|([eE].+)?)?)?)?)?)?)?)?)?)?)?)?)?)?)?">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The table name "sequence" is reserved by XE.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:pattern>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="type" type="ColumnTypeType" use="required" />
|
||||
<xsd:attribute name="size" type="xsd:positiveInteger" />
|
||||
<xsd:attribute name="default" type="xsd:string" />
|
||||
<xsd:attribute name="notnull">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="notnull" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="primary_key">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="primary_key" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="index" type="NameString" />
|
||||
<xsd:attribute name="unique" type="NameString" />
|
||||
<xsd:attribute name="auto_increment">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="auto_increment" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="CreateTableType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="column" type="ColumnType" minOccurs="1" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:attribute name="name" type="NameString" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="table" type="CreateTableType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The document element, representing a SQL CREATE TABLE
|
||||
statement.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:key name="unique_column_names">
|
||||
<xsd:selector xpath="column" />
|
||||
<xsd:field xpath="@name" />
|
||||
</xsd:key>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
100
tools/dbxml_validator/xml_datachange.xsd
Normal file
100
tools/dbxml_validator/xml_datachange.xsd
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Add a DataChangeStatementTablesType to the main schema definition
|
||||
for XML Query Language in XpressEngine.
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
File: tools/xml_datachange.xsd
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 08 mar 2012
|
||||
|
||||
The components (clauses) for the SQL data-change statements (INSERT,
|
||||
UPDATE, DELETE) are built upon the general query/statement components
|
||||
defined in xml_query.xsd.
|
||||
|
||||
Include graph:
|
||||
|
||||
+-- xml_create_table.xsd
|
||||
+-- xml_query.xsd
|
||||
+-- xml_datachange.xsd *****
|
||||
+-- xml_colassign.xsd
|
||||
+-- xml_insert_generic.xsd
|
||||
| +-- xml_insert.xsd
|
||||
| +-- xml_insert_select.xsd
|
||||
|
|
||||
+-- xml_select.xsd
|
||||
+-- xml_update.xsd
|
||||
+-- xml_delete.xsd
|
||||
|
||||
DataChangeStatementTablesType is the type for the <tables>
|
||||
element in the data-change statements. This type only allows one named
|
||||
table as content, which is subject to the INSERT, UPDATE or DELETE.
|
||||
|
||||
Most SQL implementations do allow multi-table UPDATE and DELETE
|
||||
statements and the XML Query language can express multi-table UPDATEs.
|
||||
|
||||
Also adds the priority attribute to SqlStatementType, used by the
|
||||
data-change statements.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<!-- include the main schema definition for XML Query Language -->
|
||||
<xsd:redefine schemaLocation="xml_query.xsd">
|
||||
|
||||
<xsd:complexType name="SqlStatementType">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="SqlStatementType">
|
||||
<xsd:attribute name="priority" type="priorityAttributeType" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:redefine>
|
||||
|
||||
<xsd:simpleType name="priorityAttributeType">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="LOW" />
|
||||
<xsd:enumeration value="HIGH" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="DataChangeStatementTableType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A named table only, no subquery/alias/join-type ...
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="TableType">
|
||||
<xsd:all />
|
||||
|
||||
<xsd:attribute name="query" use="prohibited" />
|
||||
<xsd:attribute name="type" use="prohibited" />
|
||||
<xsd:attribute name="alias" use="prohibited" />
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="DataChangeStatementTablesType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A list of exactly one named table.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="TablesType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="table" type="DataChangeStatementTableType" minOccurs="1" />
|
||||
</xsd:sequence>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
||||
53
tools/dbxml_validator/xml_delete.xsd
Normal file
53
tools/dbxml_validator/xml_delete.xsd
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Redefines the main XML Query Language schema in XE to validate SQL DELETE
|
||||
statements.
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
File: tools/xml_delete.xsd
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 09 mar 2012
|
||||
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:redefine schemaLocation="xml_colassign.xsd">
|
||||
|
||||
<xsd:complexType name="SqlStatementType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Re-define SqlStatementType for a DELETE statement: include only the
|
||||
<tables>, <conditions> and <index_hint> elements.
|
||||
|
||||
<conditions> could be made a required element to prevent truncating
|
||||
an entire table by mistake.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlStatementType">
|
||||
<xsd:all>
|
||||
<xsd:element name="tables" type="DataChangeStatementTablesType" />
|
||||
<xsd:element name="conditions" type="ConditionsType" minOccurs="0" />
|
||||
<xsd:element name="index_hint" type="IndexHintsType" minOccurs="0" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="action" type="deleteActionAttributeType" use="required" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:redefine>
|
||||
|
||||
<xsd:simpleType name="deleteActionAttributeType">
|
||||
<xsd:restriction base="actionAttributeType">
|
||||
<xsd:pattern value="[Dd][Ee][Ll][Ee][Tt][Ee]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:element name="query" type="SqlStatementType" />
|
||||
</xsd:schema>
|
||||
43
tools/dbxml_validator/xml_insert.xsd
Normal file
43
tools/dbxml_validator/xml_insert.xsd
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Redefines the main XML Query Language schema in XpressEngine to
|
||||
validate a SQL plain INSERT statement (as opposed to an
|
||||
INSERT INTO.. SELECT.. statement).
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 09 mar 2012
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:redefine schemaLocation="xml_insert_generic.xsd">
|
||||
|
||||
<xsd:complexType name="SqlInsertStatementType">
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlInsertStatementType">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" type="ColumnsAssignamentType">
|
||||
<xsd:key name="distinct_column_names_list">
|
||||
<xsd:selector xpath="column" />
|
||||
<xsd:field xpath="@name" />
|
||||
</xsd:key>
|
||||
</xsd:element>
|
||||
<xsd:element name="tables" type="DataChangeStatementTablesType" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="action" type="plainInsertAttributeType" use="required" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:redefine>
|
||||
|
||||
<xsd:simpleType name="plainInsertAttributeType">
|
||||
<xsd:restriction base="insertGenericAttributeType">
|
||||
<xsd:pattern value="[Ii][Nn][Ss][Ee][Rr][Tt]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
45
tools/dbxml_validator/xml_insert_generic.xsd
Normal file
45
tools/dbxml_validator/xml_insert_generic.xsd
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Redefines the main XML Query Language schema in XpressEngine to
|
||||
validate SQL INSERT INTO.. VALUES... and INSERT INTO.. SELECT..
|
||||
statements.
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 09 mar 2012
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:include schemaLocation="xml_colassign.xsd" />
|
||||
|
||||
<xsd:simpleType name="insertGenericAttributeType">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:pattern value="[Ii][Nn][Ss][Ee][Rr][Tt]" />
|
||||
<xsd:pattern value="[Ii][Nn][Ss][Ee][Rr][Tt]-[Ss][Ee][Ll][Ee][Cc][Tt]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="SqlInsertStatementType">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" type="ColumnsAssignamentType">
|
||||
<xsd:key name="distinct_insert_column_names_list">
|
||||
<xsd:selector xpath="column" />
|
||||
<xsd:field xpath="@name" />
|
||||
</xsd:key>
|
||||
</xsd:element>
|
||||
<xsd:element name="tables" type="DataChangeStatementTablesType" />
|
||||
<xsd:element name="query" type="ExpressionSubqueryContents" minOccurs="0" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="id" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="action" type="insertGenericAttributeType" use="required" />
|
||||
<xsd:attribute name="priority" type="priorityAttributeType" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="query" type="SqlInsertStatementType" />
|
||||
|
||||
</xsd:schema>
|
||||
44
tools/dbxml_validator/xml_insert_select.xsd
Normal file
44
tools/dbxml_validator/xml_insert_select.xsd
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Redefines the main XML Query Language schema in XpressEngine to
|
||||
validate SQL INSERT.. SELECT.. statements (as opposed to a plain
|
||||
INSERT INTO.. VALUES.. statement).
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 09 mar 2012
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:redefine schemaLocation="xml_insert_generic.xsd">
|
||||
|
||||
<xsd:complexType name="SqlInsertStatementType">
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlInsertStatementType">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" type="ColumnsAssignamentType">
|
||||
<xsd:key name="distinct_column_names_list">
|
||||
<xsd:selector xpath="column" />
|
||||
<xsd:field xpath="@name" />
|
||||
</xsd:key>
|
||||
</xsd:element>
|
||||
<xsd:element name="tables" type="DataChangeStatementTablesType" />
|
||||
<xsd:element name="query" type="ExpressionSubqueryContents" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="action" type="insertSelectAttributeType" use="required" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:redefine>
|
||||
|
||||
<xsd:simpleType name="insertSelectAttributeType">
|
||||
<xsd:restriction base="insertGenericAttributeType">
|
||||
<xsd:pattern value="[Ii][Nn][Ss][Ee][Rr][Tt]-[Ss][Ee][Ll][Ee][Cc][Tt]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
801
tools/dbxml_validator/xml_query.xsd
Normal file
801
tools/dbxml_validator/xml_query.xsd
Normal file
|
|
@ -0,0 +1,801 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation xml:lang="en">
|
||||
XML Schema Definition (.xsd) for the XML Query Language for XpressEngine.
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 08 mar 2012
|
||||
|
||||
Strictly speaking the term "query language" is improper since the
|
||||
language also describes the SQL data change statements (INSERT, UPDATE,
|
||||
DELETE), not only query statements (SELECT).
|
||||
|
||||
Although SQL does not distinguish between the syntax of queries and
|
||||
sub-queries, the XML Query Language identifies 4 query types:
|
||||
- TableSubquery:
|
||||
- possibly empty (for a base table given by name)
|
||||
- abstract (used as a base for the TableType)
|
||||
- query navigation only (LIMIT, OFFSET)
|
||||
- ExpressionSubquery
|
||||
- should include at least a table
|
||||
- query nagivation only
|
||||
- Select-list subquery
|
||||
- should include at least a table
|
||||
- query nagivation only
|
||||
- optional alias
|
||||
- QueryStatement
|
||||
- should include at least a table
|
||||
- query navigation and pagination
|
||||
- 'id' and 'alias' attributes
|
||||
|
||||
The XML types hierarchy here shows as follows:
|
||||
|
||||
+-- VarNameDefaultType
|
||||
+-- SortColumnType
|
||||
|
|
||||
+-- MainStatementNavigationType
|
||||
| +-- SimpleQueryNavigationType
|
||||
|
|
||||
+-- SqlStatementContentModel (abstract)
|
||||
| +-- SqlStatementContents (abstract)
|
||||
| | +-- SqlQueryContents (abstract)
|
||||
| | | +-- SqlQueryType
|
||||
| | | +-- ExpressionSubqueryContents
|
||||
| | | +-- ExpressionSubqueryType
|
||||
| | +-- SqlStatementType
|
||||
| |
|
||||
| +-- SqlTableSubquery (abstract)
|
||||
| +-- TableType
|
||||
|
|
||||
+-- TablesType
|
||||
|
|
||||
+-- ColumnType
|
||||
+-- ColumnsType
|
||||
|
|
||||
+-- ConditionType
|
||||
+-- ConditionsGroupType
|
||||
+-- ConditionsType
|
||||
|
|
||||
+-- GroupType
|
||||
+-- GroupsType
|
||||
|
|
||||
+-- IndexHintType
|
||||
+-- IndexHintsType
|
||||
|
|
||||
+-- pipeAttributeType
|
||||
+-- dbTargetAttributeType (for db-specific index hints)
|
||||
+-- HintTypeAttributeType
|
||||
|
||||
+-- conditionAttrs (attribute group)
|
||||
+-- argumentAttrs (query-argument attributes)
|
||||
|
||||
The types defined here closely model the behavior of php classes in
|
||||
classes/xml/xmlquery/**/*.php
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexType name="VarNameDefaultType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Common XSD type for page-row-count/current-page/page-count elements
|
||||
that are empty and only take a variable name and/or a default as
|
||||
attributes.
|
||||
|
||||
Note that a variable name here means an index in a php array, which
|
||||
can be any string, not just an [a-zA-Z0-9_]* identifier.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="xsd:anyType">
|
||||
<xsd:attribute name="var" type="xsd:string" />
|
||||
<xsd:attribute name="default" type="xsd:unsignedLong" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="SortColumnType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A column name in an ORDER BY clause, given directly by name
|
||||
(default attribute) or in a variable (var attribute). Either
|
||||
one of the two attributes is required
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="xsd:anyType">
|
||||
<xsd:attribute name="var" type="xsd:string" />
|
||||
<xsd:attribute name="default" type="xsd:string" />
|
||||
<xsd:attribute name="order" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
XE treats the values "asc" and "desc" as the corresponding SQL
|
||||
keywords, while all the other values are taken as a parameter
|
||||
name.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="MainStatementNavigationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
XE sorting and paging for a main-statement query.
|
||||
|
||||
Defined as a sequence of choices so that the <index> element
|
||||
can appear more than once.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="index" type="SortColumnType" />
|
||||
<xsd:element name="list_count" type="VarNameDefaultType" />
|
||||
<xsd:element name="page" type="VarNameDefaultType" />
|
||||
<xsd:element name="page_count" type="VarNameDefaultType" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="SimpleQueryNavigationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Sub-queries do not include a page_count
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="MainStatementNavigationType">
|
||||
<xsd:sequence>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="index" type="SortColumnType" />
|
||||
<xsd:element name="list_count" type="VarNameDefaultType" />
|
||||
<xsd:element name="page" type="VarNameDefaultType" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="SqlStatementContentModel" abstract="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The base of the SQL query and statement type hierarchy in the XML
|
||||
query language.
|
||||
|
||||
References all possible SQL stetement clauses, while none of them
|
||||
is declared as required. It is the most generic SQL statement or
|
||||
query type, though no such SQL statement instantiates it directly.
|
||||
|
||||
The <index_hint> element could be allowed to appear multiple
|
||||
times, in case different hints for different databases will be
|
||||
allowed by the syntax.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" minOccurs="0" type="ColumnsType" />
|
||||
<xsd:element name="tables" minOccurs="0" type="TablesType">
|
||||
<xsd:unique name="table_aliases">
|
||||
<xsd:selector xpath="table" />
|
||||
<xsd:field xpath="@alias" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="conditions" minOccurs="0" type="ConditionsType" />
|
||||
<xsd:element name="groups" minOccurs="0" type="GroupsType">
|
||||
<xsd:unique name="statement_content_model_groups">
|
||||
<xsd:selector xpath="group" />
|
||||
<xsd:field xpath="@column" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="navigation" minOccurs="0" type="MainStatementNavigationType" />
|
||||
<xsd:element name="index_hint" minOccurs="0" type="IndexHintsType" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="SqlStatementContents" abstract="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
An SQL generic DELETE, UPDATE, INSERT or SELECT statement.
|
||||
The only common clause for these statements is the table-specification,
|
||||
for which reason the <tables> element is the only one required by
|
||||
the syntax
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlStatementContentModel">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" minOccurs="0" type="ColumnsType" />
|
||||
<xsd:element name="tables" minOccurs="1" type="TablesType">
|
||||
<xsd:unique name="table_aliases2">
|
||||
<xsd:selector xpath="table" />
|
||||
<xsd:field xpath="@alias" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="conditions" minOccurs="0" type="ConditionsType" />
|
||||
<xsd:element name="groups" minOccurs="0" type="GroupsType">
|
||||
<xsd:unique name="statement_contents_groups">
|
||||
<xsd:selector xpath="group" />
|
||||
<xsd:field xpath="@column" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="navigation" minOccurs="0" type="MainStatementNavigationType" />
|
||||
<xsd:element name="index_hint" minOccurs="0" type="IndexHintsType" />
|
||||
</xsd:all>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="SqlQueryContents" abstract="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
An SQL SELECT statement (used to form sub-queries), represented as
|
||||
a case of (derived from) a generic SQL statement.
|
||||
|
||||
In adition to the the table-specification required by the base
|
||||
SqlStatementContents type, SQL queries also require a select-list.
|
||||
This, however is implied to be "*" if missing.
|
||||
So this type is the same as its base type, but is keep to represent
|
||||
a SQL query, as opposed to a generic SQL statement.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlStatementContents">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" minOccurs="0" type="ColumnsType" />
|
||||
<xsd:element name="tables" minOccurs="1" type="TablesType">
|
||||
<xsd:unique name="table_aliases3">
|
||||
<xsd:selector xpath="table" />
|
||||
<xsd:field xpath="@alias" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="conditions" minOccurs="0" type="ConditionsType" />
|
||||
<xsd:element name="groups" minOccurs="0" type="GroupsType">
|
||||
<xsd:unique name="query_contents_groups">
|
||||
<xsd:selector xpath="group" />
|
||||
<xsd:field xpath="@column" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="navigation" minOccurs="0" type="SimpleQueryNavigationType" />
|
||||
<xsd:element name="index_hint" minOccurs="0" type="IndexHintsType" />
|
||||
</xsd:all>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="SqlTableSubquery">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Content model for <table> element. The <table> element may stand
|
||||
for one of:
|
||||
- a base table or view, with only a table name and an optional alias,
|
||||
- a base table in a join, with the table name and join type attributes,
|
||||
and the join conditions as content,
|
||||
- a sub-query, with the contents of a query and the alias attribute.
|
||||
|
||||
Note that the current syntax provides no means to express a joined sub-query.
|
||||
Also the schema definition syntax (XSD) does not allow rules to enforce
|
||||
exactly one of the above cases in a given element, but rather to only express
|
||||
the sum (union) of all 3 cases for the <table> element.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlStatementContentModel">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" minOccurs="0" type="ColumnsType" />
|
||||
<xsd:element name="tables" minOccurs="0" type="TablesType">
|
||||
<xsd:unique name="table_aliases4">
|
||||
<xsd:selector xpath="table" />
|
||||
<xsd:field xpath="@alias" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="conditions" minOccurs="0" type="ConditionsType" />
|
||||
<xsd:element name="groups" minOccurs="0" type="GroupsType">
|
||||
<xsd:unique name="table_subquery_groups">
|
||||
<xsd:selector xpath="group" />
|
||||
<xsd:field xpath="@column" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="navigation" minOccurs="0" type="SimpleQueryNavigationType" />
|
||||
<xsd:element name="index_hint" minOccurs="0" type="IndexHintsType" />
|
||||
</xsd:all>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="actionAttributeType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation xmlns:lang="en">
|
||||
There are many more SQL statement types defined by the SQL language, but
|
||||
currently the above 4 types are supported by the XML Query language in XE.
|
||||
|
||||
However certain SQL CREATE statements are also supported in the XML
|
||||
Schema Language in XE.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:Name">
|
||||
<xsd:pattern value="[dD][eE][lL][eE][tT][eE]" />
|
||||
<xsd:pattern value="[uU][pP][dD][aA][tT][eE]" />
|
||||
<xsd:pattern value="[sS][eE][lL][eE][cC][tT]" />
|
||||
<xsd:pattern value="[iI][nN][sS][eE][rR][tT]" />
|
||||
<xsd:pattern value="[iI][nN][sS][eE][rR][tT]-[sS][eE][lL][eE][cC][tT]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="SqlStatementType">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="SqlStatementContents">
|
||||
<xsd:attribute name="id" type="xsd:Name" use="required" />
|
||||
<xsd:attribute name="action" type="actionAttributeType" use="required">
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="SqlQueryType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element type for a SQL sub-query in the SELECT list or an expression.
|
||||
Subqueries directly in the FROM clause are expressed by TableType.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="SqlQueryContents">
|
||||
<xsd:attribute name="alias" type="xsd:string" use="optional" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ExpressionSubqueryContents">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Base type for expression sub-queries (used in <condition>s),
|
||||
which have no alias.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlQueryType">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" minOccurs="0" type="ColumnsType" />
|
||||
<xsd:element name="tables" minOccurs="1" type="TablesType">
|
||||
<xsd:unique name="table_aliases5">
|
||||
<xsd:selector xpath="table" />
|
||||
<xsd:field xpath="@alias" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="conditions" minOccurs="0" type="ConditionsType" />
|
||||
<xsd:element name="groups" minOccurs="0" type="GroupsType">
|
||||
<xsd:unique name="expression_subquery_groups">
|
||||
<xsd:selector xpath="group" />
|
||||
<xsd:field xpath="@column" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="navigation" minOccurs="0" type="SimpleQueryNavigationType" />
|
||||
<xsd:element name="index_hint" minOccurs="0" type="IndexHintsType" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="alias" type="xsd:string" use="prohibited" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ColumnsType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Columns list for a SELECT, UPDATE, INSERT statement
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="column" type="ColumnType" />
|
||||
<xsd:element name="query" type="SqlQueryType" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ColumnType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A column name for a SELECT, UPDATE, INSERT statement.
|
||||
SELECT statements can have a (simple) expression as the column
|
||||
name and can have an alias.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="xsd:anyType">
|
||||
<xsd:attribute name="name" type="xsd:string" use="optional" />
|
||||
<xsd:attribute name="alias" type="xsd:string" use="optional" />
|
||||
<xsd:attribute name="click_count" type="xsd:unsignedLong" use="optional" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TablesType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
For table subqueries use <table query="true">.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:element name="table" type="TableType" maxOccurs="unbounded" />
|
||||
<!-- <xsd:element name="query" type="QueryType" /> -->
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TableType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A <table> should include the content of a query if the table is a
|
||||
subquery, that is if it also specifies the query="true" attribute.
|
||||
|
||||
A <table> that specifies type="join-type..." for joining with other
|
||||
tables, should include a <conditions> element with the join
|
||||
condition(s).
|
||||
|
||||
The particular SqlTableSubquery type is defined and needed for the base
|
||||
type, instead of the general SqlQueryType, becase the contents of a
|
||||
<table> element can still be empty in case of a base table, while a
|
||||
subquery always has a FROM clause and a select list.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="SqlTableSubquery">
|
||||
<xsd:attribute name="query" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Only the query="true" value should be used. The false
|
||||
value is listed here just for completeness.
|
||||
|
||||
The query and name attributes should be mutually exclusive;
|
||||
a sub-query should only use aliases, that is the alias
|
||||
attribute, instead of name.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:Name">
|
||||
<xsd:enumeration value="false" />
|
||||
<xsd:enumeration value="true" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
|
||||
<xsd:attribute name="name" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
With the use of proper quoting, almost any string can be a SQL
|
||||
(table) name (the exceptions are certain clases of Unicode
|
||||
characters listed in the SQL standard).
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
|
||||
<xsd:attribute name="alias" type="xsd:string" use="optional" />
|
||||
|
||||
<xsd:attribute name="type" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Attributes "type" and "query" should be mutually exclusive, since both
|
||||
of them require the same <conditions> element in the content for
|
||||
the <table>, but for different purposes.
|
||||
|
||||
The type="inner join" and type="full outer join" cases are not
|
||||
implemented.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<!-- <xsd:enumeration value="inner join" /> -->
|
||||
<xsd:enumeration value="left join" />
|
||||
<xsd:enumeration value="left outer join" />
|
||||
<xsd:enumeration value="right join" />
|
||||
<xsd:enumeration value="right outer join" />
|
||||
<!-- <xsd:enumeration value="outer join" /> -->
|
||||
<!-- <xsd:enumeration value="full outer join" /> -->
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ConditionsType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Condition expressions in a WHERE clause. Using the <group>
|
||||
element is simillar to using parentheses in SQL.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="condition" type="ConditionType" />
|
||||
<xsd:element name="query" type="ExpressionSubqueryType" />
|
||||
<xsd:element name="group" type="ConditionsGroupType" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="pipeAttributeType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
SQL logical operators AND and OR.
|
||||
|
||||
Most database systems also support the non-standard operator XOR,
|
||||
but Transact-SQL just claims the bitwise operator ^ can be used
|
||||
instead, and does not provide XOR.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:pattern value="[aA][nN][dD]" />
|
||||
<xsd:pattern value="[oO][rR]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:attributeGroup name="conditionAttrs">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Attributes to describe a SQL sub-expression, common to simple subexpression
|
||||
and to subexpressions with a subquery as operand
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:attribute name="operation" use="required">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="equal" />
|
||||
<xsd:enumeration value="notequal" />
|
||||
<xsd:enumeration value="excess" />
|
||||
<xsd:enumeration value="more" />
|
||||
<xsd:enumeration value="below" />
|
||||
<xsd:enumeration value="less" />
|
||||
<xsd:enumeration value="below" />
|
||||
<xsd:enumeration value="null" />
|
||||
<xsd:enumeration value="notnull" />
|
||||
<xsd:enumeration value="in" />
|
||||
<xsd:enumeration value="notin" />
|
||||
<xsd:enumeration value="and" />
|
||||
<xsd:enumeration value="or" />
|
||||
<xsd:enumeration value="xor" />
|
||||
<xsd:enumeration value="not" />
|
||||
<xsd:enumeration value="between" />
|
||||
<xsd:enumeration value="like" />
|
||||
<xsd:enumeration value="like_prefix" />
|
||||
<xsd:enumeration value="like_tail" />
|
||||
<xsd:enumeration value="notlike" />
|
||||
<xsd:enumeration value="notlike_prefix" />
|
||||
<xsd:enumeration value="notlike_tail" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
|
||||
<xsd:attribute name="column" type="xsd:string" use="required" />
|
||||
|
||||
<xsd:attribute name="pipe" type="pipeAttributeType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The pipe attribute is only optional when there is one condition
|
||||
in the <conditions> / <group> element.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:attributeGroup name="argumentAttrs">
|
||||
<xsd:attribute name="filter">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="email" />
|
||||
<xsd:enumeration value="email_address" />
|
||||
<xsd:enumeration value="homepage" />
|
||||
<xsd:enumeration value="userid" />
|
||||
<xsd:enumeration value="user_id" />
|
||||
<xsd:enumeration value="number" />
|
||||
<xsd:enumeration value="numbers" />
|
||||
<xsd:enumeration value="alpha" />
|
||||
<xsd:enumeration value="alpha_number" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
|
||||
<xsd:attribute name="default" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Certain values have special meaning:
|
||||
- ipaddress()
|
||||
- unixtime()
|
||||
- curdate()
|
||||
- plus(int count)
|
||||
- minus(int count)
|
||||
- multiply(int count)
|
||||
- sequence()
|
||||
|
||||
However these values are only special to XE, while for the schema
|
||||
definition they are strings.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
|
||||
<xsd:attribute name="notnull">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="notnull" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
|
||||
<xsd:attribute name="minlength" type="xsd:unsignedLong" />
|
||||
<xsd:attribute name="maxlength" type="xsd:unsignedLong" />
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:complexType name="ExpressionSubqueryType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element type for sub-expresions with a subquery term.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="ExpressionSubqueryContents">
|
||||
<xsd:attributeGroup ref="conditionAttrs" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ConditionType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Currently only conditions of the form:
|
||||
"column" op var_name
|
||||
"column" op (sub-query)
|
||||
are allowed by the XML query language syntax.
|
||||
|
||||
The <query> element should only be provided as content if
|
||||
var or default attributes are not provided.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="xsd:anyType">
|
||||
<xsd:attributeGroup ref="conditionAttrs" />
|
||||
|
||||
<xsd:attribute name="var" type="xsd:string" use="optional" />
|
||||
|
||||
<xsd:attributeGroup ref="argumentAttrs" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ConditionsGroupType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Groups of conditions in a WHERE clause.
|
||||
Same as the global ConditionsType, plus the pipe="and|or" attribute.
|
||||
|
||||
The pipes attribute is only optional in the (unlikely) case that the
|
||||
<conditions> element contains only the group.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="ConditionsType">
|
||||
<xsd:attribute name="pipe" type="pipeAttributeType" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="GroupsType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The GROUP BY clase.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:element name="group" type="GroupType" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="GroupType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A column name in the GROUP BY clause.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="xsd:anyType">
|
||||
<xsd:attribute name="column" type="xsd:string" use="required" />
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="dbTargetAttributeType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Possible values for the "for" attribute on <index> hint
|
||||
elements in <index_hint>.
|
||||
|
||||
Specifies one of the possible databases supported by XE
|
||||
(database targets) or ALL.
|
||||
|
||||
Currently the 'ALL' value must be uppercase, although the database
|
||||
types (mysql, mssql, cubrid) are case-insensitive.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:pattern value="ALL" />
|
||||
<xsd:pattern value="[Cc][Uu][Bb][Rr][Ii][Dd]" />
|
||||
<xsd:pattern value="[Mm][Yy][Ss][Qq][Ll]" />
|
||||
<xsd:pattern value="[Mm][Ss][Ss][Qq][Ll]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="HintTypeAttributeType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Possible index hint types: IGNORE, USE or FORCE.
|
||||
|
||||
Only mysql makes effective use of hints to IGNORE an index,
|
||||
while mssql and CUBRID discard such hints, meaning the index
|
||||
might still be used.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="IGNORE" />
|
||||
<xsd:enumeration value="USE" />
|
||||
<xsd:enumeration value="FORCE" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="IndexHintsType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
List of index hints, either for a specific database, or for any database.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:element name="index" type="IndexHintType" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:attribute name="for" type="dbTargetAttributeType" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="IndexHintType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Hint to use/not-use a certain index for a certain table in a query or in
|
||||
a statement.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="xsd:anyType">
|
||||
<xsd:attribute name="table" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="type" type="HintTypeAttributeType" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
||||
57
tools/dbxml_validator/xml_select.xsd
Normal file
57
tools/dbxml_validator/xml_select.xsd
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Redefines the main XML Query Language schema in XE to validate SQL SELECT
|
||||
statements.
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
File: tools/xml_select.xsd
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 08 mar 2012
|
||||
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:redefine schemaLocation="xml_colassign.xsd">
|
||||
|
||||
<xsd:complexType name="SqlStatementType">
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="SqlStatementType">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" minOccurs="0" type="ColumnsType" />
|
||||
<xsd:element name="tables" minOccurs="1" type="TablesType">
|
||||
<xsd:unique name="table_aliases6">
|
||||
<xsd:selector xpath="table" />
|
||||
<xsd:field xpath="@alias" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="conditions" minOccurs="0" type="ConditionsType" />
|
||||
<xsd:element name="groups" minOccurs="0" type="GroupsType">
|
||||
<xsd:unique name="sql_statement_groups">
|
||||
<xsd:selector xpath="group" />
|
||||
<xsd:field xpath="@column" />
|
||||
</xsd:unique>
|
||||
</xsd:element>
|
||||
<xsd:element name="navigation" minOccurs="0" type="MainStatementNavigationType" />
|
||||
<xsd:element name="index_hint" minOccurs="0" type="IndexHintsType" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="action" type="selectActionAttributeType" use="required" />
|
||||
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:redefine>
|
||||
|
||||
<xsd:simpleType name="selectActionAttributeType">
|
||||
<xsd:restriction base="actionAttributeType">
|
||||
<xsd:pattern value="[sS][eE][lL][eE][cC][tT]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:element name="query" type="SqlStatementType" />
|
||||
|
||||
</xsd:schema>
|
||||
45
tools/dbxml_validator/xml_update.xsd
Normal file
45
tools/dbxml_validator/xml_update.xsd
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Redefines the main XML Query Language schema in XE to validate SQL UPDATE
|
||||
statements.
|
||||
|
||||
XpressEngine is an open source framework for creating your web sites.
|
||||
http://xpressengine.org/
|
||||
|
||||
Author: Adrian Constantin, Arnia Software (adrian.constantin@arnia.ro)
|
||||
Date: 09 mar 2012
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:include schemaLocation="xml_colassign.xsd" />
|
||||
|
||||
<xsd:simpleType name="updateActionAttributeType">
|
||||
<xsd:restriction base="actionAttributeType">
|
||||
<xsd:pattern value="[Uu][Pp][Dd][Aa][Tt][Ee]" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="SqlUpdateStatementType">
|
||||
<xsd:all>
|
||||
<xsd:element name="columns" type="ColumnsAssignamentType">
|
||||
<xsd:key name="distinct_column_names_list">
|
||||
<xsd:selector xpath="column" />
|
||||
<xsd:field xpath="@name" />
|
||||
</xsd:key>
|
||||
</xsd:element>
|
||||
<xsd:element name="tables" type="TablesType" />
|
||||
<xsd:element name="conditions" type="ConditionsType" minOccurs="0" />
|
||||
<xsd:element name="index_hint" type="IndexHintsType" minOccurs="0" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="id" type="xsd:string" />
|
||||
<xsd:attribute name="action" type="updateActionAttributeType" />
|
||||
<xsd:attribute name="priority" type="priorityAttributeType" />
|
||||
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="query" type="SqlUpdateStatementType" />
|
||||
|
||||
</xsd:schema>
|
||||
BIN
tools/dbxml_validator/xsd_types.dia
Normal file
BIN
tools/dbxml_validator/xsd_types.dia
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue