| From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
|---|---|
| To: | Fernando Nasser <fnasser(at)redhat(dot)com> |
| Cc: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | Re: patch: tiny patch to correct stringbuffer size estimate |
| Date: | 2003-07-22 14:50:40 |
| Message-ID: | 20030722145040.GL11354@opencloud.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
On Tue, Jul 22, 2003 at 10:36:01AM -0400, Fernando Nasser wrote:
> This is already accounted for in the 10% that is added to it, isn't it?
Only if you have a string > 20 characters, due to truncation on integer
division, no?
-O
> Oliver Jowett wrote:
> >This patch tweaks the size estimate when escaping strings to count the
> >enclosing quotes.
> >*** 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('\'');
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Darin Ohashi | 2003-07-22 14:51:38 | Re: the IN clause saga |
| Previous Message | Fernando Nasser | 2003-07-22 14:41:22 | Re: the IN clause saga |