1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

More SQLState updates from Kim Ho at Redhat.

Also a patch from Kris Jurka to correctly report SQLState support.

 Modified Files:
 	jdbc/org/postgresql/Driver.java.in
 	jdbc/org/postgresql/core/QueryExecutor.java
 	jdbc/org/postgresql/fastpath/Fastpath.java
 	jdbc/org/postgresql/geometric/PGbox.java
 	jdbc/org/postgresql/geometric/PGcircle.java
 	jdbc/org/postgresql/geometric/PGline.java
 	jdbc/org/postgresql/geometric/PGlseg.java
 	jdbc/org/postgresql/geometric/PGpath.java
 	jdbc/org/postgresql/geometric/PGpoint.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc2/Array.java
 	jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
 	jdbc/org/postgresql/util/PGmoney.java
 	jdbc/org/postgresql/util/PSQLState.java
This commit is contained in:
Barry Lind
2003-09-13 04:02:16 +00:00
parent f8c365c8db
commit 509a9cd3f9
19 changed files with 92 additions and 72 deletions

View File

@@ -9,7 +9,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.25 2003/09/09 10:49:16 barry Exp $
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.26 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -373,7 +373,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
case AUTH_REQ_SCM:
if (Driver.logDebug)
Driver.debug("postgresql: SCM");
throw new PSQLException("postgresql.con.scm");
throw new PSQLException("postgresql.con.scm", PSQLState.CONNECTION_REJECTED);
case AUTH_REQ_PASSWORD:

View File

@@ -9,7 +9,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.17 2003/09/09 10:49:16 barry Exp $
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.18 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -211,7 +211,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
}
catch (NumberFormatException e)
{
throw new PSQLException("postgresql.res.badbyte", s);
throw new PSQLException("postgresql.res.badbyte", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
}
}
return 0; // SQL NULL
@@ -565,7 +565,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
Field field;
if (columnIndex < 1 || columnIndex > fields.length)
throw new PSQLException("postgresql.res.colrange");
throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
field = fields[columnIndex - 1];
// some fields can be null, mainly from those returned by MetaData methods
@@ -788,7 +788,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
if ( this_row == null )
throw new PSQLException("postgresql.res.nextrequired");
if ( column < 1 || column > fields.length )
throw new PSQLException("postgresql.res.colrange" );
throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE );
}
//----------------- Formatting Methods -------------------

View File

@@ -3,6 +3,7 @@ package org.postgresql.jdbc1;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Vector;
@@ -454,7 +455,7 @@ public abstract class AbstractJdbc1ResultSetMetaData
private Field getField(int columnIndex) throws SQLException
{
if (columnIndex < 1 || columnIndex > fields.length)
throw new PSQLException("postgresql.res.colrange");
throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
return fields[columnIndex - 1];
}
}

View File

@@ -26,7 +26,7 @@ import java.sql.Timestamp;
import java.sql.Types;
import java.util.Vector;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.35 2003/09/09 10:49:16 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.36 2003/09/13 04:02:15 barry Exp $
* This class defines methods of the jdbc1 specification. This class is
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
@@ -292,7 +292,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
public boolean execute() throws SQLException
{
if (isFunction && !returnTypeSet)
throw new PSQLException("postgresql.call.noreturntype");
throw new PSQLException("postgresql.call.noreturntype", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
if (isFunction)
{ // set entry 1 to dummy entry..
m_binds[0] = ""; // dummy entry which ensured that no one overrode
@@ -1641,9 +1641,9 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
{
if (parameterIndex != 1)
throw new PSQLException ("postgresql.call.noinout");
throw new PSQLException ("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
if (!isFunction)
throw new PSQLException ("postgresql.call.procasfunc", originalSql);
throw new PSQLException ("postgresql.call.procasfunc", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL,originalSql);
// functionReturnType contains the user supplied value to check
// testReturn contains a modified version to make it easier to
@@ -1955,7 +1955,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
private void bind(int paramIndex, Object s, String type) throws SQLException
{
if (paramIndex < 1 || paramIndex > m_binds.length)
throw new PSQLException("postgresql.prep.range", PSQLState.PARAMETER_ERROR);
throw new PSQLException("postgresql.prep.range", PSQLState.INVALID_PARAMETER_VALUE);
if (paramIndex == 1 && isFunction) // need to registerOut instead
throw new PSQLException ("postgresql.call.funcover");
m_binds[paramIndex - 1] = s;
@@ -1997,7 +1997,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
isValid = false;
index = l_sql.indexOf ("call");
if (index == -1 || !isValid)
throw new PSQLException ("postgresql.call.malformed",
throw new PSQLException ("postgresql.call.malformed",PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL,
new Object[]{l_sql, JDBC_SYNTAX});
l_sql = l_sql.replace ('{', ' '); // replace these characters
l_sql = l_sql.replace ('}', ' ');
@@ -2027,7 +2027,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
{
checkIndex (parameterIndex);
if (type1 != this.testReturn && type2 != this.testReturn)
throw new PSQLException("postgresql.call.wrongget",
throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
"java.sql.Types=" + type1});
@@ -2040,7 +2040,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
{
checkIndex (parameterIndex);
if (type != this.testReturn)
throw new PSQLException("postgresql.call.wrongget",
throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
"java.sql.Types=" + type});
@@ -2053,9 +2053,9 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
private void checkIndex (int parameterIndex) throws SQLException
{
if (!isFunction)
throw new PSQLException("postgresql.call.noreturntype");
throw new PSQLException("postgresql.call.noreturntype", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
if (parameterIndex != 1)
throw new PSQLException("postgresql.call.noinout");
throw new PSQLException("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
}