pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC Patch
10+ messages / 7 participants
[nested] [flat]

* JDBC Patch
@ 1999-01-25 20:47  Peter T Mount <peter@retep.org.uk>
  0 siblings, 1 reply; 10+ messages in thread

From: Peter T Mount @ 1999-01-25 20:47 UTC (permalink / raw)
  To: PostgreSQL Patches <pgsql-patches@postgresql.org>; +Cc: pgsql-interfaces


This implements some of the JDBC2 methods, fixes a bug introduced into the
JDBC1 portion of the driver, and introduces a new example, showing how to
use the CORBA ORB thats in Java2 with JDBC.

The Tar file contains the new files, the diff the changes to the others.
CHANGELOG is separate as I forgot to make a .orig ;-)

Peter

-- 
       Peter T Mount peter@retep.org.uk
      Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
 Java PDF Generator: http://www.retep.org.uk/pdf

Attachments:

  jdbc2501.tar (application/x-tar, 30.0K) download

jdbc2501.diff (text/plain, 6.7K) download *** ./Makefile.orig Mon Jan 25 19:48:56 1999 --- ./Makefile Mon Jan 25 20:19:53 1999 *************** *** 9,19 **** --- 9,21 ---- #------------------------------------------------------------------------- FIND = find + IDL2JAVA = idltojava -fno-cpp -fno-tie JAR = jar JAVA = java JAVAC = javac JAVADOC = javadoc RM = rm -f + TOUCH = touch # This defines how to compile a java class .java.class: *************** *** 44,49 **** --- 46,54 ---- @echo ------------------------------------------------------------ @echo To build the examples, type: @echo " make examples" + @echo + @echo "To build the CORBA example (requires Java2):" + @echo " make corba" @echo ------------------------------------------------------------ @echo *************** *** 142,148 **** $(FIND) . -name "*~" -exec $(RM) {} \; $(FIND) . -name "*.class" -exec $(RM) {} \; $(FIND) . -name "*.html" -exec $(RM) {} \; ! $(RM) postgresql.jar -$(RM) -rf Package-postgresql *output ####################################################################### --- 147,154 ---- $(FIND) . -name "*~" -exec $(RM) {} \; $(FIND) . -name "*.class" -exec $(RM) {} \; $(FIND) . -name "*.html" -exec $(RM) {} \; ! -$(RM) -rf stock example/corba/stock.built ! -$(RM) postgresql.jar -$(RM) -rf Package-postgresql *output ####################################################################### *************** *** 219,225 **** example/datestyle.class: example/datestyle.java example/psql.class: example/psql.java example/ImageViewer.class: example/ImageViewer.java - #example/Objects.class: example/Objects.java example/threadsafe.class: example/threadsafe.java example/metadata.class: example/metadata.java ####################################################################### --- 225,261 ---- example/datestyle.class: example/datestyle.java example/psql.class: example/psql.java example/ImageViewer.class: example/ImageViewer.java example/threadsafe.class: example/threadsafe.java example/metadata.class: example/metadata.java + + ####################################################################### + # + # CORBA This extensive example shows how to integrate PostgreSQL + # JDBC & CORBA. + + CORBASRC = $(wildcard example/corba/*.java) + CORBAOBJ = $(subst .java,.class,$(CORBASRC)) + + corba: jdbc2 example/corba/stock.built $(CORBAOBJ) + @echo ------------------------------------------------------- + @echo The corba example has been built. Before running, you + @echo will need to read the example/corba/readme file on how + @echo to run the example. + @echo + + # + # This compiles our idl file and the stubs + # + # Note: The idl file is in example/corba, but it builds a directory under + # the current one. For safety, we delete that directory before running + # idltojava + # + example/corba/stock.built: example/corba/stock.idl + -rm -rf stock + $(IDL2JAVA) $< + $(JAVAC) stock/*.java + $(TOUCH) $@ + + # tip: we cant use $(wildcard stock/*.java) in the above rule as a race + # condition occurs, where javac is passed no arguments ####################################################################### *** ./postgresql/jdbc1/ResultSetMetaData.java.orig Mon Jan 25 12:02:07 1999 --- ./postgresql/jdbc1/ResultSetMetaData.java Mon Jan 25 12:03:11 1999 *************** *** 6,14 **** // postgresql.jdbc2 package. import java.lang.*; - import java.sql.*; import java.util.*; import postgresql.*; /** * A ResultSetMetaData object can be used to find out about the types and --- 6,19 ---- // postgresql.jdbc2 package. import java.lang.*; import java.util.*; import postgresql.*; + + // We explicitly import classes here as the original line: + //import java.sql.*; + // causes javac to get confused. + import java.sql.SQLException; + import java.sql.Types; /** * A ResultSetMetaData object can be used to find out about the types and *** ./postgresql/jdbc2/ResultSet.java.orig Mon Jan 25 20:07:18 1999 --- ./postgresql/jdbc2/ResultSet.java Mon Jan 25 20:15:46 1999 *************** *** 789,797 **** // ** JDBC 2 Extensions ** ! public boolean absolute(int row) throws SQLException { ! throw postgresql.Driver.notImplemented(); } public void afterLast() throws SQLException --- 789,800 ---- // ** JDBC 2 Extensions ** ! public boolean absolute(int index) throws SQLException { ! if (index < 0 || index > rows.size()) ! return false; ! this_row = (byte [][])rows.elementAt(index); ! return true; } public void afterLast() throws SQLException *************** *** 816,822 **** public boolean first() throws SQLException { ! throw postgresql.Driver.notImplemented(); } public Array getArray(String colName) throws SQLException --- 819,829 ---- public boolean first() throws SQLException { ! if (rows.size() <= 0) ! return false; ! current_row = 0; ! this_row = (byte [][])rows.elementAt(current_row); ! return true; } public Array getArray(String colName) throws SQLException *************** *** 941,947 **** public int getRow() throws SQLException { ! throw postgresql.Driver.notImplemented(); } // This one needs some thought, as not all ResultSets come from a statement --- 948,954 ---- public int getRow() throws SQLException { ! return current_row; } // This one needs some thought, as not all ResultSets come from a statement *************** *** 982,988 **** public boolean last() throws SQLException { ! throw postgresql.Driver.notImplemented(); } public void moveToCurrentRow() throws SQLException --- 989,999 ---- public boolean last() throws SQLException { ! if (rows.size() <= 0) ! return false; ! current_row = rows.size() - 1; ! this_row = (byte [][])rows.elementAt(current_row); ! return true; } public void moveToCurrentRow() throws SQLException *************** *** 997,1003 **** public boolean previous() throws SQLException { ! throw postgresql.Driver.notImplemented(); } public void refreshRow() throws SQLException --- 1008,1017 ---- public boolean previous() throws SQLException { ! if (--current_row < 0) ! return false; ! this_row = (byte [][])rows.elementAt(current_row); ! return true; } public void refreshRow() throws SQLException
CHANGELOG (text/plain, 6.6K) download Mon Jan 25 19:45:00 GMT 1999 - created subfolders example/corba and example/corba/idl to hold the new example showing how to hook CORBA and PostgreSQL via JDBC - implemented some JDBC2 methods curtesy of Joachim.Gabler@t-online.de Sat Jan 23 10:30:00 GMT 1999 - Changed imports in postgresql.jdbc1.ResultSetMetaData as for some reason it didn't want to compile under jdk1.1.6 Tue Dec 29 15:45:00 GMT 1998 - Refreshed the README (which was way out of date) Tue Dec 29 15:45:00 GMT 1998 - Finished adding the additional methods into the JDBC2 driver. - Had to add some explicit package references for the JDK1.2 Javac to cope with the driver Tue Dec 29 12:40:00 GMT 1998 - Fixed package imports and some references to java.sql.ResultSet in various files. Compiled and tested the JDBC1 driver. Mon Dec 28 19:01:37 GMT 1998 - created a new package postgresql.jdbc2 which will contain the JDBC 2 specific classes. A similar new package (postgresql.jdbc1) has been created to hold the JDBC 1 specific classes. - modified Makefile to allow compilation of the JDBC 1 & 2 drivers, with the possibility of building a dual-spec driver. - changed the version number in postgresql.Driver to 6.5 - modified postgresql.Driver class to initiate the correct driver when used under a 1.1 or 1.2+ JVM. - postgresql.Connection and postgresql.jdbc2.Connection now extends the new class postgresql.ConnectionStub, which allows us to dynamically open the JDBC1 or JDBC2 drivers. - enabled compilation of the driver under Win32 when using the Make from the CygWin package (Cygnus B20.1 was used). - To make future development easier (now we have 2 specifications to work with) the following classes have moved from the postgresql to the postgresql.jdbc1 package: CallableStatement Connection DatabaseMetaData PreparedStatement ResultSet ResultSetMetaData Statement Some of these classes have common code that is not dependent on either JDBC specification. These common code are still in the postgresql package. Ie: postgresql.jdbc1.Connection extends postgresql.Connection and postgresql.jdbc2.Connection extends postgresql.Connection Web Oct 7 22:00:00 BST 1998 - removed syncronised from Connection.ExecSQL(). See next entry. - added new syncronised locking in the Connection.ExecSQL() and FastPath.fastpath() methods. They now lock against the PG_Steam object for the connection, which now provides full Thread Safety. - Reposted ChangeLog as it's missing from CVS. Modifications done since 6.3.2 was released and Sun Aug 30 11:33:06 BST 1998 - Fixed PreparedStatement.setObject as it didn't handle shorts - ResultSet.getDate() now handles null dates (returns null ratrher than a NullPointerException) - ResultSetMetaData.getPrecision() new returns 0 for VARCHAR - Field now caches the typename->oid in a Hashtable to speed things up. It removes the need for some unnecessary queries to the backend. - PreparedStatement.toString() now returns the SQL statement that it will send to the backend. Before it did nothing. - DatabaseMetaData.getTypeInfo() now does something. - Connection now throws an exception if either of the user or password properties are missing, as they are required for JDBC to work. This occasionally occurs when the client uses the properties version of getConnection(), and is a common question on the email lists. Sun Aug 30 11:33:06 BST 1998 - Created ChangeLog file, and entered stuff done since 6.3.2 and today - Change version number to 6.4 in Driver.java - Added fix to DatabaseMetaData.getTables() submitted by Stefan Andreasen <stefan@linux.kapow.dk> - Added fix to DatabaseMetaData.getColumns() to handle patterns submitted by Stefan Andreasen <stefan@linux.kapow.dk> - Set TcpNoDelay on the connection, as this gives us a 10x speed improvement on FreeBSD (caused by a bug in their TCP Stack). They should fix the bug before 6.4 is released, but will keep this in here unless it causes more problems. Submitted by Jason Venner <jason@idiom.com> - Removed a duplicate definition of fieldCache - Added a more meaningful message when the connection is refused. It now says: Connection refused. Check that the hostname and port is correct, and that the postmaster is running with the -i flag, which enables TCP/IP networking. - Removed kludge in PreparedStatement.setDate() that acted as a temporary fix to a bug in SimpleDateFormat, as it broke date handling in JDK 1.1.6. - Modified PG_Stream and Connection, so that outbound data is now buffered. This should give us a speed improvement, and reduce the ammount of network packets generated. - Removed duplicate code and optimised PG_Stream. - PG_Stream now returns a more meaningful message when the connection is broken by the backend. It now returns: The backend has broken the connection. Possibly the action you have attempted has caused it to close. - Removed obsolete code from Connection. - The error message returned when the authentication scheme is unknown has been extended. It now reads: Authentication type ### not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or Subnet, and is using a supported authentication scheme. - Connection.getMetaData() now caches the instance returned, so multiple calls will return the same instance. - Created a test application that tests the DatabaseMetaData and ResultSetMetaData classes. - Replaced getString(#).getBytes() with getBytes(#) which should speed things up, and reduce memory useage. - Optimised DatabaseMetaData.getProcedures(), and implemented patterns - Fixed NullPointerExceptions thrown when a field is null (Internal to the driver, not caused by results from the backend. DatabaseMetaData.getProcedures() is an example of a method that causes this): - ResultSetMetaData.getColumnName() now returns field# where # is the column name. - ResultSet.getObject() fixed - Fixed bug in psql example that was affected by null fields - DatabaseMetaData.getTables() - DatabaseMetaData.getPrimaryKeys() ran a query with an ambiguous field fixed. - getTypeInfo() optimised to increase speed and reduce memory useage - ResultSetMetaData.isCurrency() optimised and is now smaller. - Removed unnecessary code fromResultSetMetaData.getCatalogName() and getSchemaName(). - Created new class postgresql.util.PGmoney to map the money type - Created new class postgresql.geometric.PGline to map the line type
^ permalink raw reply [nested|flat] 10+ messages in thread

* Re: [PATCHES] JDBC Patch
@ 1999-01-25 21:22  The Hermit Hacker <scrappy@hub.org>
  parent: Peter T Mount <peter@retep.org.uk>
  0 siblings, 0 replies; 10+ messages in thread

From: The Hermit Hacker @ 1999-01-25 21:22 UTC (permalink / raw)
  To: Peter T Mount <peter@retep.org.uk>; +Cc: PostgreSQL Patches <pgsql-patches@postgreSQL.org>; pgsql-interfaces


Applied :)

On Mon, 25 Jan 1999, Peter T Mount wrote:

> 
> This implements some of the JDBC2 methods, fixes a bug introduced into the
> JDBC1 portion of the driver, and introduces a new example, showing how to
> use the CORBA ORB thats in Java2 with JDBC.
> 
> The Tar file contains the new files, the diff the changes to the others.
> CHANGELOG is separate as I forgot to make a .orig ;-)
> 
> Peter
> 
> -- 
>        Peter T Mount peter@retep.org.uk
>       Main Homepage: http://www.retep.org.uk
> PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
>  Java PDF Generator: http://www.retep.org.uk/pdf
> 

Marc G. Fournier                                
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* JDBC Patch
@ 2000-08-24 19:30  Christopher Cain <ccain@mhsoftware.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Christopher Cain @ 2000-08-24 19:30 UTC (permalink / raw)
  To: pgsql-interfaces; pgsql-patches@postgresql.org

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

Attachments:

jdbc-0824.patch (text/plain, 5.5K) download diff -U 5 -r postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java --- postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java 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.java postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java --- postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java 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.
^ permalink raw reply [nested|flat] 10+ messages in thread

* RE: JDBC Patch
@ 2000-08-25 06:29  Peter Mount <petermount@it.maidstone.gov.uk>
  0 siblings, 0 replies; 10+ messages in thread

From: Peter Mount @ 2000-08-25 06:29 UTC (permalink / raw)
  To: 'Christopher Cain' <ccain@mhsoftware.com>; pgsql-interfaces; pgsql-patches@postgresql.org

Hmmm, I thought I had caught all the version strings. Thanks for spotting
it.

I'll commit that one and the others later today.

Peter

-----Original Message-----
From: Christopher Cain [mailto:ccain@mhsoftware.com]
Sent: Thursday, August 24, 2000 8:30 PM
To: pgsql-interfaces@postgresql.org; pgsql-patches@postgresql.org
Subject: [INTERFACES] JDBC Patch


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



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* RE: JDBC Patch
@ 2000-08-25 08:36  Peter Mount <petermount@it.maidstone.gov.uk>
  0 siblings, 0 replies; 10+ messages in thread

From: Peter Mount @ 2000-08-25 08:36 UTC (permalink / raw)
  To: 'Peter Eisentraut' <peter_e@gmx.net>; Peter Mount <petermount@it.maidstone.gov.uk>; +Cc: 'Christopher Cain' <ccain@mhsoftware.com>; pgsql-interfaces; pgsql-patches@postgresql.org

The problem is that there are so many different places it can go. I was
thinking of moving the version stuff into DriverClass.java (which is built
dynamically by make), but I'm not sure how adding malefile.global would
affect the compilation process.

However, JDBC needs:

Full string:	"7.0.2"
Major version:	7
Minor version:	0

and those are just from memory.

If I get chance today, I'll look into it.

Peter

-- 
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@it.maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council


-----Original Message-----
From: Peter Eisentraut [mailto:peter_e@gmx.net]
Sent: Friday, August 25, 2000 9:28 AM
To: Peter Mount
Cc: 'Christopher Cain'; pgsql-interfaces@postgresql.org;
pgsql-patches@postgresql.org
Subject: RE: [INTERFACES] JDBC Patch


Peter Mount writes:

> Hmmm, I thought I had caught all the version strings. Thanks for spotting
> it.

Peter, you can avoid this sort of thing in the future. Makefile.global
defines a variable `VERSION' that you should compile into the binaries.
I'm not sure exactly how it would work with Java, but perhaps something
like this:

javac -Dversion='"$(VERSION)"' xyz.java

or run sed before the compilation.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [PATCHES] JDBC Patch
@ 2000-09-12 04:16  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Christopher Cain <ccain@mhsoftware.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Bruce Momjian @ 2000-09-12 04:16 UTC (permalink / raw)
  To: Christopher Cain <ccain@mhsoftware.com>; +Cc: pgsql-interfaces; pgsql-patches@postgresql.org

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.java postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
> --- postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java	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.java postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
> --- postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java	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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* RE: [PATCHES] JDBC Patch
@ 2000-09-12 06:56  Peter Mount <petermount@maidstone.gov.uk>
  0 siblings, 2 replies; 10+ messages in thread

From: Peter Mount @ 2000-09-12 06:56 UTC (permalink / raw)
  To: 'Bruce Momjian' <pgman@candle.pha.pa.us>; Christopher Cain <ccain@mhsoftware.com>; +Cc: pgsql-interfaces; pgsql-patches@postgresql.org

Eeek, I've got this in my copy ready to commit. How is CVS going to handle
this problem?

Peter

-- 
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.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@candle.pha.pa.us]
Sent: Tuesday, September 12, 2000 5:17 AM
To: Christopher Cain
Cc: pgsql-interfaces@postgresql.org; pgsql-patches@postgresql.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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [PATCHES] JDBC Patch
@ 2000-09-12 07:16  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Mount <petermount@maidstone.gov.uk>
  1 sibling, 0 replies; 10+ messages in thread

From: Tom Lane @ 2000-09-12 07:16 UTC (permalink / raw)
  To: Peter Mount <petermount@maidstone.gov.uk>; +Cc: 'Bruce Momjian' <pgman@candle.pha.pa.us>; Christopher Cain <ccain@mhsoftware.com>; pgsql-interfaces; pgsql-patches@postgresql.org

Peter Mount <petermount@maidstone.gov.uk> writes:
> Eeek, I've got this in my copy ready to commit. How is CVS going to handle
> this problem?

You'll have to "cvs update" those files and then check that the changes
were merged correctly before you commit.  I believe CVS will not let
you commit a file in which there are changes since your last cvs update.

Although "cvs update" will try to merge the changes from the repository
with your local edits, my experience is that CVS is not too bright about
merging overlapping differences.  I prefer to do the change merge by
hand --- move my modified files someplace else, cvs update to fetch
clean current copies, then edit to bring the files back in sync.  This
process is a bit tedious, but much more reliable than CVS by itself.

Jan Wieck has posted about his preferred method, which IIRC involves
working in a complete separate copy of the source tree, and then
using "diff -c -R" to generate a summary of his changes.  Then he
cvs update's his reference tree and uses "patch" to apply the
diff output to it, followed by hand cleanup of whatever merges patch
couldn't handle.  This is probably a better way if you plan to do
a large pile of changes between syncs with the repository.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* RE: [PATCHES] JDBC Patch
@ 2000-09-12 07:19  Peter Mount <petermount@maidstone.gov.uk>
  0 siblings, 0 replies; 10+ messages in thread

From: Peter Mount @ 2000-09-12 07:19 UTC (permalink / raw)
  To: 'Tom Lane' <tgl@sss.pgh.pa.us>; Peter Mount <petermount@maidstone.gov.uk>; +Cc: 'Bruce Momjian' <pgman@candle.pha.pa.us>; Christopher Cain <ccain@mhsoftware.com>; pgsql-interfaces; pgsql-patches@postgresql.org

Thanks, this follows previous experience where I've had to check out a fresh
set, run diff, and then merge by hand. It's just more tedious with only a
28k connection.

Peter

-- 
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Tuesday, September 12, 2000 8:16 AM
To: Peter Mount
Cc: 'Bruce Momjian'; Christopher Cain; pgsql-interfaces@postgresql.org;
pgsql-patches@postgresql.org
Subject: Re: [PATCHES] JDBC Patch 


Peter Mount <petermount@maidstone.gov.uk> writes:
> Eeek, I've got this in my copy ready to commit. How is CVS going to handle
> this problem?

You'll have to "cvs update" those files and then check that the changes
were merged correctly before you commit.  I believe CVS will not let
you commit a file in which there are changes since your last cvs update.

Although "cvs update" will try to merge the changes from the repository
with your local edits, my experience is that CVS is not too bright about
merging overlapping differences.  I prefer to do the change merge by
hand --- move my modified files someplace else, cvs update to fetch
clean current copies, then edit to bring the files back in sync.  This
process is a bit tedious, but much more reliable than CVS by itself.

Jan Wieck has posted about his preferred method, which IIRC involves
working in a complete separate copy of the source tree, and then
using "diff -c -R" to generate a summary of his changes.  Then he
cvs update's his reference tree and uses "patch" to apply the
diff output to it, followed by hand cleanup of whatever merges patch
couldn't handle.  This is probably a better way if you plan to do
a large pile of changes between syncs with the repository.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [PATCHES] JDBC Patch
@ 2000-09-12 14:10  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Peter Mount <petermount@maidstone.gov.uk>
  1 sibling, 0 replies; 10+ messages in thread

From: Bruce Momjian @ 2000-09-12 14:10 UTC (permalink / raw)
  To: Peter Mount <petermount@maidstone.gov.uk>; +Cc: Christopher Cain <ccain@mhsoftware.com>; pgsql-interfaces; pgsql-patches@postgresql.org

[ 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@maidstone.gov.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@candle.pha.pa.us]
> Sent: Tuesday, September 12, 2000 5:17 AM
> To: Christopher Cain
> Cc: pgsql-interfaces@postgresql.org; pgsql-patches@postgresql.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@candle.pha.pa.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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2000-09-12 14:10 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-01-25 20:47 JDBC Patch Peter T Mount <peter@retep.org.uk>
1999-01-25 21:22 ` The Hermit Hacker <scrappy@hub.org>
2000-08-24 19:30 JDBC Patch Christopher Cain <ccain@mhsoftware.com>
2000-09-12 04:16 ` Bruce Momjian <pgman@candle.pha.pa.us>
2000-08-25 06:29 RE: JDBC Patch Peter Mount <petermount@it.maidstone.gov.uk>
2000-08-25 08:36 RE: JDBC Patch Peter Mount <petermount@it.maidstone.gov.uk>
2000-09-12 06:56 RE: [PATCHES] JDBC Patch Peter Mount <petermount@maidstone.gov.uk>
2000-09-12 07:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-09-12 14:10 ` Bruce Momjian <pgman@candle.pha.pa.us>
2000-09-12 07:19 RE: [PATCHES] JDBC Patch Peter Mount <petermount@maidstone.gov.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox