[V4RB] Question about adding records in cursors
Charles Yeomans
yeomans at desuetude.com
Mon Jan 27 15:13:55 CST 2003
On Monday, January 27, 2003, at 03:00 PM, Kevin Windham wrote:
> I am working on an app where I will be adding records to the same
> tables from different sources. I remember some discussion about using
> cursors being better than relying on the base object methods due to
> some kind of confusion that can happen with base object methods
>
> Looking through the documentation, I don't get any clear indication on
> what is the best implementation practice. So I have a few questions.
>
> 1. Can I create an empty cursor and add records to it? If so, how? Do
> I pass an SQL statement that won't match records. Is there an easy way
> to do this.
Yes; use the search condition recID=0.
>
> The reason I want to do this is to utilize the database as persistent
> object storage. I will be creating a record for each object(sometimes
> several records for objects which encapsulate other objects) , and I
> want to be able to create them at will without needing to worry about
> other parts of my program getting the wrong info from the table
> buffers, or overwriting info I am currently putting in the table.
I use V4Rb in this way.
>
> 2. After I add a record, whether it be through a cursor or a base
> object method, what is the best way to get that record's RecId? If I
> can easily create an empty cursor and then add a record to it I can
> just getRecID on the first record. Is there any simple way to do this?
> Perhaps a function that creates the record and returns the ID? If not,
> can I rely on the current record pointer always pointing at the record
> I just created? Does this change if I am using baseobject methods or
> cursor methods?
When you create a cursor to add a new record, specify recID as one of
the fields to retrieve. After you create the record, you can get the
recID from the cursor.
Charles Yeomans
More information about the Valentina
mailing list