1 | |
package liquibase.sqlgenerator.core; |
2 | |
|
3 | |
import liquibase.database.Database; |
4 | |
import liquibase.database.core.OracleDatabase; |
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 GetViewDefinitionGeneratorOracle 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 OracleDatabase; |
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 TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME)='" |
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 | |
} |