View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001647 | Database Comparer VCL | General | public | 2020-08-25 16:51 | 2020-08-26 12:16 |
Reporter | shirokov | Assigned To | barry | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | feedback | Resolution | open | ||
Summary | 0001647: TableDataComparer doesn't update records with different keyfield names in master and target | ||||
Description | The "field not found" error occurs when trying to compare two tables with different keyfield names. There are two problems: 1. possible bug in the following code line TTableDataComparer.CompareRecord() function CompareKeyFields() FldT := fQT.FieldByName(fTableOptionsM.kFlds[i]); It's obviously, should be fTableOptionsT 2. the TTableDataComparer.RecordUpdate() method generates wrong "where" clause - it uses parameter names from target, but attempts to search fields with such names in master. This causes "field not found" error. 3. datetime files in mssql are transferred incorrectly - milliseconds are omitted, e.g. the '2020-08-25 14:37:24.870' value in master becomes '2020-08-25 14:37:25.000' in target. This causes adding such records in the update script. See the attached Delphi example. | ||||
Steps To Reproduce | try to sync two tabels (FB3 and MS-SQL) Follow the table definition on Firebird3 CREATE TABLE ALARME ( SPS_NODE SMALLINT NOT NULL, TYP SMALLINT NOT NULL, ELEMENT SMALLINT NOT NULL, JOBID SMALLINT NOT NULL, KOMMT TIMESTAMP NOT NULL, GEHT TIMESTAMP); ALTER TABLE ALARME ADD CONSTRAINT PK_ALARME PRIMARY KEY (SPS_NODE,TYP,ELEMENT,JOBID,KOMMT); Follow the table definition on MS-SQL CREATE TABLE dbo.Alarme ( PLC_ID smallint NOT NULL, Alarm_no smallint NOT NULL, Alarm_On datetime NOT NULL, Alarm_Off datetime NOT NULL, PRIMARY KEY CLUSTERED (PLC_ID, Alarm_no, Alarm_On) WITH ( PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) ON [PRIMARY] | ||||
Tags | No tags attached. | ||||