| 1 | |
package liquibase.sqlgenerator.core; |
| 2 | |
|
| 3 | |
import liquibase.database.Database; |
| 4 | |
import liquibase.exception.ValidationErrors; |
| 5 | |
import liquibase.sql.SingleLineComment; |
| 6 | |
import liquibase.sql.Sql; |
| 7 | |
import liquibase.sqlgenerator.SqlGenerator; |
| 8 | |
import liquibase.sqlgenerator.SqlGeneratorChain; |
| 9 | |
import liquibase.statement.core.CommentStatement; |
| 10 | |
|
| 11 | 28 | public class CommentGenerator extends AbstractSqlGenerator<CommentStatement> { |
| 12 | |
|
| 13 | |
public Sql[] generateSql(CommentStatement comment, Database database, SqlGeneratorChain sqlGeneratorChain) { |
| 14 | 0 | return new Sql[] { new SingleLineComment(comment.getText(), database.getLineComment()) }; |
| 15 | |
} |
| 16 | |
|
| 17 | |
public ValidationErrors validate(CommentStatement comment, Database database, SqlGeneratorChain sqlGeneratorChain) { |
| 18 | 15 | ValidationErrors validationErrors = new ValidationErrors(); |
| 19 | 15 | validationErrors.checkRequiredField("text", comment.getText()); |
| 20 | 15 | return validationErrors; |
| 21 | |
} |
| 22 | |
|
| 23 | |
} |