Getting RecID of record just added

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Dec 5 09:34:46 CST 2003


on 12/5/03 4:51 AM, Ken Ray at kray at sonsothunder.com wrote:

> Ruslan,
> 
> The fact that you can't get the exact ID of a record that was just added
> without writing a very convoluted query is really starting to wear thin
> on me. :-)
> 
> Here's a suggestion that would make it easy to handle, and hopefully
> would only mean minor modifications to existing code out there: return
> errors as negative numbers, and "no error" as either 0 or a positive
> number in the case of adding records. This would mean that we could do
> something simple like:
> 
> put Valentina("Cursor_AddRecord",tCurs) into tResult
> if tResult < 0 then
>    -- handle error
> else
>    put tResult into tNewRecID
> end if
> 
> or with other calls:
> 
> get Valentina("Cursor_SetField",tCurs,"Name","Ken")
> if it < 0 then
>    -- handle error
> end if
> 
> 
> Any chance something like this might make it into a build sometime in
> the *near* future? :-)

Ken, but this will break EXISTING code for other developers !!!

Right now errors 
    of OS are negative.
    of windows can be up to +100
    Valentina errors 100...1000     i.e. positive

Your suggestions will break all existed error checks.


---------
Next, your idea (if forget about above issue) will work for cursor that
built on SIGNLE table.

Image that you have cursor built on 3 tables.
You do AddRecord() and what table RecID you want to see in result?
Problems, yes?  :-)


This is why it works in the way as it is now.


You must SELECT T1.RecID, T2.RecID, T3.RecID FROM T1, T2, T3

Now you can 

    put Valentina("Cursor_AddRecord",tCurs) into tResult

    put Valentina("Cursor_GetField", curs, 1) into t1_recid
    put Valentina("Cursor_GetField", curs, 2) into t2_recid
    put Valentina("Cursor_GetField", curs, 3) into t3_recid

Where you see problems with this way?


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