![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Wed, Mar 27 2013 11:10 AM | Permanent Link |
John Taylor | Is there a way , other than iterating through know field values, to compare
a record in one table to a record in another table , the two tables having identical structure ? I've searched everything I can find in the manual, doesn't appear to be any "built-in" function or method call to do this. Thanks JT |
Wed, Mar 27 2013 12:13 PM | Permanent Link |
Roy Lambert NLH Associates ![]() | John
>Is there a way , other than iterating through know field values, to compare >a record in one table to a record in another table , the two tables having >identical structure ? > >I've searched everything I can find in the manual, doesn't appear to be any >"built-in" function or method call to do this. Not that I'm aware of. I just used to iterate through Fields.Count Roy Lambert [Team Elevate] |
Wed, Mar 27 2013 12:18 PM | Permanent Link |
Raul ![]() | There is a "RecordHash" system field that is a MD5 hash for the record. However it does not get updated for BLOBs and other fields stored outside main row so it might or might not work for you. For generic solution you'd have to compare field by field (or use RecordHash and then compare the fields that are not part of RecordHash manually). Raul On 3/27/2013 11:10 AM, John Taylor wrote: > Is there a way , other than iterating through know field values, to > compare a record in one table to a record in another table , the two > tables having identical structure ? |
Wed, Mar 27 2013 12:51 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | John,
<< Is there a way , other than iterating through know field values, to compare a record in one table to a record in another table , the two tables having identical structure ? >> No, but it's really simple to do. Here is the function that we use in our test framework (works with queries or tables): function CompareDataSets(DataSet1: TDBISAMDataSet; DataSet2: TDBISAMDataSet): Boolean; var I: Integer; begin Result:=True; with DataSet2 do begin if (RecordCount <> DataSet1.RecordCount) or (FieldCount <> DataSet1.FieldCount) then begin Result:=False; Exit; end; First; DataSet1.First; while (not EOF) do begin for I:=0 to FieldCount-1 do begin if (Fields[I].IsNull <> DataSet1.Fields[I].IsNull) or (Fields[I].Value <> DataSet1.Fields[I].Value) then begin Result:=False; Exit; end; end; Next; DataSet1.Next; end; end; end; Tim Young Elevate Software www.elevatesoft.com |
Wed, Mar 27 2013 1:11 PM | Permanent Link |
John Taylor | Thanks for the replies, iterating over the fields it is
JT "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message news:468DCC6F-CD93-4740-AED9-8377E54F1BA6@news.elevatesoft.com... > John, > > << Is there a way , other than iterating through know field values, to > compare a record in one table to a record in another table , the two > tables having identical structure ? >> > > No, but it's really simple to do. Here is the function that we use in our > test framework (works with queries or tables): > > function CompareDataSets(DataSet1: TDBISAMDataSet; DataSet2: > TDBISAMDataSet): Boolean; > var > I: Integer; > begin > Result:=True; > with DataSet2 do > begin > if (RecordCount <> DataSet1.RecordCount) or > (FieldCount <> DataSet1.FieldCount) then > begin > Result:=False; > Exit; > end; > First; > DataSet1.First; > while (not EOF) do > begin > for I:=0 to FieldCount-1 do > begin > if (Fields[I].IsNull <> DataSet1.Fields[I].IsNull) or > (Fields[I].Value <> DataSet1.Fields[I].Value) then > begin > Result:=False; > Exit; > end; > end; > Next; > DataSet1.Next; > end; > end; > end; > > Tim Young > Elevate Software > www.elevatesoft.com |
Sat, Apr 20 2013 5:04 AM | Permanent Link |
Iztok Lajovic (1) | John,
when reading your post it came to my mind that it could be usefull for somebody to have an utility that can compare two files and display only records that are different. Some time ago I wrote such program and I put it in elevatesoft.public.dbisam.binaries group. Regards, Iztok Lajovic |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |