X-SQLT syntax, that is based on XML, defines the tag and attribute names, that should be used for declared language elements and processing options.
X-SQLT language is stated as "free-form", that means the syntax can be extended by your own elements and attributes (to perform custom tasks in your own products or processing scenarios), but the pre-defined identifiers should not be renamed nor used in different meaning than specified in this reference (otherwise you could not use official processors and tools).
XML document written in X-SQLT language is called project. The following section displays complete X-SQLT project syntax in the form of "definition by example".
X-SQLT Project Syntax
<?xml version="1.0" encoding="utf-8|windows-1250|..."?>
<xsqlt name="project-title">
<description>project-description</description>
<parameters>
<parameter1 alias="parameter-title" kind="string|text|integer|float|date|time|datetime|binary|boolean">value</parameter1>
<parameter2>...</parameter2>
<source-param1 alias="..." kind="..."/>
...
</parameters>
<script name="script-title" test="condition-to-execute">
<source kind="file|stream|oledb" encoding="input-encoding">
filename |
stream-identifier |
<connection-string>oledb-connection-string</connection-string> |
<server>database-server</server>
<database>database-name</database>
<username encoded="0|1">user-name</username>
<password encoded="0|1">password</password>
<role>role-name</role>
</source>
<xsql kind="file|inline|stream" one-transaction="0|1" cmd-id="sql-command-identifier">
(x)sql-script-filename | (x)sql-stream-identifier |
inline-sql-script |
<sqlCommandDDL after-open="0|1">SET NULL OFF;</sqlCommandDDL>
<sqlCommand1 no-write="0|1">SELECT * FROM TableA WHERE id=:parameter1 ...</sqlCommand1>
<sqlCommand2 test=":sqlCommand1$id=0">
SELECT id,name FROM TableB ...
<sqlCommand3 record-tag="xml-record-tag">SELECT * FROM TableC WHERE id=:sqlCommand2$id ...</sqlCommand3>
</sqlCommand2>
<sqlCommandCSV>UPDATE TableC SET info=:source$info WHERE id=:source$1</sqlCommandCSV>
<sqlCommandXML>UPDATE TableC SET info=:source$info$data WHERE id=:source$id</sqlCommandXML>
...
<sqlCommandDDL2 before-close="0|1">SET NULL ON;</sqlCommandDDL2>
</xsql>
<transform kind="xml|xslt|xpath|csv|json|VBScript|JScript|..."
encoding="output-encoding"
namespaces="xml-namespaces" sel-namespaces="xml-selection-namespaces"
record-tag="xml-record-tag" include-params="0|1"
flat-text="0|1" delimiter="csv-delimiter" quote="csv-quote" header-row="0|1">
transformation-source-file | transformation-source-stream-identifier |
XPath expression(s) |
<![CDATA[
transformation-source-inline
]]>
</transform>
<destination kind="file|stream|oledb">
filename |
stream-identifier |
<connection-string>oledb-connection-string</connection-string> |
<server>database-server</server>
<database>database-name</database>
<username encoded="0|1">user-name</username>
<password encoded="0|1">password</password>
<role>role-name</role>
</destination>
</script>
<script>
...
</script>
...
</xsqlt>
Description
- <xsqlt>
- This is the root element of X-SQLT project. It can contain description element, parameters element and any number of script elements. See xsqlt.
- <description>
- Represents a detailed description of the project. This element is optional. See description.
- <parameters>
- This element holds the list of parameters and their options. This element is optional. See parameters.
- <parameter>
- This kind of element describes the meaning of parameter, declares the parameter data type can it can also hold the parameter default value. All parameter elements are optional, but when using the parameters in conclusion with some database engines, you have to define at least the parameter data type to successfully execute your project. See parameter.
- <script>
- Script elements are essential components of the project. They define what and how will be processed and where to store results of this processing. Each script element consists of the source, xsql, transform and destination sections (elements). You can define as many script elements as you want in the project. See script.
- <source>
- Identifies the source of script processing. kind attribute defines the source type. Based on the given kind, the element can contain text or other child elements, that specify the source options. See source.
- <xsql>
- Element is applicable only there, where the database source or database destination is used. It declares the SQL script, that will be executed over the given source database. This could be a standard SQL script or extended SQL script. See xsql element description.
- <sqlCommand>
- All nodes under xsql element are considered as SQL commands. There are no restrictions for naming these elements, except the XML conventions. See the syntax of xsql element to learn more.
- <transform>
- Specifies the transformation options. Transformation is applied on the source file, or stream, or on the results of SQL processing, based on the kind of source and on the presence of xsql element in the script. Proposed transformation kinds are for example xslt, xpath, xml, json, VBScript, etc. See transform.
- <destination>
- Identifies the destination (target) of script processing. This could be a file, named temporary stream or database. The syntax is almost the same as for source element. See destination.
See also