Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ece84bf

Browse files
author
Barry Lind
committed
Applied patch from Fernando Nasser to improve buffer sizes to avoid unnecessary resizing.
1 parent fb630cc commit ece84bf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import java.sql.Types;
2626
import java.util.Vector;
2727

28-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.22 2003/05/29 04:39:49 barry Exp $
28+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.23 2003/05/29 04:48:33 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
@@ -1032,7 +1032,7 @@ public void setString(int parameterIndex, String x, String type) throws SQLExcep
10321032
synchronized (sbuf)
10331033
{
10341034
sbuf.setLength(0);
1035-
sbuf.ensureCapacity(x.length());
1035+
sbuf.ensureCapacity(x.length() + (int)(x.length() / 10));
10361036
int i;
10371037

10381038
sbuf.append('\'');

src/interfaces/jdbc/org/postgresql/util/PGbytea.java

+2-2
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/util/Attic/PGbytea.java,v 1.7 2003/03/07 18:39:46 barry Exp $
9+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGbytea.java,v 1.8 2003/05/29 04:48:33 barry Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -68,7 +68,7 @@ public static String toPGString(byte[] p_buf) throws SQLException
6868
{
6969
if (p_buf == null)
7070
return null;
71-
StringBuffer l_strbuf = new StringBuffer(p_buf.length);
71+
StringBuffer l_strbuf = new StringBuffer(2 * p_buf.length);
7272
for (int i = 0; i < p_buf.length; i++)
7373
{
7474
int l_int = (int)p_buf[i];

0 commit comments

Comments
 (0)