mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Additional SQLState work for JDBC - thanks to Kim Ho at Redhat for input on this
Modified Files: jdbc/build.xml jdbc/org/postgresql/core/QueryExecutor.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java jdbc/org/postgresql/util/PSQLState.java
This commit is contained in:
parent
fcdf0e22fc
commit
5cdf771d8a
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.24 2003/09/08 17:30:22 barry Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.25 2003/09/09 10:49:16 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -340,7 +340,7 @@ public class QueryExecutor
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.con.ioerror", e);
|
throw new PSQLException("postgresql.con.ioerror", PSQLState.CONNECTION_FAILURE_DURING_TRANSACTION, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ public class QueryExecutor
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.con.ioerror", e);
|
throw new PSQLException("postgresql.con.ioerror", PSQLState.CONNECTION_FAILURE_DURING_TRANSACTION, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.24 2003/09/08 17:30:22 barry Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.25 2003/09/09 10:49:16 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -252,7 +252,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
|
|||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
// Server does not support ssl
|
// Server does not support ssl
|
||||||
throw new PSQLException("postgresql.con.sslnotsupported");
|
throw new PSQLException("postgresql.con.sslnotsupported", PSQLState.CONNECTION_FAILURE);
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
// Server supports ssl
|
// Server supports ssl
|
||||||
@ -262,7 +262,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new PSQLException("postgresql.con.sslfail");
|
throw new PSQLException("postgresql.con.sslfail", PSQLState.CONNECTION_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -559,7 +559,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
|
|||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
// Server does not support ssl
|
// Server does not support ssl
|
||||||
throw new PSQLException("postgresql.con.sslnotsupported");
|
throw new PSQLException("postgresql.con.sslnotsupported", PSQLState.CONNECTION_FAILURE);
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
// Server supports ssl
|
// Server supports ssl
|
||||||
@ -569,7 +569,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new PSQLException("postgresql.con.sslfail");
|
throw new PSQLException("postgresql.con.sslfail", PSQLState.CONNECTION_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1610,7 +1610,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
|
|||||||
}
|
}
|
||||||
BaseResultSet result = execSQL(sql);
|
BaseResultSet result = execSQL(sql);
|
||||||
if (result.getColumnCount() != 1 || result.getTupleCount() != 1) {
|
if (result.getColumnCount() != 1 || result.getTupleCount() != 1) {
|
||||||
throw new PSQLException("postgresql.unexpected");
|
throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
result.next();
|
result.next();
|
||||||
pgType = result.getString(1);
|
pgType = result.getString(1);
|
||||||
@ -1651,7 +1651,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
|
|||||||
}
|
}
|
||||||
BaseResultSet result = execSQL(sql);
|
BaseResultSet result = execSQL(sql);
|
||||||
if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
|
if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
|
||||||
throw new PSQLException("postgresql.unexpected");
|
throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
|
||||||
result.next();
|
result.next();
|
||||||
oid = Integer.parseInt(result.getString(1));
|
oid = Integer.parseInt(result.getString(1));
|
||||||
typeOidCache.put(typeName, new Integer(oid));
|
typeOidCache.put(typeName, new Integer(oid));
|
||||||
|
@ -6,6 +6,7 @@ import java.util.*;
|
|||||||
import org.postgresql.core.BaseStatement;
|
import org.postgresql.core.BaseStatement;
|
||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
import org.postgresql.util.PSQLException;
|
import org.postgresql.util.PSQLException;
|
||||||
|
import org.postgresql.util.PSQLState;
|
||||||
import org.postgresql.Driver;
|
import org.postgresql.Driver;
|
||||||
|
|
||||||
public abstract class AbstractJdbc1DatabaseMetaData
|
public abstract class AbstractJdbc1DatabaseMetaData
|
||||||
@ -43,7 +44,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
String sql = "SELECT t1.typlen/t2.typlen FROM "+from+" t1.typelem=t2.oid AND t1.typname='oidvector'";
|
String sql = "SELECT t1.typlen/t2.typlen FROM "+from+" t1.typelem=t2.oid AND t1.typname='oidvector'";
|
||||||
ResultSet rs = connection.createStatement().executeQuery(sql);
|
ResultSet rs = connection.createStatement().executeQuery(sql);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
throw new PSQLException("postgresql.unexpected");
|
throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
INDEX_MAX_KEYS = rs.getInt(1);
|
INDEX_MAX_KEYS = rs.getInt(1);
|
||||||
rs.close();
|
rs.close();
|
||||||
@ -61,7 +62,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
}
|
}
|
||||||
ResultSet rs = connection.createStatement().executeQuery(sql);
|
ResultSet rs = connection.createStatement().executeQuery(sql);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
throw new PSQLException("postgresql.unexpected");
|
throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
NAMEDATALEN = rs.getInt("typlen");
|
NAMEDATALEN = rs.getInt("typlen");
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.16 2003/09/08 17:30:22 barry Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.17 2003/09/09 10:49:16 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -242,7 +242,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.res.badshort", s);
|
throw new PSQLException("postgresql.res.badshort", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
@ -368,7 +368,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException l_uee)
|
catch (UnsupportedEncodingException l_uee)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_uee);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -399,7 +399,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException l_uee)
|
catch (UnsupportedEncodingException l_uee)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_uee);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -814,7 +814,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException ("postgresql.res.badint", s);
|
throw new PSQLException ("postgresql.res.badint", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
@ -831,7 +831,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException ("postgresql.res.badlong", s);
|
throw new PSQLException ("postgresql.res.badlong", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
@ -849,7 +849,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException ("postgresql.res.badbigdec", s);
|
throw new PSQLException ("postgresql.res.badbigdec", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
|
||||||
}
|
}
|
||||||
if (scale == -1)
|
if (scale == -1)
|
||||||
return val;
|
return val;
|
||||||
@ -859,7 +859,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (ArithmeticException e)
|
catch (ArithmeticException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException ("postgresql.res.badbigdec", s);
|
throw new PSQLException ("postgresql.res.badbigdec", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null; // SQL NULL
|
return null; // SQL NULL
|
||||||
@ -876,7 +876,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException ("postgresql.res.badfloat", s);
|
throw new PSQLException ("postgresql.res.badfloat", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
@ -893,7 +893,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException ("postgresql.res.baddouble", s);
|
throw new PSQLException ("postgresql.res.baddouble", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // SQL NULL
|
return 0; // SQL NULL
|
||||||
@ -912,7 +912,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.res.baddate", s);
|
throw new PSQLException("postgresql.res.baddate",PSQLState.BAD_DATETIME_FORMAT, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +954,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.res.badtime", s);
|
throw new PSQLException("postgresql.res.badtime", PSQLState.BAD_DATETIME_FORMAT, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1055,7 +1055,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException e)
|
catch (NumberFormatException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", e);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The nanos field stores nanoseconds. Adjust the parsed
|
// The nanos field stores nanoseconds. Adjust the parsed
|
||||||
@ -1140,7 +1140,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
}
|
}
|
||||||
catch (ParseException e)
|
catch (ParseException e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.res.badtimestamp", PSQLState.UNKNOWN_STATE, new Integer(e.getErrorOffset()), s);
|
throw new PSQLException("postgresql.res.badtimestamp", PSQLState.BAD_DATETIME_FORMAT, new Integer(e.getErrorOffset()), s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import java.sql.Timestamp;
|
|||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.34 2003/09/08 17:30:22 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.35 2003/09/09 10:49:16 barry Exp $
|
||||||
* This class defines methods of the jdbc1 specification. This class is
|
* This class defines methods of the jdbc1 specification. This class is
|
||||||
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
|
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
|
||||||
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
|
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
|
||||||
@ -203,7 +203,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
while (result != null && !result.reallyResultSet())
|
while (result != null && !result.reallyResultSet())
|
||||||
result = (BaseResultSet) result.getNext();
|
result = (BaseResultSet) result.getNext();
|
||||||
if (result == null)
|
if (result == null)
|
||||||
throw new PSQLException("postgresql.stat.noresult");
|
throw new PSQLException("postgresql.stat.noresult", PSQLState.NO_DATA);
|
||||||
return (ResultSet) result;
|
return (ResultSet) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,9 +443,9 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
if (isFunction)
|
if (isFunction)
|
||||||
{
|
{
|
||||||
if (!result.reallyResultSet())
|
if (!result.reallyResultSet())
|
||||||
throw new PSQLException("postgresql.call.noreturnval");
|
throw new PSQLException("postgresql.call.noreturnval", PSQLState.NO_DATA);
|
||||||
if (!result.next ())
|
if (!result.next ())
|
||||||
throw new PSQLException ("postgresql.call.noreturnval");
|
throw new PSQLException ("postgresql.call.noreturnval", PSQLState.NO_DATA);
|
||||||
callResult = result.getObject(1);
|
callResult = result.getObject(1);
|
||||||
int columnType = result.getMetaData().getColumnType(1);
|
int columnType = result.getMetaData().getColumnType(1);
|
||||||
if (columnType != functionReturnType)
|
if (columnType != functionReturnType)
|
||||||
@ -1293,11 +1293,11 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException l_uee)
|
catch (UnsupportedEncodingException l_uee)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_uee);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
|
||||||
}
|
}
|
||||||
catch (IOException l_ioe)
|
catch (IOException l_ioe)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_ioe);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1342,11 +1342,11 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException l_uee)
|
catch (UnsupportedEncodingException l_uee)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_uee);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
|
||||||
}
|
}
|
||||||
catch (IOException l_ioe)
|
catch (IOException l_ioe)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_ioe);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1389,7 +1389,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
}
|
}
|
||||||
catch (IOException l_ioe)
|
catch (IOException l_ioe)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_ioe);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
|
||||||
}
|
}
|
||||||
if (l_bytesRead == length)
|
if (l_bytesRead == length)
|
||||||
{
|
{
|
||||||
@ -1429,7 +1429,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
}
|
}
|
||||||
catch (IOException se)
|
catch (IOException se)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", se);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
|
||||||
}
|
}
|
||||||
// lob is closed by the stream so don't call lob.close()
|
// lob is closed by the stream so don't call lob.close()
|
||||||
setInt(parameterIndex, oid);
|
setInt(parameterIndex, oid);
|
||||||
@ -2097,7 +2097,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.format.baddate", PSQLState.UNKNOWN_STATE, s , "yyyy-MM-dd[-tz]");
|
throw new PSQLException("postgresql.format.baddate", PSQLState.BAD_DATETIME_FORMAT, s , "yyyy-MM-dd[-tz]");
|
||||||
}
|
}
|
||||||
timezone = 0;
|
timezone = 0;
|
||||||
if (timezoneLocation>7 && timezoneLocation+3 == s.length())
|
if (timezoneLocation>7 && timezoneLocation+3 == s.length())
|
||||||
@ -2128,7 +2128,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.format.badtime", PSQLState.UNKNOWN_STATE, s, "HH:mm:ss[-tz]");
|
throw new PSQLException("postgresql.format.badtime", PSQLState.BAD_DATETIME_FORMAT, s, "HH:mm:ss[-tz]");
|
||||||
}
|
}
|
||||||
timezone = 0;
|
timezone = 0;
|
||||||
if (timezoneLocation != -1 && timezoneLocation+3 == s.length())
|
if (timezoneLocation != -1 && timezoneLocation+3 == s.length())
|
||||||
@ -2167,7 +2167,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.format.badtimestamp", PSQLState.UNKNOWN_STATE, s, "yyyy-MM-dd HH:mm:ss[.xxxxxx][-tz]");
|
throw new PSQLException("postgresql.format.badtimestamp", PSQLState.BAD_DATETIME_FORMAT, s, "yyyy-MM-dd HH:mm:ss[.xxxxxx][-tz]");
|
||||||
}
|
}
|
||||||
timezone = 0;
|
timezone = 0;
|
||||||
if (nanospos != -1)
|
if (nanospos != -1)
|
||||||
|
@ -10,7 +10,7 @@ import org.postgresql.largeobject.*;
|
|||||||
import org.postgresql.util.PSQLException;
|
import org.postgresql.util.PSQLException;
|
||||||
import org.postgresql.util.PSQLState;
|
import org.postgresql.util.PSQLState;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.16 2003/09/08 17:30:22 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.17 2003/09/09 10:49:16 barry Exp $
|
||||||
* This class defines methods of the jdbc2 specification. This class extends
|
* This class defines methods of the jdbc2 specification. This class extends
|
||||||
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
|
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
|
||||||
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
|
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
|
||||||
@ -227,7 +227,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
|
|||||||
}
|
}
|
||||||
catch (IOException se)
|
catch (IOException se)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", se);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -259,7 +259,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
|
|||||||
}
|
}
|
||||||
catch (IOException l_ioe)
|
catch (IOException l_ioe)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", l_ioe);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
|
||||||
}
|
}
|
||||||
setString(i, new String(l_chars, 0, l_charsRead));
|
setString(i, new String(l_chars, 0, l_charsRead));
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
|
|||||||
}
|
}
|
||||||
catch (IOException se)
|
catch (IOException se)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", se);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
|
||||||
}
|
}
|
||||||
// lob is closed by the stream so don't call lob.close()
|
// lob is closed by the stream so don't call lob.close()
|
||||||
setInt(i, oid);
|
setInt(i, oid);
|
||||||
@ -321,7 +321,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
|
|||||||
}
|
}
|
||||||
catch (IOException se)
|
catch (IOException se)
|
||||||
{
|
{
|
||||||
throw new PSQLException("postgresql.unusual", se);
|
throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
|
||||||
}
|
}
|
||||||
// lob is closed by the stream so don't call lob.close()
|
// lob is closed by the stream so don't call lob.close()
|
||||||
setInt(i, oid);
|
setInt(i, oid);
|
||||||
|
@ -28,6 +28,11 @@
|
|||||||
// begin constant state codes
|
// begin constant state codes
|
||||||
public final static PSQLState UNKNOWN_STATE = new PSQLState("");
|
public final static PSQLState UNKNOWN_STATE = new PSQLState("");
|
||||||
public final static PSQLState COMMUNICATION_ERROR = new PSQLState("08S01");
|
public final static PSQLState COMMUNICATION_ERROR = new PSQLState("08S01");
|
||||||
|
public final static PSQLState NO_DATA = new PSQLState("02000");
|
||||||
|
public final static PSQLState CONNECTION_FAILURE_DURING_TRANSACTION = new PSQLState("08007");
|
||||||
|
public final static PSQLState UNEXPECTED_ERROR = new PSQLState("99999");
|
||||||
|
public final static PSQLState NUMERIC_VALUE_OUT_OF_RANGE = new PSQLState("22003");
|
||||||
|
public final static PSQLState BAD_DATETIME_FORMAT = new PSQLState("22007");
|
||||||
public final static PSQLState DATA_ERROR = new PSQLState("22000");
|
public final static PSQLState DATA_ERROR = new PSQLState("22000");
|
||||||
public final static PSQLState CONNECTION_DOES_NOT_EXIST = new PSQLState("08003");
|
public final static PSQLState CONNECTION_DOES_NOT_EXIST = new PSQLState("08003");
|
||||||
public final static PSQLState CONNECTION_REJECTED = new PSQLState("08004");
|
public final static PSQLState CONNECTION_REJECTED = new PSQLState("08004");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user