Identifies the destination (target) of script processing. This could be a file, named temporary stream or database. So, results of SQL processing and / or the selected transformation will be stored into the file, stream or database that is specified here. This element has almost the same syntax as source element with some exceptions (see below).
<?xml version="1.0" ?> <xsqlt> <script name="script-title"> <source> ... </source> <xsql> ... </xsql> <transform> ... </transform> <destination kind="file|stream|oledb"> filename | stream-identifier | <connection-string>oledb-connection-string</connection-string> </destination> </script> <script> ... </script> ... </xsqlt>
This attribute defines the destination type. It can contain one of the following values:
- file (default) - destination is a file specified in the text of the destination element (path can be relative to the current directory)
- stream - destination is a named temporary stream, which identifier is specified in the text of the destination element
- oledb - destination is a database, connected via ADO DB technology. Connection options have to be defined in connection-string child element
Unlike the source element, the destination does not use an encoding attribute. This is by design, because in the context of X-SQLT language, the target encoding should be defined in the transformation section of the script.
What is a named stream?
As you can see, X-SQLT supports named streams, that can be used to comfortably link results of individual scripts into the complex chain. Thanks to this feature you can easily produce even very complicated transformations, that cannot be made in one step (via individual supported technologies and rules).
The stream that is instantiated in destination element, can be used as a source for any subsequent script. You can freely reuse the same name of the stream in another destination element (the stream will be then overwritten with new data).
Because X-SQLT language rules require the source element to be presented in each script, there could be no possibility to execute projects without existing file or database (or any other supported source kind). The solution is one predefined stream named "xStream". This stream is initialized at the beginning of project execution, so you can freely refer to it as a source in the project scripts.
- As stated above, the text of source element can contain a filename or stream identifier, if the kind attribute declares the source as a file, or stream respectively. The path of specified file can be relative to the current directory.
- If the database engine, you use to connect to desired database, supports connecting via complex connection string, you can specify such a string in the text of this element. For example, Microsoft ADO uses such a mechanism.
- See script.