01: package liquibase.change;
02:
03: import liquibase.database.structure.DatabaseObject;
04: import org.w3c.dom.Document;
05: import org.w3c.dom.Element;
06:
07: import java.util.Set;
08:
09: /**
10: * Allows execution of arbitrary SQL. This change can be used when existing changes are either don't exist,
11: * are not flexible enough, or buggy.
12: */
13: public class RawSQLChange extends AbstractSQLChange {
14:
15: private String comments;
16:
17: public RawSQLChange() {
18: super ("sql", "Custom SQL");
19: }
20:
21: public String getComments() {
22: return comments;
23: }
24:
25: public void setComments(String comments) {
26: this .comments = comments;
27: }
28:
29: public String getConfirmationMessage() {
30: return "Custom SQL executed";
31: }
32:
33: public Element createNode(Document currentChangeLogFileDOM) {
34: Element sqlElement = currentChangeLogFileDOM
35: .createElement("sql");
36: sqlElement.appendChild(currentChangeLogFileDOM
37: .createTextNode(getSql()));
38:
39: return sqlElement;
40: }
41:
42: public Set<DatabaseObject> getAffectedDatabaseObjects() {
43: return null;
44: }
45: }
|