ASF Bugzilla – Attachment 17822 Details for
Bug 38807
Add an errorproperty parameter to <sql> task, like the junit task's
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 1.6.x branch
SQLExec.diff (text/plain), 3.14 KB, created by
Andrew Stevens
on 2006-03-03 02:27:38 UTC
(
hide
)
Description:
Patch for 1.6.x branch
Filename:
MIME Type:
Creator:
Andrew Stevens
Created:
2006-03-03 02:27:38 UTC
Size:
3.14 KB
patch
obsolete
>Index: SQLExec.java >=================================================================== >--- SQLExec.java (revision 381936) >+++ SQLExec.java (working copy) >@@ -84,8 +84,6 @@ > } > } > >- >- > private int goodSql = 0; > > private int totalSql = 0; >@@ -146,7 +144,6 @@ > */ > private File output = null; > >- > /** > * Action to perform if an error is found > **/ >@@ -175,6 +172,16 @@ > private boolean escapeProcessing = true; > > /** >+ * The name of the property to set in the event of an error >+ */ >+ private String errorProperty = null; >+ >+ /** >+ * The name of the property to set in the event of a warning >+ */ >+ private String warningProperty = null; >+ >+ /** > * Set the name of the SQL file to be run. > * Required unless statements are enclosed in the build file > */ >@@ -273,7 +280,6 @@ > this.append = append; > } > >- > /** > * Action to perform when statement fails: continue, stop, or abort > * optional; default "abort" >@@ -302,6 +308,26 @@ > } > > /** >+ * Property to set to "true" if a statement throws an error. >+ * >+ * @param errorProperty the name of the property to set in the >+ * event of an error. >+ */ >+ public void setErrorProperty(String errorProperty) { >+ this.errorProperty = errorProperty; >+ } >+ >+ /** >+ * Property to set to "true" if a statement produces a warning. >+ * >+ * @param warningProperty the name of the property to set in the >+ * event of a warning. >+ */ >+ public void setWarningProperty(String warningProperty) { >+ this.warningProperty = warningProperty; >+ } >+ >+ /** > * Load the sql file and then execute it > */ > public void execute() throws BuildException { >@@ -478,7 +504,6 @@ > } > } > >- > /** > * Exec the sql statement. > */ >@@ -528,12 +553,18 @@ > SQLWarning warning = conn.getWarnings(); > while (warning != null) { > log(warning + " sql warning", Project.MSG_VERBOSE); >+ if (warningProperty != null && !warningProperty.trim().equals("")) { >+ getProject().setNewProperty(warningProperty.trim(), "true"); >+ } > warning = warning.getNextWarning(); > } > conn.clearWarnings(); > goodSql++; > } catch (SQLException e) { > log("Failed to execute: " + sql, Project.MSG_ERR); >+ if (errorProperty != null && !errorProperty.trim().equals("")) { >+ getProject().setNewProperty(errorProperty.trim(), "true"); >+ } > if (!onError.equals("continue")) { > throw e; > } >@@ -629,14 +660,16 @@ > private String tSqlCommand = ""; > > /** >- * >+ * Set the source file attribute. >+ * @param src the source file > */ > public void setSrc(File src) { > this.tSrcFile = src; > } > > /** >- * >+ * Set inline text >+ * @param sql the inline text > */ > public void addText(String sql) { > this.tSqlCommand += sql;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 38807
:
17815
| 17822