Automatic Data Entry

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Oct 29 16:44:32 CDT 2004


On 10/29/04 4:23 PM, "Kim Kohen" <kim at torchpublishing.com.au> wrote:

Hi Kim,

>> But RecID field
>> 1) exists always. You need do ZERO steps to get it.
> €€€€
> I still don't see an easy way to get it via an SQL select but I'm sure if
> there is you'll demonstrate:)

    SELECT RecID, ...

    SELECT T1.Recid, T2.Recid
    FROM T1, T2
    WHERE T1.Recid = T2.Ptr

Btw, Valentina allow you to be lazy and do NOT specify link conditions for
join!

    SELECT T1.Recid, T2.Recid
    FROM T1, T2


>> 2) it provide referential integrity automatically
> €€€€
> This is good
>  
>> 3) it is 4 times faster on joins that ID of ULONG type.
> €€€€
> This is good too
>  
>> So tell me. WHAT REASONS to use own ID field ???
> €€€€
> Easily accessible through SQL select and customisable

Ok, more detailed example:

    dim r1 as integer

    curs = db.SqlSelect( "SEELCT Recid, f1, f2 FROM T" )
        
    r1 = curs.ULongField("Recid").value     // read found value

    q2 = "INSERT INTO T2 (f1, ptr) VALUES (5," + str(r1) + ")"
    db.SqlExecute( q2 )

This will create record in T2 which is linked to r1 of T1 table.


>> Only because all other DBMS do this ?
> €€€€
> Not necessarily but it would seem to make the code more portable if the
> developer needed to move to another DBMS that relied on user defined primary
> keys

This is why in 2.0, yes, we have implement standard things also.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------




More information about the Valentina mailing list