Subject | Re: [IBO] RefreshRows, RefreshKeys |
---|---|
Author | Helen Borrie |
Post date | 2004-04-06T11:29:48Z |
At 09:34 AM 6/04/2004 +0200, you wrote:
database at all:
a) it should be done on the server
b) the keys should not be dependendent on one another's values
Helen
>Hi everyone!Really, you shouldn't be using a technique like this with a client/server
>
>IBO4.2 (registered), FB1.5RC8
>
>Can you tell me why this doesn't work correctly?
>
>(pseudocode)
>
>while (records to insert) do begin
> Table1.Last;
> new_key := Table1.FieldByName(KEYFIELD).AsInteger + 1;
> Table1.InsertRecord([new_key, ...]);
>end; {while}
>
>
>If I don't insert this two additional commands before the "end; {while}"
>statement
>
>Table1.RefreshRows;
>Table1.RefreshKeys;
>
>I obtain the same new_key values for several ongoing records. The DB is in
>ForcedWrites mode, Table1.AutoCommit = True;
>
>(note: Actually this piece of code would generate a Key violation, but it is
>slightly different in the real code, there are checks for existing records
>also, but this illustrates the process that is performed...)
>
>
>Can you help? Should I probably use RefreshRows, RefreshKeys in
>AfterPost/Insert/Delete to be sure I always read the actual dataset
>contents?
database at all:
a) it should be done on the server
b) the keys should not be dependendent on one another's values
Helen