|
8 | 8 | import org.postgresql.largeobject.*;
|
9 | 9 | import org.postgresql.util.*;
|
10 | 10 |
|
11 |
| -/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.3 2002/07/25 22:45:27 barry Exp $ |
| 11 | +/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.4 2002/08/16 17:51:38 barry Exp $ |
12 | 12 | * This class defines methods of the jdbc1 specification. This class is
|
13 | 13 | * extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
|
14 | 14 | * methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
|
@@ -40,7 +40,7 @@ public abstract class AbstractJdbc1Statement implements org.postgresql.PGStateme
|
40 | 40 | private static final short ESC_TIMEDATE = 3;
|
41 | 41 |
|
42 | 42 | // Some performance caches
|
43 |
| - private StringBuffer sbuf = new StringBuffer(); |
| 43 | + private StringBuffer sbuf = new StringBuffer(32); |
44 | 44 |
|
45 | 45 | //Used by the preparedstatement style methods
|
46 | 46 | protected String sql;
|
@@ -498,7 +498,7 @@ protected static String escapeSQL(String sql)
|
498 | 498 | {
|
499 | 499 | // Since escape codes can only appear in SQL CODE, we keep track
|
500 | 500 | // of if we enter a string or not.
|
501 |
| - StringBuffer newsql = new StringBuffer(); |
| 501 | + StringBuffer newsql = new StringBuffer(sql.length()); |
502 | 502 | short state = IN_SQLCODE;
|
503 | 503 |
|
504 | 504 | int i = -1;
|
@@ -736,6 +736,7 @@ public void setString(int parameterIndex, String x) throws SQLException
|
736 | 736 | synchronized (sbuf)
|
737 | 737 | {
|
738 | 738 | sbuf.setLength(0);
|
| 739 | + sbuf.ensureCapacity(x.length()); |
739 | 740 | int i;
|
740 | 741 |
|
741 | 742 | sbuf.append('\'');
|
@@ -852,6 +853,7 @@ public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
|
852 | 853 | synchronized (sbuf)
|
853 | 854 | {
|
854 | 855 | sbuf.setLength(0);
|
| 856 | + sbuf.ensureCapacity(32); |
855 | 857 | sbuf.append("'");
|
856 | 858 | //format the timestamp
|
857 | 859 | //we do our own formating so that we can get a format
|
|
0 commit comments