Index: SQLExec.java =================================================================== --- SQLExec.java (revision 381839) +++ SQLExec.java (working copy) @@ -155,7 +155,6 @@ */ private File output = null; - /** * Action to perform if an error is found **/ @@ -184,6 +183,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; + + /** * should properties be expanded in text? * false for backwards compatibility * @@ -373,6 +382,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 * @throws BuildException on error. */ @@ -588,12 +617,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; }