diff options
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql')
3 files changed, 81 insertions, 4 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/core/BaseStatement.java b/src/interfaces/jdbc/org/postgresql/core/BaseStatement.java index dc5ffbdf787..cf87cd199e5 100644 --- a/src/interfaces/jdbc/org/postgresql/core/BaseStatement.java +++ b/src/interfaces/jdbc/org/postgresql/core/BaseStatement.java @@ -6,7 +6,7 @@   * Copyright (c) 2003, PostgreSQL Global Development Group   *   * IDENTIFICATION - *	  $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseStatement.java,v 1.2 2003/05/03 20:40:45 barry Exp $ + *	  $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseStatement.java,v 1.3 2003/05/07 03:03:30 barry Exp $   *   *-------------------------------------------------------------------------   */ @@ -28,6 +28,7 @@ public interface BaseStatement extends org.postgresql.PGStatement  	 * any ResultSet can contain.  If the limit is exceeded, the  	 * excess rows are silently dropped.  	 */ +	public void addWarning(String p_warning) throws SQLException;  	public int getFetchSize() throws SQLException;  	public int getMaxRows() throws SQLException;  	public int getResultSetConcurrency() throws SQLException; diff --git a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java index 7714f0230cf..11f795c5970 100644 --- a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java +++ b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java @@ -6,7 +6,7 @@   * Copyright (c) 2003, PostgreSQL Global Development Group   *   * IDENTIFICATION - *	  $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.20 2003/03/07 18:39:42 barry Exp $ + *	  $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.21 2003/05/07 03:03:30 barry Exp $   *   *-------------------------------------------------------------------------   */ @@ -148,7 +148,7 @@ public class QueryExecutor  						int t = pgStream.ReceiveChar();  						break;  					case 'N':	// Error Notification -						connection.addWarning(pgStream.ReceiveString(connection.getEncoding())); +						statement.addWarning(pgStream.ReceiveString(connection.getEncoding()));  						break;  					case 'P':	// Portal Name  						String pname = pgStream.ReceiveString(connection.getEncoding()); diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java index 710d21557bc..f76eeb6cc49 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java @@ -2,7 +2,7 @@ package org.postgresql.jdbc3;  import java.sql.*; -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.2 2002/09/06 21:23:06 momjian Exp $ +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.3 2003/05/07 03:03:30 barry Exp $   * This class defines methods of the jdbc3 specification.  This class extends   * org.postgresql.jdbc2.AbstractJdbc2Connection which provides the jdbc2   * methods.  The real Connection class (for jdbc3) is org.postgresql.jdbc3.Jdbc3Connection @@ -375,6 +375,82 @@ public abstract class AbstractJdbc3Connection extends org.postgresql.jdbc2.Abstr  		throw org.postgresql.Driver.notImplemented();  	} +	/* +	 * This implemetation uses the jdbc3Types array to support the jdbc3 +	 * datatypes.  Basically jdbc2 and jdbc3 are the same, except that +	 * jdbc3 adds some +	 */ +	public int getSQLType(String pgTypeName) +	{ +		int sqlType = Types.OTHER; // default value +		for (int i = 0;i < jdbc3Types.length;i++) +		{ +			if (pgTypeName.equals(jdbc3Types[i])) +			{ +				sqlType = jdbc3Typei[i]; +				break; +			} +		} +		return sqlType; +	} + +	/* +	 * This table holds the org.postgresql names for the types supported. +	 * Any types that map to Types.OTHER (eg POINT) don't go into this table. +	 * They default automatically to Types.OTHER +	 * +	 * Note: This must be in the same order as below. +	 * +	 * Tip: keep these grouped together by the Types. value +	 */ +	private static final String jdbc3Types[] = { +				"int2", +				"int4", "oid", +				"int8", +				"cash", "money", +				"numeric", +				"float4", +				"float8", +				"bpchar", "char", "char2", "char4", "char8", "char16", +				"varchar", "text", "name", "filename", +				"bytea", +				"bool", +				"date", +				"time", +				"abstime", "timestamp", "timestamptz", +				"_bool", "_char", "_int2", "_int4", "_text", +				"_oid", "_varchar", "_int8", "_float4", "_float8", +				"_abstime", "_date", "_time", "_timestamp", "_numeric", +				"_bytea" +			}; + +	/* +	 * This table holds the JDBC type for each entry above. +	 * +	 * Note: This must be in the same order as above +	 * +	 * Tip: keep these grouped together by the Types. value +	 */ +	private static final int jdbc3Typei[] = { +			Types.SMALLINT, +			Types.INTEGER, Types.INTEGER, +			Types.BIGINT, +			Types.DOUBLE, Types.DOUBLE, +			Types.NUMERIC, +			Types.REAL, +			Types.DOUBLE, +			Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, +			Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, +			Types.BINARY, +			Types.BIT, +			Types.DATE, +			Types.TIME, +			Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP, +			Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, +			Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, +			Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, +			Types.ARRAY +	   };  }  | 
