Mostly, I was curious about what I should (or shouldn't) do with all the
extra methods that the interface gives me. I'm actually working on a
CustomTaskChange. I need to do some very specific data manipulation for
one of my updates. I figured this would be easier than trying to write a
bunch of SQL. So, it's old-school JDBC.



Voxland, Nathan wrote:
> Thanks for pointing that out.   Here is an example CustomSqlChange
> class, is there anything in particular you are wondering?:
>
> public class ExampleCustomSqlChange implements CustomSqlChange,
> CustomSqlRollback {
>
>     private String tableName;
>     private String columnName;
>     private String newValue;
>
>     @SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"})
>     private ResourceAccessor resourceAccessor;
>
>
>     public String getTableName() {
>         return tableName;
>     }
>
>     public void setTableName(String tableName) {
>         this.tableName = tableName;
>     }
>
>     public String getColumnName() {
>         return columnName;
>     }
>
>     public void setColumnName(String columnName) {
>         this.columnName = columnName;
>     }
>
>     public String getNewValue() {
>         return newValue;
>     }
>
>     public void setNewValue(String newValue) {
>         this.newValue = newValue;
>     }
>
>     public SqlStatement[] generateStatements(Database database) {
>         return new SqlStatement[]{
>                 new RawSqlStatement("update "+tableName+" set
> "+columnName+" = "+newValue)
>         };
>     }
>
>     public SqlStatement[] generateRollbackStatements(Database database)
> throws UnsupportedChangeException, RollbackImpossibleException {
>         return new SqlStatement[]{
>                 new RawSqlStatement("update "+tableName+" set
> "+columnName+" = null")
>         };
>     }
>
>     public String getConfirmationMessage() {
>         return "Custom class updated "+tableName+"."+columnName;
>     }
>
>     public void setUp() throws SetupException {
>     }
>
>     public void setFileOpener(ResourceAccessor resourceAccessor) {
>         this.resourceAccessor = resourceAccessor;
>     }
>
>     public ValidationErrors validate(Database database) {
>         return new ValidationErrors();
>     }
>     
> }
>
> -----Original Message-----
> From: David C. Hicks [mailto:[email protected]] 
> Sent: Tuesday, June 23, 2009 2:54 PM
> To: Liquibase Users
> Subject: [Liquibase-user] CustomSqlChange/CustomTaskChange exmples?
>
> The online docs have links, but they go to blank pages.  Can anyone
> point me to an example of a custom change class of any kind?
> Thanks!
> Dave
>
>
> ------------------------------------------------------------------------
> ------
> _______________________________________________
> Liquibase-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/liquibase-user
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Liquibase-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/liquibase-user
>   

------------------------------------------------------------------------------
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user

Reply via email to