Subject Database Metadata question
Author aalliana
Hello,

I first apologize if this is a repeated topic, I skimmed through the archive but did not find this exact question. If It's repeated, please rederect me to the topic.

I have the following issue with DatabaseMetaData:

I moved to the jaybird implementation lately, and when calling

ResultSet rscols = dbmd.getColumns(null, null, tableName , null);

with tableName set to foo, I also get the columns of table foo_details. I'm not saying this is wrong, but it is different from the last driver implementation I was using. I solved the problem adding an extra if statement asking for the

rscols.getString("TABLE_NAME").equalsIgnoreCase(...

before using the data. I'm just curious if this is the way to go, or should I specify the tableName string in some other way.

Checking the docs at http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)

I read that "Some DatabaseMetaData methods take arguments that are String patterns. These arguments all have names such as fooPattern. Within a pattern String, "%" means match any substring of 0 or more characters, and "_" means match any one character. Only metadata entries matching the search pattern are returned. If a search pattern argument is set to null, that argument's criterion will be dropped from the search." Which is not clear to me.

I'm also running into the same thing when using
getPrimaryKeys

public ResultSet getPrimaryKeys(String catalog,
String schema,
String table)
throws SQLException

But in this case, the API does not specify that table is a pattern, but rather the actual table name.

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema - a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
table - a table name; must match the table name as it is stored in the database

Any comment will be appreciated.

Thank you very much for jaybird!