Package liquibase.statement.core

Examples of liquibase.statement.core.GetViewDefinitionStatement


                        definition = definition.replaceAll("(?i)\""+view.getSchema().getName()+"\"\\.", "");
                    }

                    view.setDefinition(definition);
                } catch (DatabaseException e) {
                    throw new DatabaseException("Error getting " + database.getConnection().getURL() + " view with " + new GetViewDefinitionStatement(view.getSchema().getCatalogName(), view.getSchema().getName(), rawViewName), e);
                }

                return view;
            } else {
                return null;
View Full Code Here


  }

  @Override
  public String getViewDefinition(CatalogAndSchema schema, final String viewName) throws DatabaseException {
        schema = schema.customize(this);
    List<Map<String, ?>> retList = ExecutorService.getInstance().getExecutor(this).queryForList(new GetViewDefinitionStatement(schema.getCatalogName(), schema.getSchemaName(), viewName));
    // building the view definition from the multiple rows
    StringBuilder sb = new StringBuilder();
    for (Map rowMap : retList) {
      String s = (String) rowMap.get("VIEWTEXT");
      sb.append(s);
View Full Code Here

    }

    @Override
    public String getViewDefinition(CatalogAndSchema schema, String viewName) throws DatabaseException {
          schema = schema.customize(this);
        List<String> defLines = (List<String>) ExecutorService.getInstance().getExecutor(this).queryForList(new GetViewDefinitionStatement(schema.getCatalogName(), schema.getSchemaName(), viewName), String.class);
        StringBuffer sb = new StringBuffer();
        for (String defLine : defLines) {
            sb.append(defLine);
        }
        String definition = sb.toString();
View Full Code Here

    }

  @Override
  public String getViewDefinition(CatalogAndSchema schema, String viewName) throws DatabaseException {
        schema = schema.customize(this);
        GetViewDefinitionStatement statement = new GetViewDefinitionStatement(schema.getCatalogName(), schema.getSchemaName(), viewName);
        Executor executor = ExecutorService.getInstance().getExecutor(this);
        @SuppressWarnings("unchecked")
        List<String> definitionRows = (List<String>) executor.queryForList(statement, String.class);
        StringBuilder definition = new StringBuilder();
        for (String d : definitionRows) {
View Full Code Here

public class GetViewDefinitionGeneratorSybaseTest {

  @Test
  public void testGenerateSqlForDefaultSchema() {
    GetViewDefinitionGeneratorSybase generator = new GetViewDefinitionGeneratorSybase();
    GetViewDefinitionStatement statement = new GetViewDefinitionStatement(null, null, "view_name");
    Sql[] sql = generator.generateSql(statement, new SybaseDatabase(), null);
    assertEquals(1, sql.length);
    assertEquals("select text from syscomments where id = object_id('dbo.view_name') order by colid", sql[0].toSql());
  }
View Full Code Here

  }
 
  @Test
  public void testGenerateSqlForNamedSchema() {
    GetViewDefinitionGeneratorSybase generator = new GetViewDefinitionGeneratorSybase();
    GetViewDefinitionStatement statement = new GetViewDefinitionStatement(null, "owner", "view_name");
    Sql[] sql = generator.generateSql(statement, new SybaseDatabase(), null);
    assertEquals(1, sql.length);
    assertEquals("select text from syscomments where id = object_id('OWNER.view_name') order by colid", sql[0].toSql());
  }
View Full Code Here

TOP

Related Classes of liquibase.statement.core.GetViewDefinitionStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.