use of org.firebirdsql.jdbc.FBResultSet in project jaybird by FirebirdSQL.
the class OODatabaseMetaData method getTablePrivileges.
@Override
public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
final RowDescriptor rowDescriptor = buildTablePrivilegeRSMetaData();
Clause tableClause1 = new Clause("RDB$RELATION_NAME", tableNamePattern);
Clause tableClause2 = new Clause("RDB$RELATION_NAME", tableNamePattern);
String sql = GET_TABLE_PRIVILEGES_START_1;
sql += tableClause1.getCondition();
sql += GET_TABLE_PRIVILEGES_END_1;
sql += GET_TABLE_PRIVILEGES_START_2;
sql += tableClause2.getCondition();
sql += GET_TABLE_PRIVILEGES_END_2;
List<String> params = new ArrayList<>(2);
if (tableClause1.hasCondition()) {
params.add(tableClause1.getValue());
}
if (tableClause2.hasCondition()) {
params.add(tableClause2.getValue());
}
try (ResultSet rs = doQuery(sql, params)) {
// if nothing found, return an empty result set
if (!rs.next()) {
return new FBResultSet(rowDescriptor, Collections.<RowValue>emptyList());
}
return processTablePrivileges(rowDescriptor, rs);
}
}
use of org.firebirdsql.jdbc.FBResultSet in project jaybird by FirebirdSQL.
the class OODatabaseMetaData method getColumns.
@Override
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
if (DEFAULT_SCHEMA.equals(schemaPattern))
schemaPattern = null;
FBResultSet rs = (FBResultSet) super.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern);
if (rs.next()) {
rs.beforeFirst();
return rs;
}
String upperTableNamePattern = tableNamePattern.toUpperCase();
String upperColumnNamePattern = columnNamePattern.toUpperCase();
rs = (FBResultSet) super.getColumns(catalog, schemaPattern, upperTableNamePattern, columnNamePattern);
if (rs.next()) {
rs.beforeFirst();
return rs;
}
rs = (FBResultSet) super.getColumns(catalog, schemaPattern, tableNamePattern, upperColumnNamePattern);
if (rs.next()) {
rs.beforeFirst();
return rs;
}
return super.getColumns(catalog, schemaPattern, upperTableNamePattern, upperColumnNamePattern);
}
use of org.firebirdsql.jdbc.FBResultSet in project jaybird by FirebirdSQL.
the class OODatabaseMetaData method getTables.
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
if (DEFAULT_SCHEMA.equals(schemaPattern))
schemaPattern = null;
FBResultSet rs = (FBResultSet) super.getTables(catalog, schemaPattern, tableNamePattern, types);
if (rs.next()) {
rs.beforeFirst();
return rs;
}
tableNamePattern = tableNamePattern.toUpperCase();
return super.getTables(catalog, schemaPattern, tableNamePattern, types);
}
Aggregations