Coverage Report - liquibase.sqlgenerator.core.GetViewDefinitionGeneratorPostgres
 
Classes in this File Line Coverage Branch Coverage Complexity
GetViewDefinitionGeneratorPostgres
33%
2/6
N/A
2
 
 1  
 package liquibase.sqlgenerator.core;
 2  
 
 3  
 import liquibase.database.Database;
 4  
 import liquibase.database.core.PostgresDatabase;
 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 GetViewDefinitionGeneratorPostgres 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 PostgresDatabase;
 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 pg_views where viewname='"
 28  
                     + statement.getViewName() + "' AND schemaname='"
 29  
                     + database.convertRequestedSchemaToSchema(statement.getSchemaName()) + "'") };
 30  0
         } catch (DatabaseException e) {
 31  0
             throw new UnexpectedLiquibaseException(e);
 32  
         }
 33  
     }
 34  
 }