Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit509a9cd

Browse files
author
Barry Lind
committed
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
1 parentf8c365c commit509a9cd

19 files changed

+92
-72
lines changed

‎src/interfaces/jdbc/org/postgresql/Driver.java.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.35 2003/09/08 17:30:22 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.36 2003/09/13 04:02:12 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -142,7 +142,7 @@ public class Driver implements java.sql.Driver
142142
{
143143
if (Driver.logDebug)
144144
Driver.debug("error", ex);
145-
throw new PSQLException("postgresql.jvm.version", ex);
145+
throw new PSQLException("postgresql.jvm.version",PSQLState.SYSTEM_ERROR,ex);
146146
}
147147
catch (PSQLException ex1)
148148
{
@@ -155,7 +155,7 @@ public class Driver implements java.sql.Driver
155155
if (Driver.logDebug) {
156156
Driver.debug("error", ex2);
157157
}
158-
throw new PSQLException("postgresql.unusual", ex2);
158+
throw new PSQLException("postgresql.unusual",PSQLState.UNEXPECTED_ERROR,ex2);
159159
}
160160
}
161161

@@ -504,6 +504,6 @@ public class Driver implements java.sql.Driver
504504

505505

506506
//The build number should be incremented for every new build
507-
private static int m_buildNumber =208;
507+
private static int m_buildNumber =209;
508508

509509
}

‎src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.25 2003/09/09 10:49:16 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.26 2003/09/13 04:02:13 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -311,7 +311,7 @@ private void sendQueryV3() throws SQLException
311311
for (inti =0;i <m_binds.length ;i++ )
312312
{
313313
if (m_binds[i] ==null )
314-
thrownewPSQLException("postgresql.prep.param",PSQLState.PARAMETER_ERROR,newInteger(i +1));
314+
thrownewPSQLException("postgresql.prep.param",PSQLState.INVALID_PARAMETER_VALUE,newInteger(i +1));
315315
}
316316
try
317317
{
@@ -352,7 +352,7 @@ private void sendQueryV2() throws SQLException
352352
for (inti =0;i <m_binds.length ;i++ )
353353
{
354354
if (m_binds[i] ==null )
355-
thrownewPSQLException("postgresql.prep.param",PSQLState.PARAMETER_ERROR,newInteger(i +1));
355+
thrownewPSQLException("postgresql.prep.param",PSQLState.INVALID_PARAMETER_VALUE,newInteger(i +1));
356356
}
357357
try
358358
{

‎src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/fastpath/Attic/Fastpath.java,v 1.15 2003/09/08 17:30:22 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/fastpath/Attic/Fastpath.java,v 1.16 2003/09/13 04:02:13 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -178,7 +178,7 @@ else if (l_valueLen == 0)
178178
break;
179179

180180
default:
181-
thrownewPSQLException("postgresql.fp.protocol",newCharacter((char)c));
181+
thrownewPSQLException("postgresql.fp.protocol",PSQLState.COMMUNICATION_ERROR,newCharacter((char)c));
182182
}
183183
}
184184

@@ -279,12 +279,12 @@ private Object fastpathV2(int fnid, boolean resulttype, FastpathArg[] args) thro
279279
break;
280280

281281
default:
282-
thrownewPSQLException("postgresql.fp.protocol",newCharacter((char)c));
282+
thrownewPSQLException("postgresql.fp.protocol",PSQLState.COMMUNICATION_ERROR,newCharacter((char)c));
283283
}
284284
}
285285

286286
if (errorMessage !=null )
287-
thrownewPSQLException("postgresql.fp.error",errorMessage.toString());
287+
thrownewPSQLException("postgresql.fp.error",PSQLState.COMMUNICATION_ERROR,errorMessage.toString());
288288

289289
returnresult;
290290
}
@@ -422,7 +422,7 @@ public int getID(String name) throws SQLException
422422
// so, until we know we can do this (needs testing, on the TODO list)
423423
// for now, we throw the exception and do no lookups.
424424
if (id ==null)
425-
thrownewPSQLException("postgresql.fp.unknown",name);
425+
thrownewPSQLException("postgresql.fp.unknown",PSQLState.UNEXPECTED_ERROR,name);
426426

427427
returnid.intValue();
428428
}

‎src/interfaces/jdbc/org/postgresql/geometric/PGbox.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGbox.java,v 1.4 2003/03/07 18:39:42 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGbox.java,v 1.5 2003/09/13 04:02:14 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313
packageorg.postgresql.geometric;
1414

15-
importjava.sql.SQLException;
16-
importjava.io.Serializable;
1715
importorg.postgresql.util.PGobject;
1816
importorg.postgresql.util.PGtokenizer;
1917
importorg.postgresql.util.PSQLException;
18+
importorg.postgresql.util.PSQLState;
19+
20+
importjava.io.Serializable;
21+
importjava.sql.SQLException;
2022

2123
publicclassPGboxextendsPGobjectimplementsSerializable,Cloneable
2224
{
@@ -78,7 +80,7 @@ public void setValue(String value) throws SQLException
7880
{
7981
PGtokenizert =newPGtokenizer(value,',');
8082
if (t.getSize() !=2)
81-
thrownewPSQLException("postgresql.geo.box",value);
83+
thrownewPSQLException("postgresql.geo.box",PSQLState.DATA_TYPE_MISMATCH,value);
8284

8385
point[0] =newPGpoint(t.getToken(0));
8486
point[1] =newPGpoint(t.getToken(1));

‎src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 2003, PostgreSQL Global Development Group
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGcircle.java,v 1.5 2003/05/29 04:39:48 barry Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGcircle.java,v 1.6 2003/09/13 04:02:14 barry Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -16,6 +16,8 @@
1616
importorg.postgresql.util.PGobject;
1717
importorg.postgresql.util.PGtokenizer;
1818
importorg.postgresql.util.PSQLException;
19+
importorg.postgresql.util.PSQLState;
20+
1921
importjava.io.Serializable;
2022
importjava.sql.SQLException;
2123

@@ -78,7 +80,7 @@ public void setValue(String s) throws SQLException
7880
{
7981
PGtokenizert =newPGtokenizer(PGtokenizer.removeAngle(s),',');
8082
if (t.getSize() !=2)
81-
thrownewPSQLException("postgresql.geo.circle",s);
83+
thrownewPSQLException("postgresql.geo.circle",PSQLState.DATA_TYPE_MISMATCH,s);
8284

8385
try
8486
{
@@ -87,7 +89,7 @@ public void setValue(String s) throws SQLException
8789
}
8890
catch (NumberFormatExceptione)
8991
{
90-
thrownewPSQLException("postgresql.geo.circle",e);
92+
thrownewPSQLException("postgresql.geo.circle",PSQLState.DATA_TYPE_MISMATCH,e);
9193
}
9294
}
9395

‎src/interfaces/jdbc/org/postgresql/geometric/PGline.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGline.java,v 1.4 2003/03/07 18:39:42 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGline.java,v 1.5 2003/09/13 04:02:15 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313
packageorg.postgresql.geometric;
1414

15-
importjava.io.Serializable;
16-
importjava.sql.SQLException;
1715
importorg.postgresql.util.PGobject;
1816
importorg.postgresql.util.PGtokenizer;
1917
importorg.postgresql.util.PSQLException;
18+
importorg.postgresql.util.PSQLState;
19+
20+
importjava.io.Serializable;
21+
importjava.sql.SQLException;
2022

2123
/*
2224
* Currently line is not yet implemented in the backend, but this class
@@ -77,7 +79,7 @@ public void setValue(String s) throws SQLException
7779
{
7880
PGtokenizert =newPGtokenizer(PGtokenizer.removeBox(s),',');
7981
if (t.getSize() !=2)
80-
thrownewPSQLException("postgresql.geo.line",s);
82+
thrownewPSQLException("postgresql.geo.line",PSQLState.DATA_TYPE_MISMATCH,s);
8183

8284
point[0] =newPGpoint(t.getToken(0));
8385
point[1] =newPGpoint(t.getToken(1));

‎src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGlseg.java,v 1.4 2003/03/07 18:39:42 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGlseg.java,v 1.5 2003/09/13 04:02:15 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313
packageorg.postgresql.geometric;
1414

15-
importjava.io.Serializable;
16-
importjava.sql.SQLException;
1715
importorg.postgresql.util.PGobject;
1816
importorg.postgresql.util.PGtokenizer;
1917
importorg.postgresql.util.PSQLException;
18+
importorg.postgresql.util.PSQLState;
19+
20+
importjava.io.Serializable;
21+
importjava.sql.SQLException;
2022

2123
publicclassPGlsegextendsPGobjectimplementsSerializable,Cloneable
2224
{
@@ -73,7 +75,7 @@ public void setValue(String s) throws SQLException
7375
{
7476
PGtokenizert =newPGtokenizer(PGtokenizer.removeBox(s),',');
7577
if (t.getSize() !=2)
76-
thrownewPSQLException("postgresql.geo.lseg");
78+
thrownewPSQLException("postgresql.geo.lseg",PSQLState.DATA_TYPE_MISMATCH);
7779

7880
point[0] =newPGpoint(t.getToken(0));
7981
point[1] =newPGpoint(t.getToken(1));

‎src/interfaces/jdbc/org/postgresql/geometric/PGpath.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpath.java,v 1.5 2003/03/07 18:39:42 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpath.java,v 1.6 2003/09/13 04:02:15 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313
packageorg.postgresql.geometric;
1414

15-
importjava.io.Serializable;
16-
importjava.sql.SQLException;
1715
importorg.postgresql.util.PGobject;
1816
importorg.postgresql.util.PGtokenizer;
1917
importorg.postgresql.util.PSQLException;
18+
importorg.postgresql.util.PSQLState;
19+
20+
importjava.io.Serializable;
21+
importjava.sql.SQLException;
2022

2123
publicclassPGpathextendsPGobjectimplementsSerializable,Cloneable
2224
{
@@ -77,7 +79,7 @@ else if (s.startsWith("(") && s.endsWith(")"))
7779
s =PGtokenizer.removePara(s);
7880
}
7981
else
80-
thrownewPSQLException("postgresql.geo.path");
82+
thrownewPSQLException("postgresql.geo.path",PSQLState.DATA_TYPE_MISMATCH);
8183

8284
PGtokenizert =newPGtokenizer(s,',');
8385
intnpoints =t.getSize();

‎src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpoint.java,v 1.5 2003/05/29 04:39:48 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpoint.java,v 1.6 2003/09/13 04:02:15 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -15,6 +15,8 @@
1515
importorg.postgresql.util.PGobject;
1616
importorg.postgresql.util.PGtokenizer;
1717
importorg.postgresql.util.PSQLException;
18+
importorg.postgresql.util.PSQLState;
19+
1820
importjava.awt.Point;
1921
importjava.io.Serializable;
2022
importjava.sql.SQLException;
@@ -80,7 +82,7 @@ public void setValue(String s) throws SQLException
8082
}
8183
catch (NumberFormatExceptione)
8284
{
83-
thrownewPSQLException("postgresql.geo.point",e.toString());
85+
thrownewPSQLException("postgresql.geo.point",PSQLState.DATA_TYPE_MISMATCH,e.toString());
8486
}
8587
}
8688

‎src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Copyright (c) 2003, PostgreSQL Global Development Group
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.25 2003/09/09 10:49:16 barry Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.26 2003/09/13 04:02:15 barry Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -373,7 +373,7 @@ private void openConnectionV3(String p_host, int p_port, Properties p_info, Stri
373373
caseAUTH_REQ_SCM:
374374
if (Driver.logDebug)
375375
Driver.debug("postgresql: SCM");
376-
thrownewPSQLException("postgresql.con.scm");
376+
thrownewPSQLException("postgresql.con.scm",PSQLState.CONNECTION_REJECTED);
377377

378378

379379
caseAUTH_REQ_PASSWORD:

‎src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Copyright (c) 2003, PostgreSQL Global Development Group
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.17 2003/09/09 10:49:16 barry Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.18 2003/09/13 04:02:15 barry Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -211,7 +211,7 @@ public byte getByte(int columnIndex) throws SQLException
211211
}
212212
catch (NumberFormatExceptione)
213213
{
214-
thrownewPSQLException("postgresql.res.badbyte",s);
214+
thrownewPSQLException("postgresql.res.badbyte",PSQLState.NUMERIC_VALUE_OUT_OF_RANGE,s);
215215
}
216216
}
217217
return0;// SQL NULL
@@ -565,7 +565,7 @@ public Object getObject(int columnIndex) throws SQLException
565565
Fieldfield;
566566

567567
if (columnIndex <1 ||columnIndex >fields.length)
568-
thrownewPSQLException("postgresql.res.colrange");
568+
thrownewPSQLException("postgresql.res.colrange",PSQLState.INVALID_PARAMETER_VALUE);
569569
field =fields[columnIndex -1];
570570

571571
// some fields can be null, mainly from those returned by MetaData methods
@@ -788,7 +788,7 @@ protected void checkResultSet( int column ) throws SQLException
788788
if (this_row ==null )
789789
thrownewPSQLException("postgresql.res.nextrequired");
790790
if (column <1 ||column >fields.length )
791-
thrownewPSQLException("postgresql.res.colrange" );
791+
thrownewPSQLException("postgresql.res.colrange",PSQLState.INVALID_PARAMETER_VALUE );
792792
}
793793

794794
//----------------- Formatting Methods -------------------

‎src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
importorg.postgresql.core.Field;
55
importorg.postgresql.util.PSQLException;
6+
importorg.postgresql.util.PSQLState;
67
importjava.sql.SQLException;
78
importjava.sql.Types;
89
importjava.util.Vector;
@@ -454,7 +455,7 @@ public boolean isDefinitelyWritable(int column) throws SQLException
454455
privateFieldgetField(intcolumnIndex)throwsSQLException
455456
{
456457
if (columnIndex <1 ||columnIndex >fields.length)
457-
thrownewPSQLException("postgresql.res.colrange");
458+
thrownewPSQLException("postgresql.res.colrange",PSQLState.INVALID_PARAMETER_VALUE);
458459
returnfields[columnIndex -1];
459460
}
460461
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp