Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI related

Re: OCI related

From: Ed Prochak <edprochak_at_interfacefamily.com>
Date: Sat, 11 Apr 1998 23:55:00 -0400
Message-ID: <35303B14.6193@interfacefamily.com>


Sid wrote:
>
> "L. Nehring" <nehring_at_usa.net> wrote:
>
> <snip>
> >Not knowing what you're trying to do, let me just say what I've found....
> >IMHO, the only real approach is not to code with that paradigm. If you're
> >wanting to know a row count so you can pre-allocate memory for your define
> >host variables, I don't think you'll find a method that can avoid a race
> >condition. As an alternative, I have typically shoved fetched data into a
> >linked list where the links are dynamically allocated one-at-a-time in the
> >fetch loop. Or you might use the OCI dynamic defines with callbacks that
> >dynamically allocate memory to hold the data.
> <snip>
>
> I have this problem as well. Here's a situation where dynamic
> allocation won't help:
>
> I'm displaying each row of a selected set in a row of a scrollable
> grid on-screen. Initially, I can fetch enough to fill up the grid
> (say 20 rows), and place the user at row 1 and the thumbtrack at the
> top of the vertical scroll bar. Say the user hits the down arrow to
> go to row 2. How much to I move the scrollbar? If the result set has
> 21 total rows, I want to move it 1/21 the height of the scrollbar, a
> visible move. If the result has 20,000 rows, I want to move it
> 1/20,000 of the height of the scrollbar, which won't even be visible
> to the user (i.e. the thumbtrack should stay where it is)..
>
> Is there any way to do this without knowing how many rows are in my
> result set (or doing a separate select count to get that number)?
>
> Thanks,
>
> Sid Gudes
> cougar_at_road_runner.com
> ANTI-SPAM: remove "_" after "road" when replying

Sorry, no.

BUT (there's always a but isn't there?) why not do something similar to the way ACCESS handles this (many rows) problem:

try to fetch 20 rows
receive 20 rows and display them,
set cursor at first line of display,
set "thumbtrack" to top of scrollbar (at 1 of 20 rows).

<user moves thumbtrack to bottom>

try to fetch 20 rows
receive 20 rows and display them
set cursor at first line of display,
set "thumbtrack" to middle of scrollbar (at 21 of 40 rows)

<user moves thumbtrack to bottom>

try to fetch 20 rows
receive 20 rows and display them
set cursor at first line of display,
set "thumbtrack" to 2/3 of scrollbar (at 41 of 60 rows)

continuing until the thumbtrack is about 1% above the bottom of the scrollbar at which point it always returns to that point (remember you said this was the case of 20000 rows).

 Is it a pretty solution? I don't think so, but it is usable. Note that ACCESS also has scroll buttons to go directly to the top or bottom of the entire result set. (Makes the scaling scroll easier to deal with).

What else can you do?

(PS Sid, are you in the Akron area? I'm in Twinsburg.  Drop me a reply if you are near me. Ed. ) Received on Sat Apr 11 1998 - 22:55:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US