Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Frequently Asked Questions |
TDBISAMBatchMoveType = (bmtAppend,bmtAppendUpdate,bmtCopy, bmtDelete,bmtUpdate); procedure BatchMove(SourceTable, DestTable: TDBISAMTable; MoveType: TDBISAMBatchMoveType); var I: Integer; RecordWasFound: Boolean; begin SourceTable.DisableControls; DestTable.DisableControls; try with SourceTable do begin Open; FieldDefs.Update; IndexDefs.Update; end; with DestTable do begin if (not Exists) or (MoveType=bmtCopy) then begin Close; FieldDefs.Assign(SourceTable.FieldDefs); IndexDefs.Assign(SourceTable.IndexDefs); CreateTable(SourceTable.LocaleID, SourceTable.UserMajorVersion, SourceTable.UserMinorVersion, SourceTable.Encrypted, SourceTable.Password, SourceTable.Description, SourceTable.IndexPageSize, SourceTable.BlobBlockSize, SourceTable.LastAutoIncValue); end; Open; IndexName:=''; end; DestTable.LockTable; try with SourceTable do begin IndexName:=''; First; end; while not SourceTable.EOF do begin RecordWasFound:=False; if (MoveType in [bmtAppend,bmtAppendUpdate, bmtUpdate,bmtDelete]) then begin DestTable.SetKey; for I:=0 to DestTable.IndexFieldCount-1 do begin DestTable.IndexFields[I].Assign( SourceTable.FieldByName( DestTable.IndexFields[I].FieldName)); end; RecordWasFound:=DestTable.GotoKey; end; if RecordWasFound then begin if (MoveType in [bmtAppendUpdate, bmtUpdate]) then begin DestTable.Edit; for I:=0 to SourceTable.FieldCount-1 do DestTable.FieldByName( SourceTable.Fields[I].FieldName). Assign(SourceTable.Fields[I]); DestTable.Post; end else if (MoveType=bmtDelete) then DestTable.Delete; end else begin if (MoveType in [bmtAppend,bmtAppendUpdate, bmtCopy]) then begin DestTable.Insert; for I:=0 to SourceTable.FieldCount-1 do DestTable.FieldByName( SourceTable.Fields[I].FieldName). Assign(SourceTable.Fields[I]); DestTable.Post; end; end; SourceTable.Next; end; finally DestTable.UnlockTable; end; finally SourceTable.EnableControls; DestTable.EnableControls; end; end;
This web page was last updated on Wednesday, January 5, 2022 at 07:36 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |