use of liquibase.statement.core.GetViewDefinitionStatement in project liquibase by liquibase.
the class DB2Database method getViewDefinition.
@Override
public String getViewDefinition(CatalogAndSchema schema, String viewName) throws DatabaseException {
schema = schema.customize(this);
String definition = ExecutorService.getInstance().getExecutor(this).queryForObject(new GetViewDefinitionStatement(schema.getCatalogName(), schema.getSchemaName(), viewName), String.class);
return "FULL_DEFINITION: " + definition;
}
use of liquibase.statement.core.GetViewDefinitionStatement in project liquibase by liquibase.
the class InformixDatabase method getViewDefinition.
@Override
public String getViewDefinition(CatalogAndSchema schema, final String viewName) throws DatabaseException {
schema = schema.customize(this);
List<Map<String, ?>> retList = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", 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);
}
return CREATE_VIEW_AS_PATTERN.matcher(sb.toString()).replaceFirst("");
}
use of liquibase.statement.core.GetViewDefinitionStatement in project liquibase by liquibase.
the class SybaseDatabase method getViewDefinition.
@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 = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", this);
@SuppressWarnings("unchecked") List<String> definitionRows = (List<String>) executor.queryForList(statement, String.class);
StringBuilder definition = new StringBuilder();
for (String d : definitionRows) {
definition.append(d);
}
return definition.toString();
}
use of liquibase.statement.core.GetViewDefinitionStatement in project liquibase by liquibase.
the class GetViewDefinitionGeneratorSybaseTest method testGenerateSqlForDefaultSchema.
@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());
}
use of liquibase.statement.core.GetViewDefinitionStatement in project liquibase by liquibase.
the class GetViewDefinitionGeneratorSybaseTest method testGenerateSqlForNamedSchema.
@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());
}
Aggregations