Another DB question

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Oct 23 08:36:52 EDT 2008


On 10/23/08 2:58 PM, "Klaus Major" <klaus at major-k.de> wrote:

Hi Klaus,

> Is it possible to directly "search" in the data of a db cursor?

Usually no. 

Bad news this time, Valentina also do not provide this.


> Or will on have to use a repeat loop through all the data in a cursor
> to find the desired data? Know what I mean?

All depends on your task.

At last of end, if you have BIG set of data in cursor,
And you still need do complex search on it,
You can first time build not cursor, but TMP table. May be in RAM.

In Valentina this is as

    SELECT ... INTO tmpTable

 
> Background:
> When the user adds/inserts or updates a record, the current cursor is  not "up
> to date" anymore and one has to create a new one that reflects  these changes
> 
> And of course it is "good style" to display the SAME data to the user  after
> that action and not the first record of the new cursor.

Yes, right.

I have hear dozens times about this task from Valentina users.

Solution is:

* you need to have in cursor some unique number field.
    and SORT on that field if possible.

* then you can use binary search on records of new cursor.


-------------
Another tip.

For this task you will execute SEVERAL times the same SELECT search to db.

Valentina allow do it using binding.
    SELECT ... WHERE f1 = :1 and f2 > :2

As result of such technique, engine is able keep pool of precompiled
queries. This can speed execution of second, third, ... Queries.


-- 
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 use-livecode mailing list