Re: getColumns()

From: Auri Mason <amason(at)syntrex(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: getColumns()
Date: 2002-04-04 07:42:30
Message-ID: Pine.LNX.4.44.0204040907200.6208-100000@mendeleev.syntrex.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Dave,

As far as you known it works? Sounds good!

BTW, I'm using Postgresql 7.1.3 and the 'incriminated' code is:

####### Code example ########
...
private DatabaseMetaData dma;
private Connection dbCon;
...
/**
the schema is set to "%"
*/
public void setSchema(String schema) {
this.schema = schema;
}
/**
* This function is used to get the current used schema name to
perform table and fields checks in the right schema.
private String getSchema() {
return schema;
}

private String getCatalog() throws SQLException {
String catalog = dbCon.getCatalog();
if (catalog != null && catalog.length() == 0) {
catalog = null;
}
return catalog;
}
...
public int getFieldSize(String tableName, String fieldName, String
schema) throws BDEException {
int ret = -1;
try {
//->>>>>>>>>>>>the following returns no rows!
ResultSet rs = dma.getColumns(getCatalog(),
getSchema(), tableName.toUpperCase(),
fieldName.toUpperCase());

rs.next();
//So this throws an exception...
ret = rs.getInt("COLUMN_SIZE");
} catch (Exception e) {
trace.fail(e);
}
//...and this returns null
return ret;
}
############# EO Code sample ############

TIA, Auri

On 3 Apr 2002, Dave Cramer wrote:

> Auri,
>
> AFAIK this works, can you give me specifics?
>
> ie db version, columns, code sample, etc.
>
> Dave

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jose Javier Gutierrez 2002-04-04 08:42:13 Re: getColumns()
Previous Message Dave Cramer 2002-04-03 18:08:51 Re: getColumns()