Cursor.FindSingleValue

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Tue Dec 29 10:06:35 CST 2009


On 12/29/09 10:43 AM, "Thomas Flemming" <tf at ttqv.com> wrote:

> Hi,
> 
>> in. It looks like you do something like "select * from table" and than
>> you are trying to apply another search criteria to the query result.
> Yes, somehow....
> 
> ok, I will give a description of the problem.
> Its actually a problem of displaying the data.
> 
> I'm using a grid to display the data, which has a virtual-display mode.
> This means, the records are not loaded all at once in the grid, but only when
> needed.
> 
> First I create the cursor with "select * from table order by field1"
> Second only the records, which are currently visible, are loaded into the
> grid. The row-number of the grid is the cursor-position.
> So if the grid needs to display lets say rows 10000-10020 then it goes easy
> with cursor.position=10000 etc.
> 
> This is very fast.
> 
> The problem comes now, when I need the grid to scroll down to show a specific
> record.
> For example, in another form I did a query:
> "select * from table where name="flemming"
> This gives me one record.
> 
> Now I want the grid to show this record, but I can only do this in scrolling
> to this spcific grid-row, which is the cursor.position of the first query.
> 
> The only solution I found until now is iterating throug the cursor, until I
> found this record. Then I have the cursor.position and can jump in the grid to
> that row.
> But this is of course slow for a large amount of data (1 mio records).

Hi Thomas,

You know, during last years quite many developers did similar task.

Actually some of them did e.g. FILTER, i.e. User type ONE MORE char into
search field, and we need reduce records in the grid.
Solution is - just to execute NEW QUERY.
Valentina is so fast that is able in live mode do searches while user types.
At least locally.

Yes, I see, that your task is NOT filter...
It is something different...

And you have cursor ordered by field 1.
So binary search can be used on this field1.
Binary search is FAST. Even for million record this is only 20 steps.




-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list