diff --git a/docs/sql.html b/docs/sql.html index 9f150c0ee..ec12391c8 100644 --- a/docs/sql.html +++ b/docs/sql.html @@ -10,6 +10,12 @@
Multiple statements can be set and each statement is delimited from the next use a semi-colon. Individual lines within the statements can be commented using either -- or // at the start of the line.
The auto-commit attribute specifies whether auto commit should be turned on or off whilst executing the statements. If auto-commit is turned on each statement will be executed and commited. If it is turned off the statements will all be executed as one transaction.
+ +The onerror attribute specifies how to preceed when an error occurs during the execution of one of the statements. +The possible values are: continue execution, only show the error; +stop execution and commit transaction; +and abort execution and transaction and fail task. +
Classpath used to load driver | No (use system classpath) | |
onerror | +Action to perform when statement fails: continue, stop, abort | +No, default "abort" | +
rdbms | +Execute task only if this rdbms | +No (no restriction) | +
version | +Execute task only if rdbms version match | +No (no restriction) | +
Use nested <transaction>
+elements to specify multiple blocks of commands to the executed
+executed in the same connection but different transactions. This
+is particularly usefull when there are multiple files to execute
+on the same schema.
Attribute | +Description | +Required | +
src | +File containing sql statements | +Yes, unless statements enclosed within tags | +
Sql
's classpath attribute is a PATH like structure and can also be set via a nested
+classpath element. It is used to load the JDBC classes.
+The +
+<sql @@ -114,6 +162,22 @@ update some_table set column1 = column1 + 1 where column2 < 42; ]]></sql>
The following connects to the database given in url as the sa user using the org.database.jdbcDriver and executes the sql statements contained within the files data1.sql, data2.sql and data3.sql and then executes the truncate operation on some_other_table.
+ ++<sql + driver="org.database.jdbcDriver" + url="jdbc:database-url" + userid="sa" + password="pass" > + <transaction src="data1.sql" /> + <transaction src="data2.sql" /> + <transaction src="data3.sql" /> + <transaction> + truncate table some_other_table; + </transaction> +</sql> +
The following connects to the database given in url as the sa user using the org.database.jdbcDriver and executes the sql statements contained within the file data.sql, with output piped to outputfile.txt, searching /some/jdbc.jar as well as the system classpath for the driver class.
+<sql @@ -131,6 +195,25 @@ update some_table set column1 = column1 + 1 where column2 < 42; </sql>
The following will only execute if the RDBMS is "oracle" and the version starts with "8.1."
+ ++<sql + driver="org.database.jdbcDriver" + url="jdbc:database-url" + userid="sa" + password="pass" + src="data.sql" + rdbms="oracle" + version="8.1." + > +insert +into table some_table +values(1,2,3,4); + +truncate table some_other_table; +</sql> +