V4MD Noob: VOID instead of Vset with zero records?

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Apr 22 04:29:12 CDT 2008


On 4/22/08 12:10 PM, "Marc Schmitt" <Marc_Schmitt at gmx.de> wrote:

Hi Marc,

> Hi to you and thank you for your concentration  ;)
> 
> I'll try to explain myself, without getting things mixed up.
> 
> My first approach, (that I want an empty Vset as optional returned output)
> would be mostly for comfort.
> 
> Actually, I do what your pseudo-code implies:
> Perform a search in a field -> check if the result is void -> if its void then
> I substitute it with an empty handmade Vset.
> 
> That works, but is not nice to read and hard to debug.
> 
> My desired comfortably pseudocode would read like:
>    result_1 = fieldA.findContains(aString,aSelection)
>    result_2 = fieldB.findContains(anotherString,result_1)
> 
> -> drawback 1: when there are no records, the returned void is interpreted in
> the second search as 'all records' instead of 'no-records'
> -> drawback 2: 'result_2' looses its object-type with all its consequences

And now right here STOP STOP STOP :-)

Let's clarify on point !!!

    ** You prefer to use API way to SQL why ?
        - to get FASTER speed ?

In fact this is the main reason to use API way to SQL way.

But! If you going to get FASTER code, be ready to write NOT LAZY code.
    If you want write more LAZY code, please go by SQL way,
    or even by way of V4MD described in V4MD_Reference.pdf section
    Getting Started about query() handler which returns LIST of found
    records. VERY compact way for script-writers.


If your goal is SPEED as much as possible, and you choose API Way for this,
Then I can say -- code as above is not best. Let me explain:

So you do:

>    result_1 = fieldA.findContains(aString,aSelection)
>    result_2 = fieldB.findContains(anotherString,result_1)

This means in fact  fieldA = XXX AND fieldB = YYYY
        
If (fieldA = XXX) returns EMPTY result, then no sense do second search.

So the best code is:

    result_1 = fieldA.findContains(aString,aSelection)

    if( result_1 NOT VOID )
        result_2 = fieldB.findContains(anotherString,result_1)
    else    
        result_2 = VOID     <<< ZERO TIME and RAM.



> -> drawback 3: I don't know if the VOID is the result of an error, or the
> result of a zero-records-set

Wrong actually. If there was ERROR, you can get info about this from

    Valentina.errNumber

-- 
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