Axional StudioXSQL-Script allows the use of exceptions through the sentence <try>. The use of exeptions is an improvement of the error treatment. In some cases, it is possible to avoid that the script which is being interpreted causes a error situation. When a code line causes an unexpected situation, the exception is thrown (XSQLScriptRunner creates an instance of the Exception class), which is captured, performing a set of corrective actions to restore the normal situation.
For the cases in which it is not possible to prepare the statement and the system can not determine it automatically, you should indicate in the same attribute variable prepare with the value false, as for example:
<exp /> !
<lang id='id' /> !
|Acode||string||Adds a string to the status of the error.|
|Eexp||string||Message to show in the issuance of the exception.|
|Elang||string||Message to show in the issuance of the exception, depending on the language of the user.|
|Aid||string||Language code, to which the text to show is associated.|
Issuance of an error message, in an unique language.
<xsql-script name='exception_sample1'> <body> <null name='code' /> <if> <expr><isnull><code/></isnull></expr> <then> <exception>inexisting code</exception> </then> </if> </body> </xsql-script>
The completion of the execution of the script is conditionned on if the content of the variable code is null.
Issuance of an error message, depending on the user's language.
<xsql-script name='exception_sample2'> <body> <null name='code' /> <if> <expr><isnull><code/></isnull></expr> <then> <exception> <lang id='en'>codigo inexistente</lang> <lang id='ca'>codi inexistent</lang> <lang id='es'>Non-existent code</lang> </exception> </then> </if> </body> </xsql-script>
The completion of the execution of the script is conditionned on if the content of the variable code is null. The issuance of a message or another will depend of the user's language which executes the process.