[Lazarus] RE : RE : TSQLQuery limited to 255 characters in Unicode

Ludo Brands ludo.brands at free.fr
Fri Apr 27 11:36:38 CEST 2012


> 
> You were right, it was a problem of field definition. changing to  
> varchar(1000) it worked fine ! Thank you.
> 
> But I thikn there is an inconsistency in the driver, because in the  
> update, the whole string is inserted, and in the select stmt 
> only 255  
> chars are returned.
> 

This is more a SQLite issue. You pass pRequete to the database layer which
sends it as is to SQLite. If pRequete contains a string which is too long
for the column SQLite stores the excess data while other databases would
truncate or generate an error. To read the data back, the driver uses the
metadata to allocate memory to store the result set. Datasets can't work
with variable length data other than blobs. If you would use tdataset to
store the data instead of building your own query, the data would have been
trunctated at the insertion also. 
If you want variable length strings, use the TEXT datatype in your table
declaration. Most dbcontrols can't display memo fields but I noticed you
fill in your own grid so that shouldn't be a problem. 

Ludo





More information about the Lazarus mailing list