Coverage Report - liquibase.sqlgenerator.core.SelectSequencesGeneratorH2
 
Classes in this File Line Coverage Branch Coverage Complexity
SelectSequencesGeneratorH2
28%
2/7
N/A
1.75
 
 1  
 package liquibase.sqlgenerator.core;
 2  
 
 3  
 import liquibase.database.Database;
 4  
 import liquibase.database.core.H2Database;
 5  
 import liquibase.exception.DatabaseException;
 6  
 import liquibase.exception.UnexpectedLiquibaseException;
 7  
 import liquibase.exception.ValidationErrors;
 8  
 import liquibase.sql.Sql;
 9  
 import liquibase.sql.UnparsedSql;
 10  
 import liquibase.sqlgenerator.SqlGenerator;
 11  
 import liquibase.sqlgenerator.SqlGeneratorChain;
 12  
 import liquibase.statement.core.SelectSequencesStatement;
 13  
 
 14  10
 public class SelectSequencesGeneratorH2 extends AbstractSqlGenerator<SelectSequencesStatement> {
 15  
     @Override
 16  
     public int getPriority() {
 17  1
         return PRIORITY_DATABASE;
 18  
     }
 19  
 
 20  
     @Override
 21  
     public boolean supports(SelectSequencesStatement statement, Database database) {
 22  0
         return database instanceof H2Database;
 23  
     }
 24  
 
 25  
     public ValidationErrors validate(SelectSequencesStatement statement, Database database,
 26  
             SqlGeneratorChain sqlGeneratorChain) {
 27  0
         return new ValidationErrors();
 28  
     }
 29  
 
 30  
     public Sql[] generateSql(SelectSequencesStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
 31  
         try {
 32  0
             return new Sql[] { new UnparsedSql(
 33  
                     "SELECT SEQUENCE_NAME FROM INFORMATION_SCHEMA.SEQUENCES WHERE SEQUENCE_SCHEMA = '"
 34  
                             + database.convertRequestedSchemaToSchema(statement.getSchemaName())
 35  
                             + "' AND IS_GENERATED=FALSE") };
 36  0
         } catch (DatabaseException e) {
 37  0
             throw new UnexpectedLiquibaseException(e);
 38  
         }
 39  
     }
 40  
 }