[Lazarus] TDBEdit, TStringField Size, DataSize, DisplayWidth and MaxLength

LacaK lacak at zoznam.sk
Fri Oct 14 07:43:46 CEST 2016


>
>> I am aware of it. I have not added all other MBCS because ! I doubt, 
>> which are realy used nowadays.
>> My guess is that UTF-8 is far most used / supported as client 
>> character set.
>> No problem to add them if there will be real demand from users ...
> Perhaps the correct answer is to let the database driver work this one 
> out rather than have a fixed decision in the FCL.
>
> I would suggest the following change:
>
> function TStringField.GetDataSize: Integer;

My intention was made TStringField independent from TFieldDef, at least 
because we can have FieldDef=nil (for lookup, calculated fields)
Of course I can introduce class procedure (or regular procedure), with 
ACodePage parameter, which will be called from TStringField and 
TFieldDef, so all code will be in one place.

>
>
> In IBX, I have already done this using TIBFieldDef and TIBStringField 
> as subclasses in order to pass character set information. However, 
> because TFieldDef.CreateField is non-virtual, the implementation is 
> not as elegant as it should be. That is the extra info is added to the 
> TIBStringField as the dataset is opened

I do not know IBX, but don't you use overriden 
TDataSet.InternalInitFieldDefs ? It will allow you put extra info into 
FieldDef and then use overriden TDataSet.CreateFields, which will allow 
you pass extra info from TIBFieldDef into TIBStringField for example ...
(AFAICS Zeos do it in this way also)

-Laco.

> rather than when the field is created. It is also less maintainable as 
> the functionality should be in TIBFieldDef rather than in a different 
> class altogether.
>
> Making those two methods virtual is the most important change. I can 
> live with TStringField.GetDataSize as it is because that is already 
> virtual and a future TIBStringField can readily override it.
>
> Tony Whyman
> MWA
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161014/40cbce39/attachment.html>


More information about the Lazarus mailing list