🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.database
Article #366

Re: speeding up HSQL database

#366
From: Oliver
Date: Thu, 16 Nov 2006 12:38
26 lines
1948 bytes
Hi

hey, thanks! 

Now i use a LIMIT x 1 command in order to get only one row, and later the first() method of the ResultSet. That made things really somewhat faster. 

But the main mistake i made in the prepareRenderer method which i didnt show.

Oliver

public Object getValueAt(int rowIndex, int columnIndex) {
        Statement stat = null;
        try {  stat = MyDBConn.createStatement(); }
        catch (SQLException e) {  return null;  }
        String Order = getOrder(SetAscending);
        String sqlCmd = "SELECT LIMIT "+rowIndex +" 1 "+ "* FROM Res"+Order;
        if (SetFiltered) sqlCmd = "SELECT LIMIT "+rowIndex +" 1 "+"* FROM Res WHERE "+sqlCmdFiltered+Order;
        ResultSet rs = null;
        try {  rs = stat.executeQuery(sqlCmd);}
        catch (SQLException e) { return null; }
        try {     rs.first();
                  if (columnIndex==0) return SpecialFormat(rs.getObject(1));
                  return NumberFormat(rs.getObject(columnIndex + 1));
        } catch (SQLException e) { return null; }
   }
Technical Details
Message-ID: <455c69bc$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <455890fe$1@newsgroups.borland.com> <4558ca40$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1073da,70ab5adc74a60808
X-Google-Attributes: gid1073da,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Oliver" <o.maas@nospam_metrohm.de>
Sender: "Oliver" <o.maas@nospam_metrohm.de>
Reply-To: "Oliver" <o.maas@nospam_metrohm.de>
Subject: Re: speeding up HSQL database
Newsgroups: borland.public.jbuilder.database
X-User-Info: 81.90.37.2     
References: <455890fe$1@newsgroups.borland.com> <4558ca40$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <455c69bc$1@newsgroups.borland.com>
Date: 16 Nov 2006 05:38:04 -0700
X-Trace: newsgroups.borland.com 1163684284 207.105.83.66 (16 Nov 2006 05:38:04 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail