Re: Querys to 'Navigate' through records
Posted in 1998
Scott Ahten wrote: > The JDBC drivers I am using don't have scrolling cursors :( Scrolling cursors are not in the JDBC spec (or for that matter, in the ODBC spec either). It depends on whether the application you are using has the necessary cursor libraries to support scrolling cursors. The *application* has to support scrolling cursors rather than the driver underneath. If the application does, the driver should. > to get the 'next', 'prev'...etc record, I have had to resort to some > creative SQL statements...but they seem to execute slowly..too slowly. > Here is an example method from the orders object > > // public method to get the previous record of this type > public void prev() > { > ...//other search methods removed > else > { > nav_id = navQuery("select id from "+tableName+" where id < "+db_id+" > order by id DESC"); > } > if (nav_id !=0) > load(nav_id); // > } > > the id column is indexed but I think the 'order by id DESC' part of the > statement takes the most time. > > is there a better way to do this type of search? Allan Gould (allang at sco dot com) (Please remove anti-spam measures if replying)