1 | |
package liquibase.sqlgenerator.core; |
2 | |
|
3 | |
import liquibase.database.Database; |
4 | |
import liquibase.database.core.InformixDatabase; |
5 | |
import liquibase.exception.ValidationErrors; |
6 | |
import liquibase.sql.Sql; |
7 | |
import liquibase.sql.UnparsedSql; |
8 | |
import liquibase.sqlgenerator.SqlGenerator; |
9 | |
import liquibase.sqlgenerator.SqlGeneratorChain; |
10 | |
import liquibase.statement.core.SelectSequencesStatement; |
11 | |
|
12 | 10 | public class SelectSequencesGeneratorInformix extends AbstractSqlGenerator<SelectSequencesStatement> { |
13 | |
@Override |
14 | |
public int getPriority() { |
15 | 1 | return PRIORITY_DATABASE; |
16 | |
} |
17 | |
|
18 | |
@Override |
19 | |
public boolean supports(SelectSequencesStatement statement, Database database) { |
20 | 0 | return database instanceof InformixDatabase; |
21 | |
} |
22 | |
|
23 | |
public ValidationErrors validate(SelectSequencesStatement statement, Database database, |
24 | |
SqlGeneratorChain sqlGeneratorChain) { |
25 | 0 | return new ValidationErrors(); |
26 | |
} |
27 | |
|
28 | |
public Sql[] generateSql(SelectSequencesStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) { |
29 | 0 | StringBuilder sb = new StringBuilder("SELECT tabname FROM systables t, syssequences s WHERE s.tabid = t.tabid"); |
30 | 0 | String schemaName = statement.getSchemaName(); |
31 | 0 | if (schemaName != null) { |
32 | 0 | sb.append(" AND t.owner = ").append("'").append(schemaName).append("'"); |
33 | |
} |
34 | 0 | return new Sql[] { new UnparsedSql(sb.toString()) }; |
35 | |
} |
36 | |
} |