View Javadoc

1   package liquibase.sqlgenerator.core;
2   
3   import liquibase.database.Database;
4   import liquibase.database.core.InformixDatabase;
5   import liquibase.sql.Sql;
6   import liquibase.sql.UnparsedSql;
7   import liquibase.sqlgenerator.SqlGeneratorChain;
8   import liquibase.statement.core.GetViewDefinitionStatement;
9   
10  public class GetViewDefinitionGeneratorInformix extends GetViewDefinitionGenerator {
11      @Override
12      public int getPriority() {
13          return PRIORITY_DATABASE;
14      }
15  
16      @Override
17      public boolean supports(GetViewDefinitionStatement statement, Database database) {
18          return database instanceof InformixDatabase;
19      }
20  
21      @Override
22      public Sql[] generateSql(GetViewDefinitionStatement statement, Database database,
23              SqlGeneratorChain sqlGeneratorChain) {
24          // TODO owner is schemaName ?
25          // view definition is distributed over multiple rows, each 64 chars
26          // see InformixDatabase.getViewDefinition
27          return new Sql[] { new UnparsedSql("select v.viewtext from sysviews v, systables t where t.tabname = '"
28                  + statement.getViewName() + "' and v.tabid = t.tabid and t.tabtype = 'V' order by v.seqno") };
29      }
30  }