本文整理了Java中schemacrawler.utility.Query.<init>
方法的一些代码示例,展示了Query.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>
方法的具体详情如下:
包路径:schemacrawler.utility.Query
类名称:Query
方法名:<init>
[英]Definition of a query, including a name, and parameterized or regular SQL.
[中]查询的定义,包括名称和参数化或常规SQL。
代码示例来源:origin: schemacrawler/SchemaCrawler
/**
* Gets the additional attributes SQL for columns, from the additional
* configuration.
*
* @return Additional attributes SQL for columns.
*/
public Query getQuery(final InformationSchemaKey key)
{
requireNonNull(key, "No SQL query key provided");
return new Query(key.name(), informationSchemaQueries.get(key));
}
代码示例来源:origin: schemacrawler/SchemaCrawler
/**
* Gets the additional attributes SQL for columns, from the additional
* configuration.
*
* @return Additional attributes SQL for columns.
*/
public Query getQuery(final InformationSchemaKey key)
{
requireNonNull(key, "No SQL query key provided");
return new Query(key.name(), informationSchemaQueries.get(key));
}
代码示例来源:origin: schemacrawler/SchemaCrawler
/**
* Query.
*
* @return Query
*/
public Query getQuery()
{
return new Query(name(), queryString);
}
代码示例来源:origin: schemacrawler/SchemaCrawler
@Test
public void executeForScalarNotPresent(final TestContext testContext,
final Connection cxn)
throws Exception
{
final Query query = new Query("Select scalar",
"SELECT POSTALCODE FROM PUBLIC.BOOKS.AUTHORS WHERE LASTNAME = 'Fatehi'");
final Object scalar = QueryUtility.executeForScalar(query, cxn);
assertThat(scalar, nullValue());
}
代码示例来源:origin: schemacrawler/SchemaCrawler
@Test
public void executeForScalar(final TestContext testContext,
final Connection cxn)
throws Exception
{
final Query query = new Query("Select scalar",
"SELECT POSTALCODE FROM PUBLIC.BOOKS.AUTHORS WHERE LASTNAME = 'Shaffer'");
final Object scalar = QueryUtility.executeForScalar(query, cxn);
assertThat(scalar, notNullValue());
assertThat(scalar, is("37032"));
}
代码示例来源:origin: schemacrawler/SchemaCrawler
private Query getQuery()
{
final Operation operation = getOperation();
final Query query;
if (operation == null)
{
final String queryName = command;
final String queryString;
if (additionalConfiguration != null)
{
queryString = additionalConfiguration.get(queryName);
}
else
{
queryString = null;
}
query = new Query(queryName, queryString);
}
else
{
query = operation.getQuery();
}
return query;
}
代码示例来源:origin: schemacrawler/SchemaCrawler
@Test
public void executeAgainstSchemaNoMatch(final TestContext testContext,
final Connection cxn)
throws Exception
{
final Query query = new Query("Tables for schema",
"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE REGEXP_MATCHES(TABLE_SCHEMA, '${schemas}') ORDER BY TABLE_NAME");
final InclusionRule schemaInclusionRule = new RegularExpressionInclusionRule("NONE");
int rows = 0;
try (final Connection connection = cxn;
final Statement statement = connection.createStatement();
final ResultSet resultSet = QueryUtility
.executeAgainstSchema(query, statement, schemaInclusionRule);)
{
while (resultSet.next())
{
rows++;
}
}
assertThat(rows, is(0));
}
代码示例来源:origin: schemacrawler/SchemaCrawler
@Test
public void executeAgainstSchema(final TestContext testContext,
final Connection cxn)
throws Exception
{
final Query query = new Query("Tables for schema",
"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE REGEXP_MATCHES(TABLE_SCHEMA, '${schemas}') ORDER BY TABLE_NAME");
final InclusionRule schemaInclusionRule = new RegularExpressionInclusionRule("BOOKS");
executeAgainstSchemaTest(testContext, cxn, query, schemaInclusionRule);
}
代码示例来源:origin: schemacrawler/SchemaCrawler
@Test
public void executeAgainstSchemaNoTemplate(final TestContext testContext,
final Connection cxn)
throws Exception
{
final Query query = new Query("Tables for schema",
"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= 'BOOKS' ORDER BY TABLE_NAME");
final InclusionRule schemaInclusionRule = new RegularExpressionInclusionRule("NONE");
executeAgainstSchemaTest(testContext, cxn, query, schemaInclusionRule);
}
代码示例来源:origin: schemacrawler/SchemaCrawler
private String getCatalogScope(final Connection connection)
{
String catalogScope = "ALL";
try
{
final Query query = new Query("Check access to DBA tables",
"SELECT TABLE_NAME FROM DBA_TABLES WHERE ROWNUM = 1");
final Object scalar = executeForScalar(query, connection);
if (scalar != null)
{
catalogScope = "DBA";
}
}
catch (final SchemaCrawlerException e)
{
LOGGER.log(Level.FINE, e.getMessage(), e);
catalogScope = "ALL";
}
LOGGER
.log(Level.INFO,
new StringFormat("Using Oracle data dictionary catalog scope <%s>",
catalogScope));
return catalogScope;
}
代码示例来源:origin: us.fatehi/schemacrawler
/**
* Query.
*
* @return Query
*/
public Query getQuery()
{
return new Query(name(), queryString);
}
代码示例来源:origin: us.fatehi/schemacrawler
/**
* Gets the additional attributes SQL for columns, from the additional
* configuration.
*
* @return Additional attributes SQL for columns.
*/
public Query getQuery(final InformationSchemaKey key)
{
requireNonNull(key, "No SQL query key provided");
return new Query(key.name(), informationSchemaQueries.get(key));
}
代码示例来源:origin: us.fatehi/schemacrawler-tools
/**
* Query.
*
* @return Query
*/
public Query getQuery()
{
return new Query(name(), queryString);
}
代码示例来源:origin: us.fatehi/schemacrawler-api
/**
* Gets the additional attributes SQL for columns, from the additional
* configuration.
*
* @return Additional attributes SQL for columns.
*/
public Query getQuery(final InformationSchemaKey key)
{
requireNonNull(key, "No SQL query key provided");
return new Query(key.name(), informationSchemaQueries.get(key));
}
代码示例来源:origin: us.fatehi/schemacrawler-tools
private Query getQuery()
{
final Operation operation = getOperation();
final Query query;
if (operation == null)
{
final String queryName = command;
final String queryString;
if (additionalConfiguration != null)
{
queryString = additionalConfiguration.get(queryName);
}
else
{
queryString = null;
}
query = new Query(queryName, queryString);
}
else
{
query = operation.getQuery();
}
return query;
}
代码示例来源:origin: us.fatehi/schemacrawler
private Query getQuery()
{
final Operation operation = getOperation();
final Query query;
if (operation == null)
{
final String queryName = command;
final String queryString;
if (additionalConfiguration != null)
{
queryString = additionalConfiguration.get(queryName);
}
else
{
queryString = null;
}
query = new Query(queryName, queryString);
}
else
{
query = operation.getQuery();
}
return query;
}
代码示例来源:origin: us.fatehi/schemacrawler-oracle
private String getCatalogScope(final Connection connection)
{
String catalogScope = "ALL";
try
{
final Query query = new Query("Check access to DBA tables",
"SELECT TABLE_NAME FROM DBA_TABLES WHERE ROWNUM = 1");
final Object scalar = executeForScalar(query, connection);
if (scalar != null)
{
catalogScope = "DBA";
}
}
catch (final SchemaCrawlerException e)
{
LOGGER.log(Level.FINE, e.getMessage(), e);
catalogScope = "ALL";
}
LOGGER
.log(Level.INFO,
new StringFormat("Using Oracle data dictionary catalog scope <%s>",
catalogScope));
return catalogScope;
}
内容来源于网络,如有侵权,请联系作者删除!