use of org.teiid.translator.jdbc.JDBCMetadataProcessor in project teiid by teiid.
the class DB2ExecutionFactory method getMetadataProcessor.
@Override
public MetadataProcessor<Connection> getMetadataProcessor() {
return new JDBCMetadataProcessor() {
@Override
protected ResultSet executeSequenceQuery(Connection conn) throws SQLException {
String query = // $NON-NLS-1$
"select null as sequence_catalog, seqschema as sequence_schema, seqname as sequence_name from sysibm.syssequences " + // $NON-NLS-1$
"where seqschema like ? and seqname like ?";
PreparedStatement ps = conn.prepareStatement(query);
// $NON-NLS-1$
ps.setString(1, getSchemaPattern() == null ? "%" : getSchemaPattern());
// $NON-NLS-1$
ps.setString(2, getSequenceNamePattern() == null ? "%" : getSequenceNamePattern());
return ps.executeQuery();
}
};
}
use of org.teiid.translator.jdbc.JDBCMetadataProcessor in project teiid by teiid.
the class H2ExecutionFactory method getMetadataProcessor.
@Override
public MetadataProcessor<Connection> getMetadataProcessor() {
return new JDBCMetadataProcessor() {
@Override
protected ResultSet executeSequenceQuery(Connection conn) throws SQLException {
// matches the catalog search behavior of the h2 driver, as a pattern
String query = // $NON-NLS-1$
"select SEQUENCE_CATALOG, SEQUENCE_SCHEMA, SEQUENCE_NAME from information_schema.sequences " + // $NON-NLS-1$
"where SEQUENCE_CATALOG like ? escape '' and SEQUENCE_SCHEMA like ? escape '' and sequence_name like ? escape ''";
PreparedStatement ps = conn.prepareStatement(query);
// $NON-NLS-1$
ps.setString(1, getCatalog() == null ? "%" : getCatalog());
// $NON-NLS-1$
ps.setString(2, getSchemaPattern() == null ? "%" : getSchemaPattern());
// $NON-NLS-1$
ps.setString(3, getSequenceNamePattern() == null ? "%" : getSequenceNamePattern());
return ps.executeQuery();
}
};
}
Aggregations