Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Migration big problem.... DbIsam->RecordID
Thu, Sep 11 2008 6:32 AMPermanent Link

"Mauro Botta"
Hi

i have make a Migration from DbIsam to EDB2

when EDB have created my EDB tables have trasformed a
PrimaryKey RecordID ( Hidden Field in DbIsam ) in a True ( autogenerated )
fields.

now....

in my big application ( 500 dfm ) all

for i := 0 to tblTemp.FieldDefs.Count - 1 do
     tblTemp.FieldByName(tblTemp.FieldDefs[i].Name).AsString := sTemp;

go in error , because the first new field is : RecordID

and is unique ( error : Duplicate Primary Key !!!  )


Can i have this new field HIDDEN ?
or i must modify all 500 table for remove this field / pm key after the
MIGRATION ?
Thu, Sep 11 2008 2:56 PMPermanent Link

Heiko Knuettel
Mauro,

it can't be hidden.

Why don't you exclude the field with an "if tblTemp.FieldDefs[i].Name <> 'RecordID' then
..." in your loop ?

Heiko
Thu, Sep 11 2008 5:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Heiko,

<< Can i have this new field HIDDEN ? >>

Unfortunately it cannot be hidden.  Heiko's suggestion for a workaround
should work for you, or you can simply just drop any primary keys in your
newly-migrated EDB tables that use just the RecordID column along with the
RecordID column and simply have no primary key for these tables.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Sep 12 2008 3:43 AMPermanent Link

"Mauro Botta"
> Why don't you exclude the field with an "if tblTemp.FieldDefs[i].Name <>
> 'RecordID' then
> .." in your loop ?

because i have 20 MB of sources and 10000000 loop with :
tblTemp.FieldDefs[i].AsString :=   .. . .

Fri, Sep 12 2008 10:15 AMPermanent Link

Heiko Knuettel
Mauro,

I see. If you really don't want to alter your tables, maybe something like this works for
you (untested) :

TmyEDBTable = class(TEDBTable)
protected
 procedure InternalPost; override;
end;

procedure TmyEDBTable.InternalPost;
var i: integer;
begin
  for i := 0 to Fields.Count - 1 do begin
     if Fields[i].FieldName = 'RecordID'
     then Fields[i].Value := Fields[i].OldValue;
  end;
  inherited;
end;
Image