IBConnection does not check limit size of CHAR,VARCHAR fields (TStringField) to dsMaxStringSize
Original Reporter info from Mantis: lacak @lacak.sk
-
Reporter name: LacaK
Original Reporter info from Mantis: lacak @lacak.sk
- Reporter name: LacaK
Description:
There is error runing fcl-db test suite with TIBConnection :
&LtPos;test name="TTestFieldTypes.TestInsertLargeStrFields">
&LtPos;error ExceptionClassName="EAccessViolation">
&LtPos;message>Access violation&LtPos;/message>
&LtPos;sourceunit>C:/Programy/lazarus/fpc/2.7.1/source/packages/fcl-db/src/base/fields.inc&LtPos;/sourceunit>
&LtPos;methodname>TSTRINGFIELD__SETASSTRING&LtPos;/methodname>
&LtPos;linenumber>1185&LtPos;/linenumber>
&LtPos;/error>
Error is caused by fact, that DataSize of TStringField can be set larger than dsMaxStringSize.
So solution can be:
1. test in class procedure TStringField.CheckTypeSize(AValue: Longint);
If (AValue<0) or (AValue>dsMaxStringSize) Then
databaseErrorFmt(SInvalidFieldSize,[AValue]);
- test in procedure TIBConnection.TranslateFldType
for SQL_VARYING, SQL_TEXT if SQLLen>dsMaxStringSize then map to ftMemo instead of ftString or ftFixedChar
If you agree, I can prepare patch.
Mantis conversion info:
- Mantis ID: 19940
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 22851 (#307b6173)
- Target version: 2.7.1