Re: getColumns() - Mailing list pgsql-jdbc

From Auri Mason
Subject Re: getColumns()
Date
Msg-id Pine.LNX.4.44.0204040907200.6208-100000@mendeleev.syntrex.com
Whole thread Raw
In response to Re: getColumns()  (Dave Cramer <dave@fastcrypt.com>)
Responses Re: getColumns()  ("Jose Javier Gutierrez" <jgutierrez@kristina.es>)
List 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


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: getColumns()
Next
From: "Jose Javier Gutierrez"
Date:
Subject: Re: getColumns()