Subject | Query inserts record with all null values in v5.9 but not v5.5 |
---|---|
Author | |
Post date | 2018-10-25T18:00:32Z |
I recently upgraded to v5.9 and a function that inserts a record in to a table now inserts the record with every field having a null value. If I roll back to v5.5 then the record gets inserted correctly. Seems as there is some bug between version v5.5 and v5.9 that got introduced that prevents this code from running correctly but I can't tell what the difference between this code and any other insert statement in our system because this is the first time I have seen this issue while many other inserts in the system seem to be operating as they were before. It executes without error, but just does not work as it should. Here is the code in case it provides any insight as to the cause:
Procedure CreateDefaultOperation(const JOBNO:string;NewOperationUniid:Double;DateStartValue,DateEndValue:TDatetime);
var
TempQueryCopyToOperation : TIBOQuery;
begin
TempQueryCopyToOperation := TIBOQuery.create(nil);
try
TempQueryCopyToOperation.DatabaseName := 'JOBDATA2';
TempQueryCopyToOperation.sql.ADD('INSERT INTO OPERATIONS');
TempQueryCopyToOperation.sql.Add('(JOBNO,OPERNAME,DESCRIPT,NOTES,WORKCENTERNAME,');
TempQueryCopyToOperation.sql.Add('STARTDATE,STATUS,SQUENCES,UNIID,ENDDATE,QTY) '); //FMZZ
TempQueryCopyToOperation.sql.Add('Values(:JOBNO,:OPERNAME,:DESCRIPT,:NOTES,:WORKCENTERNAME,');
TempQueryCopyToOperation.sql.Add(':STARTDATE,:STATUS,:SQUENCES,:UNIID,:ENDDATE,:QTY)'); //FMZZ
TempQueryCopyToOperation.ParamByName('JOBNO').AsString := JOBNO;
if GetSetupString('DEFOPERATION') <> '' then
TempQueryCopyToOperation.ParamByName('OPERNAME').AsString := GetSetupString('DEFOPERATION')
else
TempQueryCopyToOperation.ParamByName('OPERNAME').AsString := 'MainOperation';
TempQueryCopyToOperation.ParamByName('DESCRIPT').AsString := 'Default Operation';
TempQueryCopyToOperation.ParamByName('NOTES').asmemo := 'Default Operation Notes';
TempQueryCopyToOperation.ParamByName('WORKCENTERNAME').AsString := GetSetupString('DEFAULTWKC');
TempQueryCopyToOperation.ParamByName('STATUS').AsString :='Scheduled';
TempQueryCopyToOperation.ParamByName('SQUENCES').asInteger := TJobUtils.GetNextSquenceNo(Jobno);
TempQueryCopyToOperation.ParamByName('UNIID').AsFloat := NewOperationUniid;
TempQueryCopyToOperation.ParamByName('QTY').AsFloat := 1;
TempQueryCopyToOperation.ParamByName('STARTDATE').asDatetime := DateStartValue;
TempQueryCopyToOperation.ParamByName('ENDDATE').asDatetime := DateEndValue ;
TempQueryCopyToOperation.ExecSQL;
finally
TempQueryCopyToOperation.close;
TempQueryCopyToOperation.Free;
end;
end;
It is pretty ugly yet simple code. One last thing of note. When using 5.9 if I step in to the execsql call, eventually there will be an access violation inside of the IBObjects code but it seems like it might be getting swallowed up because it is not being surfaced outside of the execsql call. For all I know 5.5 might exhibit the same behavior, but unfortunately with 5.5 im installing the components via the install.bat file instead of the installer exe like I am doing in 5.9 and the batch file doesn't seem to setup the installation in a way that lets me step in to the code like I can with 5.9.