El 14/7/25 a les 17:57, Michael Van Canneyt via fpc-pascal ha escrit:


On Mon, 14 Jul 2025, Luca Olivetti via fpc-pascal wrote:

El 14/7/25 a les 14:59, Michael Van Canneyt via fpc-pascal ha escrit:


That's not what the documentation says

https://www.freepascal.org/docs-html/fcl/db/tstringfield.size.html (emphasis mine)

"it is the declared *maximum* size of the string (in *characters*) and is used to calculate the size of the dataset buffer."

Seems the documentation has not been updated for the unicode case :-(

Well, even the "maximum" part isn't true, at least using the TMSSQLConnection.

How so ? the size comes from what is reported by MSSQL.

Well, in both cases (using TMSSQLConnection and TPQConnection) I have specified the size of the TStringField in the object inspector. When using the TMSSQLConnection the size I specified seems to be ignored (i.e. I have set it to 100, the field has been changed to varchar(200) and I get more than 100 characters) while with TPQConnection the length is truncated (i.e. even if I change the field to varchar(200) any record with a value longer than 100 characters is truncated to 100 characters). Again, the documentation says "Size is made published by the TStringField class so it can be set in the IDE" and I expected that to be the case, which it true with TPQConnection but false with TMSSQLConnection.

Bye
--
Luca
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to