getting Index after INSERT INTO

Andrew Sinning andrew at learningware.com
Wed Aug 20 20:20:47 CDT 2003


Thank you Ruslan.

One point of clarification:

Does every table have a RecID?

And this value is automatically incremented each time a new record is
added?

And this is always a unique value?  Eg, if I make 100 records and then
delete the last 50, the next new record will have RecID 101, not 51,
correct?

Thanks.

-----Original Message-----
From: valentina-bounces at lists.macserve.net
[mailto:valentina-bounces at lists.macserve.net]On Behalf Of Ruslan
Zasukhin
Sent: Wednesday, August 20, 2003 5:18 PM
To: valentina at lists.macserve.net
Subject: Re: getting Index after INSERT INTO


on 8/21/03 12:27 AM, Andrew Sinning at andrew at learningware.com wrote:

> Well, first of all, how do I create an "AUTO_INCREMENT" field?

No such feature in 1.x

RecID can often be used instead.

> How about:
>
> fieldId UMedium NOT NULL UNIQUE INDEXED
>
> ?

What you ask about here?


> Now, assuming I've got an auto incrementing index, how do I get the
> index after an INSERT INTO?  Something like MySQL's "LAST_INSERT_ID()"
> or PHP's "mysql_insert_id()".
>
> BTW: I'm using Valentina for Macromedia Director (V4MD).

After INSERT INTO there is no way to get this.
We need also add something as LAST_INSERT_ID

But if you will use Vcursor and built it as

    SELECT RecID, other fields
    FROM T
    WHERE RecID = 0

Then you do

    cursor.SetBlank()

    cursor.field("a") = 5
    ...

    cursor.AddRecord()


Now RecID field contains RecID of just added record.
So you can get it using

    cursor.GetValue( "RecID" )



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

_______________________________________________
Valentina mailing list
Valentina at lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina




More information about the Valentina mailing list