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

Commit9af05a9

Browse files
author
Barry Lind
committed
Patches applied:
1) Patch from Kris Jurka to fix IPv6 parsing of the jdbc URL2) Patch from Kris Jurka to fix an ArrayIndexOutOfBounds error when calling moveToCurrentRow while currentRow is "beforeFirst"3) Patch from Kim Ho to fix add some bounds checking in setMaxRows(), setQueryTimeout(), setFetchSize() Modified Files: jdbc/org/postgresql/Driver.java.in jdbc/org/postgresql/errors.properties jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
1 parent835bb97 commit9af05a9

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

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

Lines changed: 16 additions & 1 deletion
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.30 2003/05/29 04:39:51 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.31 2003/06/30 16:38:30 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -272,6 +272,17 @@ public class Driver implements java.sql.Driver
272272
l_urlArgs = url.substring(l_qPos+1);
273273
}
274274

275+
// look for an IPv6 address that is enclosed by []
276+
// the upcoming parsing that uses colons as identifiers can't handle
277+
// the colons in an IPv6 address.
278+
int ipv6start = l_urlServer.indexOf("[");
279+
int ipv6end = l_urlServer.indexOf("]");
280+
String ipv6address = null;
281+
if (ipv6start != -1 && ipv6end > ipv6start) {
282+
ipv6address = l_urlServer.substring(ipv6start+1,ipv6end);
283+
l_urlServer = l_urlServer.substring(0,ipv6start)+"ipv6host"+l_urlServer.substring(ipv6end+1);
284+
}
285+
275286
//parse the server part of the url
276287
StringTokenizer st = new StringTokenizer(l_urlServer, ":/", true);
277288
for (int count = 0; (st.hasMoreTokens()); count++)
@@ -346,6 +357,10 @@ public class Driver implements java.sql.Driver
346357
}
347358
}
348359

360+
// if we extracted an IPv6 address out earlier put it back
361+
if (ipv6address != null)
362+
urlProps.put("PGHOST",ipv6address);
363+
349364
//parse the args part of the url
350365
StringTokenizer qst = new StringTokenizer(l_urlArgs, "&");
351366
for (int count = 0; (qst.hasMoreTokens()); count++)

‎src/interfaces/jdbc/org/postgresql/errors.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,6 @@ postgresql.call.funcover:Cannot execute Query a call to setXXX (1, ..) was made
9797
postgresql.call.wrongget:Parameter of type {0} was registered but call to get{1} (sqltype={2}) was made.
9898
postgresql.call.noreturnval:A CallableStatement Function was executed with nothing returned.
9999
postgresql.call.wrongrtntype:A CallableStatement Function was executed and the return was of type ({0}) however type={1} was registered.
100+
postgresql.input.fetch.gt0:Fetch size must be a value greater than or equal to 0.
101+
postgresql.input.query.gt0:Query Timeout must be a value greater than or equal to 0.
102+
postgresql.input.rows.gt0:Maximum number of rows must be a value greater than or equal to 0.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
importjava.sql.Types;
2626
importjava.util.Vector;
2727

28-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.24 2003/05/29 04:52:44 barry Exp $
28+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.25 2003/06/30 16:38:30 barry Exp $
2929
* This class defines methods of the jdbc1 specification. This class is
3030
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
3131
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
@@ -554,6 +554,7 @@ public int getMaxRows() throws SQLException
554554
*/
555555
publicvoidsetMaxRows(intmax)throwsSQLException
556556
{
557+
if (max<0)thrownewPSQLException("postgresql.input.rows.gt0");
557558
maxrows =max;
558559
}
559560

@@ -590,6 +591,7 @@ public int getQueryTimeout() throws SQLException
590591
*/
591592
publicvoidsetQueryTimeout(intseconds)throwsSQLException
592593
{
594+
if (seconds<0)thrownewPSQLException("postgresql.input.query.gt0");
593595
timeout =seconds;
594596
}
595597

‎src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java

Lines changed: 9 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/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.19 2003/05/03 20:40:45 barry Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.20 2003/06/30 16:38:30 barry Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -687,10 +687,15 @@ public synchronized void moveToCurrentRow()
687687
thrownewPSQLException("postgresql.updateable.notupdateable" );
688688
}
689689

690-
this_row = (byte[][])rows.elementAt(current_row);
690+
if (current_row <0) {
691+
this_row =null;
692+
rowBuffer =null;
693+
}else {
694+
this_row = (byte[][])rows.elementAt(current_row);
691695

692-
rowBuffer =newbyte[this_row.length][];
693-
System.arraycopy(this_row,0,rowBuffer,0,this_row.length);
696+
rowBuffer =newbyte[this_row.length][];
697+
System.arraycopy(this_row,0,rowBuffer,0,this_row.length);
698+
}
694699

695700
onInsertRow =false;
696701
doingUpdates =false;

‎src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
importorg.postgresql.largeobject.*;
1010
importorg.postgresql.util.PSQLException;
1111

12-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.14 2003/05/29 04:52:44 barry Exp $
12+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.15 2003/06/30 16:38:30 barry Exp $
1313
* This class defines methods of the jdbc2 specification. This class extends
1414
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
1515
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
@@ -151,6 +151,7 @@ public void setFetchDirection(int direction) throws SQLException
151151

152152
publicvoidsetFetchSize(introws)throwsSQLException
153153
{
154+
if (rows<0)thrownewPSQLException("postgresql.input.fetch.gt0");
154155
super.fetchSize =rows;
155156
}
156157

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp