1 | |
package liquibase.sqlgenerator.core; |
2 | |
|
3 | |
import liquibase.database.Database; |
4 | |
import liquibase.database.core.MaxDBDatabase; |
5 | |
import liquibase.exception.DatabaseException; |
6 | |
import liquibase.exception.UnexpectedLiquibaseException; |
7 | |
import liquibase.sql.Sql; |
8 | |
import liquibase.sql.UnparsedSql; |
9 | |
import liquibase.sqlgenerator.SqlGeneratorChain; |
10 | |
import liquibase.statement.core.GetViewDefinitionStatement; |
11 | |
|
12 | 10 | public class GetViewDefinitionGeneratorMaxDB extends GetViewDefinitionGenerator { |
13 | |
@Override |
14 | |
public int getPriority() { |
15 | 1 | return PRIORITY_DATABASE; |
16 | |
} |
17 | |
|
18 | |
@Override |
19 | |
public boolean supports(GetViewDefinitionStatement statement, Database database) { |
20 | 0 | return database instanceof MaxDBDatabase; |
21 | |
} |
22 | |
|
23 | |
@Override |
24 | |
public Sql[] generateSql(GetViewDefinitionStatement statement, Database database, |
25 | |
SqlGeneratorChain sqlGeneratorChain) { |
26 | |
try { |
27 | 0 | return new Sql[] { new UnparsedSql("SELECT DEFINITION FROM DOMAIN.VIEWDEFS WHERE upper(VIEWNAME)='" |
28 | |
+ statement.getViewName().toUpperCase() + "' AND OWNER='" |
29 | |
+ database.convertRequestedSchemaToSchema(statement.getSchemaName()) + "'") }; |
30 | 0 | } catch (DatabaseException e) { |
31 | 0 | throw new UnexpectedLiquibaseException(e); |
32 | |
} |
33 | |
} |
34 | |
} |