TCustomBufDataset: don't allow PacketRecords=-1 on a UniDirectional dataset. Issue #36884

git-svn-id: trunk@44634 -
This commit is contained in:
ondrej 2020-04-07 10:53:48 +00:00
parent e08d8bba82
commit 3f5f91f194
2 changed files with 7 additions and 3 deletions

View File

@ -998,10 +998,13 @@ procedure TCustomBufDataset.SetPacketRecords(aValue : integer);
begin
if (aValue = -1) or (aValue > 0) then
begin
if (IndexFieldNames='') then
if (IndexFieldNames<>'') and (aValue<>-1) then
DatabaseError(SInvPacketRecordsValueFieldNames)
else
if UniDirectional and (aValue=-1) then
DatabaseError(SInvPacketRecordsValueUniDirectional)
else
FPacketRecords := aValue
else if AValue<>-1 then
DatabaseError(SInvPacketRecordsValueFieldNames);
end
else
DatabaseError(SInvPacketRecordsValue);

View File

@ -85,6 +85,7 @@ Resourcestring
SUnsupportedFieldType = 'Fieldtype %s is not supported';
SInvPacketRecordsValue = 'PacketRecords has to be larger then 0';
SInvPacketRecordsValueFieldNames = 'PacketRecords must be -1 if IndexFieldNames is set';
SInvPacketRecordsValueUniDirectional = 'PacketRecords must not be -1 on an unidirectional dataset';
SInvalidSearchFieldType = 'Searching in fields of type %s is not supported';
SDatasetEmpty = 'The dataset is empty';
SFieldIsNull = 'The field is null';