Bugfix: avoid calling FieldByName() with a field name that doesn't exist, it causes an exception. Fixes issue #1118.

This commit is contained in:
rosenfield.albert
2009-05-05 08:53:54 +00:00
parent 3939da1618
commit ffe82bc8c7

View File

@ -260,9 +260,9 @@ begin
zq := Mainform.FetchActiveDbTableList; zq := Mainform.FetchActiveDbTableList;
while not zq.Eof do begin while not zq.Eof do begin
if zq.FieldByName(DBO_NAME).AsWideString = oldTableName then begin if zq.FieldByName(DBO_NAME).AsWideString = oldTableName then begin
if zq.FieldByName(DBO_COLLATION).AsString <> '' then if (zq.FindField(DBO_COLLATION) <> nil) and (zq.FieldByName(DBO_COLLATION).AsString <> '') then
strquery := strquery + ' COLLATE ' + zq.FieldByName(DBO_COLLATION).AsString; strquery := strquery + ' COLLATE ' + zq.FieldByName(DBO_COLLATION).AsString;
if zq.FieldByName(DBO_ENGINE).AsString <> '' then if (zq.FindField(DBO_ENGINE) <> nil) and (zq.FieldByName(DBO_ENGINE).AsString <> '') then
strquery := strquery + ' ENGINE=' + zq.FieldByName(DBO_ENGINE).AsString; strquery := strquery + ' ENGINE=' + zq.FieldByName(DBO_ENGINE).AsString;
break; break;
end; end;