🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

speeding up HSQL database

#363
From: Oliver
Date: Mon, 13 Nov 2006 14:36
32 lines
1948 bytes
Hi

i have in one special project a HSQL database which in principle 
works fine, but my user complained that it gets slow once it has 
only 100 or more entries. Heres the getValueAt method which might
have a performance problem.

@SuppressWarnings
({"ReturnOfNull", "LoopStatementThatDoesntLoop"})
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 * FROM Res"+Order;  
        if (SetFiltered) sqlCmd = "SELECT * FROM Res WHERE "+sqlCmdFiltered+Order;
        ResultSet rs = null;
        try {  rs = stat.executeQuery(sqlCmd);}
        catch (SQLException e) { return null; }
        try {  while (rs.next())
               {  rs.absolute(rowIndex + 1);
                  if (columnIndex==0) return SpecialFormat(rs.getObject(1));
                  return NumberFormat(rs.getObject(columnIndex + 1));
               }
        } catch (SQLException e) { return null; }
        return "";
}

regards

Oliver
Technical Details
Message-ID: <455890fe$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1073da,70ab5adc74a60808,start
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: speeding up HSQL database
Newsgroups: borland.public.jbuilder.database
X-User-Info: 81.90.37.2     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <455890fe$1@newsgroups.borland.com>
Date: 13 Nov 2006 07:36:30 -0700
X-Trace: newsgroups.borland.com 1163432190 207.105.83.66 (13 Nov 2006 07:36:30 -0700)
Lines: 32
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail