Re: [PATCHES] JDBC Patch

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Mount <petermount(at)maidstone(dot)gov(dot)uk>
Cc: Christopher Cain <ccain(at)mhsoftware(dot)com>, pgsql-interfaces(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] JDBC Patch
Date: 2000-09-12 14:10:48
Message-ID: 200009121410.KAA18394@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-patches

[ Charset ISO-8859-1 unsupported, converting... ]
> Eeek, I've got this in my copy ready to commit. How is CVS going to handle
> this problem?

Do a cvs update and see if it skips those changes.

>
> Peter
>
> --
> Peter Mount
> Enterprise Support Officer, Maidstone Borough Council
> Email: petermount(at)maidstone(dot)gov(dot)uk
> WWW: http://www.maidstone.gov.uk
> All views expressed within this email are not the views of Maidstone Borough
> Council
>
>
> -----Original Message-----
> From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> Sent: Tuesday, September 12, 2000 5:17 AM
> To: Christopher Cain
> Cc: pgsql-interfaces(at)postgresql(dot)org; pgsql-patches(at)postgresql(dot)org
> Subject: Re: [PATCHES] JDBC Patch
>
>
> Applied. Thanks.
>
> > This patch for the 7.0.2 JDBC interface addresses four issues I
> > encountered while getting my reporting tool up and running with the
> > driver. All changes are in the DatabaseMetaData class.
> >
> > Problem: The getDatabaseProductVersion() method was returning "6.5.2"
> > Resolution: Changed it to return "7.0.2"
> >
> > Problem: A call to getTables() with an unsupported table type (in the
> > String array) resulted in a malformed SQL statement and subsequent
> > parsing error
> > Resolution: Unsupported table types are now ignored without error
> >
> > Problem: In a getTables() call, tables and views were both returned by
> > the "TABLE" table type, and the "VIEW" table type was unsupported
> > Resolution: Changed the "TABLE" type to return only physical tables and
> > added support for the "VIEW" table type (returning only views)
> >
> > Problem: The getIdentifierQuoteString() method was returning null
> > Resolution: This method now returns a double-quote
> >
> > Regards ...
> >
> > - Christopher
>
> > diff -U 5 -r
> postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.j
> ava
> postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.
> java
> > ---
> postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.j
> ava Mon Apr 17 14:07:48 2000
> > +++
> postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.
> java Thu Aug 24 11:42:28 2000
> > @@ -177,11 +177,11 @@
> > * @return the database version
> > * @exception SQLException if a database access error occurs
> > */
> > public String getDatabaseProductVersion() throws SQLException
> > {
> > - return ("6.5.2");
> > + return ("7.0.2");
> > }
> >
> > /**
> > * What is the name of this JDBC driver? If we don't know this
> > * we are doing something wrong!
> > @@ -361,11 +361,11 @@
> > * @return the quoting string
> > * @exception SQLException if a database access error occurs
> > */
> > public String getIdentifierQuoteString() throws SQLException
> > {
> > - return null;
> > + return "\"";
> > }
> >
> > /**
> > * Get a comma separated list of all a database's SQL keywords that
> > * are NOT also SQL92 keywords.
> > @@ -1652,14 +1652,14 @@
> >
> > // Now form the query
> > StringBuffer sql = new StringBuffer("select relname,oid from pg_class
> where (");
> > boolean notFirst=false;
> > for(int i=0;i<types.length;i++) {
> > - if(notFirst)
> > - sql.append(" or ");
> > for(int j=0;j<getTableTypes.length;j++)
> > if(getTableTypes[j][0].equals(types[i])) {
> > + if(notFirst)
> > + sql.append(" or ");
> > sql.append(getTableTypes[j][1]);
> > notFirst=true;
> > }
> > }
> >
> > @@ -1704,22 +1704,23 @@
> > // Each supported type consists of it's name, and the sql where
> > // clause to retrieve that value.
> > //
> > // IMPORTANT: the query must be enclosed in ( )
> > private static final String getTableTypes[][] = {
> > - {"TABLE", "(relkind='r' and relname !~ '^pg_' and
> relname !~ '^xinv')"},
> > + {"TABLE", "(relkind='r' and relhasrules='f' and
> relname !~ '^pg_' and relname !~ '^xinv')"},
> > + {"VIEW", "(relkind='r' and relhasrules='t' and relname !~
> '^pg_' and relname !~ '^xinv')"},
> > {"INDEX", "(relkind='i' and relname !~ '^pg_' and
> relname !~ '^xinx')"},
> > {"LARGE OBJECT", "(relkind='r' and relname ~ '^xinv')"},
> > {"SEQUENCE", "(relkind='S' and relname !~ '^pg_')"},
> > {"SYSTEM TABLE", "(relkind='r' and relname ~ '^pg_')"},
> > {"SYSTEM INDEX", "(relkind='i' and relname ~ '^pg_')"}
> > };
> >
> > // These are the default tables, used when NULL is passed to getTables
> > // The choice of these provide the same behaviour as psql's \d
> > private static final String defaultTableTypes[] = {
> > - "TABLE","INDEX","SEQUENCE"
> > + "TABLE","VIEW","INDEX","SEQUENCE"
> > };
> >
> > /**
> > * Get the schema names available in this database. The results
> > * are ordered by schema name.
> > diff -U 5 -r
> postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.j
> ava
> postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.
> java
> > ---
> postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.j
> ava Mon Apr 17 14:07:50 2000
> > +++
> postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.
> java Wed Aug 23 15:14:50 2000
> > @@ -177,11 +177,11 @@
> > * @return the database version
> > * @exception SQLException if a database access error occurs
> > */
> > public String getDatabaseProductVersion() throws SQLException
> > {
> > - return ("6.5.2");
> > + return ("7.0.2");
> > }
> >
> > /**
> > * What is the name of this JDBC driver? If we don't know this
> > * we are doing something wrong!
> > @@ -361,11 +361,11 @@
> > * @return the quoting string
> > * @exception SQLException if a database access error occurs
> > */
> > public String getIdentifierQuoteString() throws SQLException
> > {
> > - return null;
> > + return "\"";
> > }
> >
> > /**
> > * Get a comma separated list of all a database's SQL keywords that
> > * are NOT also SQL92 keywords.
> > @@ -1652,14 +1652,14 @@
> >
> > // Now form the query
> > StringBuffer sql = new StringBuffer("select relname,oid from pg_class
> where (");
> > boolean notFirst=false;
> > for(int i=0;i<types.length;i++) {
> > - if(notFirst)
> > - sql.append(" or ");
> > for(int j=0;j<getTableTypes.length;j++)
> > if(getTableTypes[j][0].equals(types[i])) {
> > + if(notFirst)
> > + sql.append(" or ");
> > sql.append(getTableTypes[j][1]);
> > notFirst=true;
> > }
> > }
> >
> > @@ -1704,22 +1704,23 @@
> > // Each supported type consists of it's name, and the sql where
> > // clause to retrieve that value.
> > //
> > // IMPORTANT: the query must be enclosed in ( )
> > private static final String getTableTypes[][] = {
> > - {"TABLE", "(relkind='r' and relname !~ '^pg_' and
> relname !~ '^xinv')"},
> > + {"TABLE", "(relkind='r' and relhasrules='f' and
> relname !~ '^pg_' and relname !~ '^xinv')"},
> > + {"VIEW", "(relkind='r' and relhasrules='t' and relname !~
> '^pg_' and relname !~ '^xinv')"},
> > {"INDEX", "(relkind='i' and relname !~ '^pg_' and
> relname !~ '^xinx')"},
> > {"LARGE OBJECT", "(relkind='r' and relname ~ '^xinv')"},
> > {"SEQUENCE", "(relkind='S' and relname !~ '^pg_')"},
> > {"SYSTEM TABLE", "(relkind='r' and relname ~ '^pg_')"},
> > {"SYSTEM INDEX", "(relkind='i' and relname ~ '^pg_')"}
> > };
> >
> > // These are the default tables, used when NULL is passed to getTables
> > // The choice of these provide the same behaviour as psql's \d
> > private static final String defaultTableTypes[] = {
> > - "TABLE","INDEX","SEQUENCE"
> > + "TABLE","VIEW","INDEX","SEQUENCE"
> > };
> >
> > /**
> > * Get the schema names available in this database. The results
> > * are ordered by schema name.
>
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Philipp Käser 2000-09-13 17:23:11 reading large objects from DB using ODBC
Previous Message Peter Mount 2000-09-12 07:19:33 RE: [PATCHES] JDBC Patch

Browse pgsql-patches by date

  From Date Subject
Next Message Alex Kapranoff 2000-09-12 14:49:05 Re: Unbreak plperl building
Previous Message Bruce Momjian 2000-09-12 14:10:10 Re: Patch for JDBC driver not returning correct # of re cords deleted