Revision: 3126
http://openutils.svn.sourceforge.net/openutils/?rev=3126&view=rev
Author: dfghi
Date: 2010-11-05 16:25:09 +0000 (Fri, 05 Nov 2010)
Log Message:
-----------
DBMIGRATION-6 Added the "splitChar" property so the user can set different split chars for statements.
Modified Paths:
--------------
trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/BaseConditionalTask.java
Modified: trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/BaseConditionalTask.java
===================================================================
--- trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/BaseConditionalTask.java 2010-10-28 07:59:38 UTC (rev 3125)
+++ trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/BaseConditionalTask.java 2010-11-05 16:25:09 UTC (rev 3126)
@@ -52,6 +52,12 @@
*/
protected String ddl;
+ /**
+ * Character used to split ddl statement, default is ";" char.
+ * Null or empty value disable split.
+ */
+ protected String splitChar = ";";
+
/**
* If <code>true</code> executes only if check returned <code>false</code>
*/
@@ -83,6 +89,14 @@
{
this.ddl = ddls;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void setSplitChar(String splitChar)
+ {
+ this.splitChar = splitChar;
+ }
/**
* Sets the not.
@@ -229,7 +243,15 @@
*/
protected void executeSingle(SimpleJdbcTemplate jdbcTemplate, String scriptContent)
{
- String[] ddls = StringUtils.split(performSubstitution(scriptContent), ';');
+ String[] ddls;
+ if (StringUtils.isNotEmpty(splitChar))
+ {
+ ddls = StringUtils.split(performSubstitution(scriptContent), splitChar);
+ }
+ else
+ {
+ ddls = new String[]{performSubstitution(scriptContent)};
+ }
for (String statement : ddls)
{
if (StringUtils.isNotBlank(statement))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|