Re: patch: tiny patch to correct stringbuffer size estimate

From: Fernando Nasser <fnasser(at)redhat(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: patch: tiny patch to correct stringbuffer size estimate
Date: 2003-07-22 14:36:01
Message-ID: 3F1D4BD1.2060600@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

This is already accounted for in the 10% that is added to it, isn't it?

Oliver Jowett wrote:
> This patch tweaks the size estimate when escaping strings to count the
> enclosing quotes.
>
> -O
>
>
> ------------------------------------------------------------------------
>
> Index: AbstractJdbc1Statement.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v
> retrieving revision 1.28
> diff -u -c -r1.28 AbstractJdbc1Statement.java
> *** AbstractJdbc1Statement.java 22 Jul 2003 05:17:09 -0000 1.28
> --- AbstractJdbc1Statement.java 22 Jul 2003 13:53:03 -0000
> ***************
> *** 1034,1040 ****
> synchronized (sbuf)
> {
> sbuf.setLength(0);
> ! sbuf.ensureCapacity(x.length() + (int)(x.length() / 10));
> sbuf.append('\'');
> escapeString(x, sbuf);
> sbuf.append('\'');
> --- 1034,1040 ----
> synchronized (sbuf)
> {
> sbuf.setLength(0);
> ! sbuf.ensureCapacity(2 + x.length() + (int)(x.length() / 10));
> sbuf.append('\'');
> escapeString(x, sbuf);
> sbuf.append('\'');
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Fernando Nasser 2003-07-22 14:40:01 Re: the IN clause saga
Previous Message Dmitry Tkach 2003-07-22 14:35:58 Re: Detecting 'socket errors' - closing the Connection object