diff options
Diffstat (limited to 'src/interfaces/jdbc/postgresql/jdbc1')
5 files changed, 31 insertions, 28 deletions
diff --git a/src/interfaces/jdbc/postgresql/jdbc1/Connection.java b/src/interfaces/jdbc/postgresql/jdbc1/Connection.java index 790dfa6ab0..f7c88c579a 100644 --- a/src/interfaces/jdbc/postgresql/jdbc1/Connection.java +++ b/src/interfaces/jdbc/postgresql/jdbc1/Connection.java @@ -17,7 +17,7 @@ import postgresql.largeobject.*; import postgresql.util.*; /** - * $Id: Connection.java,v 1.1 1999/01/17 04:51:53 momjian Exp $ + * $Id: Connection.java,v 1.2 1999/05/18 23:17:21 peter Exp $ * * A Connection represents a session with a specific database. Within the * context of a Connection, SQL statements are executed and results are @@ -96,7 +96,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec */ public java.sql.CallableStatement prepareCall(String sql) throws SQLException { - throw new SQLException("Callable Statements are not supported at this time"); + throw new PSQLException("postgresql.con.call"); // return new CallableStatement(this, sql); } @@ -311,7 +311,7 @@ public class Connection extends postgresql.Connection implements java.sql.Connec */ public void setTransactionIsolation(int level) throws SQLException { - throw new SQLException("Transaction Isolation Levels are not implemented"); + throw postgresql.Driver.notImplemented(); } /** diff --git a/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java b/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java index f56ca20cc1..69bb426624 100644 --- a/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java +++ b/src/interfaces/jdbc/postgresql/jdbc1/PreparedStatement.java @@ -93,7 +93,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta for (i = 0 ; i < inStrings.length ; ++i) { if (inStrings[i] == null) - throw new SQLException("No value specified for parameter " + (i + 1)); + throw new PSQLException("postgresql.prep.param",new Integer(i + 1)); s.append (templateStrings[i]); s.append (inStrings[i]); } @@ -118,7 +118,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta for (i = 0 ; i < inStrings.length ; ++i) { if (inStrings[i] == null) - throw new SQLException("No value specified for parameter " + (i + 1)); + throw new PSQLException("postgresql.prep.param",new Integer(i + 1)); s.append (templateStrings[i]); s.append (inStrings[i]); } @@ -411,7 +411,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta */ public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { - throw new SQLException("InputStream as parameter not supported"); + throw postgresql.Driver.notImplemented(); } /** @@ -486,7 +486,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta setString(parameterIndex, ((PGobject)x).getValue()); break; default: - throw new SQLException("Unknown Types value"); + throw new PSQLException("postgresql.prep.type"); } } @@ -550,7 +550,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta for (i = 0 ; i < inStrings.length ; ++i) { if (inStrings[i] == null) - throw new SQLException("No value specified for parameter " + (i + 1)); + throw new PSQLException("postgresql.prep.param",new Integer(i + 1)); s.append (templateStrings[i]); s.append (inStrings[i]); } @@ -594,7 +594,7 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta private void set(int paramIndex, String s) throws SQLException { if (paramIndex < 1 || paramIndex > inStrings.length) - throw new SQLException("Parameter index out of range"); + throw new PSQLException("postgresql.prep.range"); inStrings[paramIndex - 1] = s; } } diff --git a/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java b/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java index 05dd010c8f..fca14e64d9 100644 --- a/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java +++ b/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java @@ -143,7 +143,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe //return null; //return new String(bytes); if (columnIndex < 1 || columnIndex > fields.length) - throw new SQLException("Column Index out of range"); + throw new PSQLException("postgresql.res.colrange"); wasNullFlag = (this_row[columnIndex - 1] == null); if(wasNullFlag) return null; @@ -186,7 +186,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe { return Byte.parseByte(s); } catch (NumberFormatException e) { - throw new SQLException("Bad Byte Form: " + s); + throw new PSQLException("postgresql.res.badbyte",s); } } return 0; // SQL NULL @@ -209,7 +209,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe { return Short.parseShort(s); } catch (NumberFormatException e) { - throw new SQLException("Bad Short Form: " + s); + throw new PSQLException("postgresql.res.badshort",s); } } return 0; // SQL NULL @@ -232,7 +232,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe { return Integer.parseInt(s); } catch (NumberFormatException e) { - throw new SQLException ("Bad Integer Form: " + s); + throw new PSQLException ("postgresql.badint",s); } } return 0; // SQL NULL @@ -255,7 +255,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe { return Long.parseLong(s); } catch (NumberFormatException e) { - throw new SQLException ("Bad Long Form: " + s); + throw new PSQLException ("postgresql.res.badlong",s); } } return 0; // SQL NULL @@ -278,7 +278,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe { return Float.valueOf(s).floatValue(); } catch (NumberFormatException e) { - throw new SQLException ("Bad Float Form: " + s); + throw new PSQLException ("postgresql.res.badfloat",s); } } return 0; // SQL NULL @@ -301,7 +301,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe { return Double.valueOf(s).doubleValue(); } catch (NumberFormatException e) { - throw new SQLException ("Bad Double Form: " + s); + throw new PSQLException ("postgresql.res.baddouble",s); } } return 0; // SQL NULL @@ -327,13 +327,13 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe { val = new BigDecimal(s); } catch (NumberFormatException e) { - throw new SQLException ("Bad BigDecimal Form: " + s); + throw new PSQLException ("postgresql.res.badbigdec",s); } try { return val.setScale(scale); } catch (ArithmeticException e) { - throw new SQLException ("Bad BigDecimal Form: " + s); + throw new PSQLException ("postgresql.res.badbigdec",s); } } return null; // SQL NULL @@ -357,7 +357,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe public byte[] getBytes(int columnIndex) throws SQLException { if (columnIndex < 1 || columnIndex > fields.length) - throw new SQLException("Column Index out of range"); + throw new PSQLException("postgresql.res.colrange"); wasNullFlag = (this_row[columnIndex - 1] == null); // Handle OID's as BLOBS @@ -390,7 +390,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe try { return new java.sql.Date(df.parse(s).getTime()); } catch (ParseException e) { - throw new SQLException("Bad Date Format: at " + e.getErrorOffset() + " in " + s); + throw new PSQLException("postgresql.res.baddate",new Integer(e.getErrorOffset()),s); } } @@ -417,7 +417,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe int sec = (s.length() == 5) ? 0 : Integer.parseInt(s.substring(6)); return new Time(hr, min, sec); } catch (NumberFormatException e) { - throw new SQLException ("Bad Time Form: " + s); + throw new PSQLException ("postgresql.res.badtime",s); } } return null; // SQL NULL @@ -448,7 +448,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe java.util.Date d = df.parse(s); return new Timestamp(d.getTime()); } catch (ParseException e) { - throw new SQLException("Bad Timestamp Format: at " + e.getErrorOffset() + " in " + s); + throw new PSQLException("postgresql.res.badtimestamp",new Integer(e.getErrorOffset()),s); } } return null; // SQL NULL @@ -697,7 +697,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe Field field; if (columnIndex < 1 || columnIndex > fields.length) - throw new SQLException("Column index out of range"); + throw new PSQLException("postgresql.res.colrange"); field = fields[columnIndex - 1]; // some fields can be null, mainly from those returned by MetaData methods @@ -770,7 +770,7 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe for (i = 0 ; i < fields.length; ++i) if (fields[i].name.equalsIgnoreCase(columnName)) return (i+1); - throw new SQLException ("Column name not found"); + throw new PSQLException ("postgresql.res.colname",columnName); } } diff --git a/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java b/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java index 25878dd8c8..0502dcdc56 100644 --- a/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java +++ b/src/interfaces/jdbc/postgresql/jdbc1/ResultSetMetaData.java @@ -8,6 +8,7 @@ package postgresql.jdbc1; import java.lang.*; import java.util.*; import postgresql.*; +import postgresql.util.*; // We explicitly import classes here as the original line: //import java.sql.*; @@ -424,7 +425,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData private Field getField(int columnIndex) throws SQLException { if (columnIndex < 1 || columnIndex > fields.length) - throw new SQLException("Column index out of range"); + throw new PSQLException("postgresql.res.colrange"); return fields[columnIndex - 1]; } } diff --git a/src/interfaces/jdbc/postgresql/jdbc1/Statement.java b/src/interfaces/jdbc/postgresql/jdbc1/Statement.java index 4bc026331b..0f458acec7 100644 --- a/src/interfaces/jdbc/postgresql/jdbc1/Statement.java +++ b/src/interfaces/jdbc/postgresql/jdbc1/Statement.java @@ -7,6 +7,8 @@ package postgresql.jdbc1; import java.sql.*; +import postgresql.util.PSQLException; + /** * A Statement object is used for executing a static SQL statement and * obtaining the results produced by it. @@ -52,7 +54,7 @@ public class Statement implements java.sql.Statement while (result != null && !((postgresql.ResultSet)result).reallyResultSet()) result = ((postgresql.ResultSet)result).getNext(); if (result == null) - throw new SQLException("no results returned"); + throw new PSQLException("postgresql.stat.noresult"); return result; } @@ -69,7 +71,7 @@ public class Statement implements java.sql.Statement { this.execute(sql); if (((postgresql.ResultSet)result).reallyResultSet()) - throw new SQLException("results returned"); + throw new PSQLException("postgresql.stat.result"); return this.getUpdateCount(); } @@ -114,7 +116,7 @@ public class Statement implements java.sql.Statement */ public void setMaxFieldSize(int max) throws SQLException { - throw new SQLException("Attempt to setMaxFieldSize failed - compile time default"); + throw new PSQLException("postgresql.stat.maxfieldsize"); } /** |
