MetadataResultSet(final Query query, final Statement statement, final InclusionRule schemaInclusionRule) throws SQLException { this(executeAgainstSchema(query, statement, schemaInclusionRule)); if (query.hasName()) { description = query.getName(); } }
MetadataResultSet(final Query query, final Statement statement, final InclusionRule schemaInclusionRule) throws SQLException { this(executeAgainstSchema(query, statement, schemaInclusionRule)); if (query.hasName()) { description = query.getName(); } }
@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)); }
private void executeAgainstSchemaTest(final TestContext testContext, final Connection cxn, final Query query, final InclusionRule schemaInclusionRule) throws IOException, SQLException { final TestWriter testout = new TestWriter(); try (final TestWriter out = testout;) { try (final Connection connection = cxn; final Statement statement = connection.createStatement(); final ResultSet resultSet = QueryUtility .executeAgainstSchema(query, statement, schemaInclusionRule);) { while (resultSet.next()) { out.println(resultSet.getString("TABLE_NAME")); } } } assertThat(outputOf(testout), hasSameContentAs(classpathResource(testContext .testMethodFullName()))); }
MetadataResultSet(final Query query, final Statement statement, final InclusionRule schemaInclusionRule) throws SQLException { this(executeAgainstSchema(query, statement, schemaInclusionRule)); if (query.hasName()) { description = query.getName(); } }
MetadataResultSet(final Query query, final Statement statement, final InclusionRule schemaInclusionRule) throws SQLException { this(executeAgainstSchema(query, statement, schemaInclusionRule)); if (query.hasName()) { description = query.getName(); } }