Re: Total rows selected
Posted in 1994
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL
Jason Foster-Bey (jasonfb@panix.com) wrote: : Does anyone out there with experience using either JAM, ESQL/C or similar : product know how to retrieve the total rows selected count? Currently, we : are resubmitting a query with the SELECT clause changed to SELECT count(*)... : While that works, it is a drag on total performance. : JAM has a variable dbrowcount (or something like that), but it only returns : the number of rows FETCHED into a form (usually one, unless the form has : arrays -- multiple ocurrences of fields). original jpl code is quite lenghty and over-commented, so there is a basic idea: Do your SELECT. Check @dbrowcount against respective max_occur. If @dbrowcount is less than max_occur, you have the number needed in @dbrowcount. If they are equal, store @dbrowcount in accumulator, then do sequential CONTINUE UP's until @dbrowcount will be less than max_occur, and accumulate each value of @dbrowcount. The accumulated value gives the result. Don't forget to turn off aliases, unless you want your user to watch all the scrolling on the screen. :) :) Use CONTINUE TOP to clean up the search. Turn on aliases, and show the results of query with the count to user, as there was nothing ;) Not an elegant way, but when fighting with JAM, all means are good... Alex Stebletsov Moscow Russia -- Opinions above is mine, not of my employer... Sorry for that.