Mysmatch between real FieldName and FindField in DB.pas

Hi all,
I think there's some problem in db.pas unit because when you use
aDataset.FindField(aFieldName) return a TField even if found a Lower/Upper/camelCase FieldName
because always tested in uppercase (see source)

But when you use aDataSet.FieldByName(aFieldName).AsString, this use the correct case.

So there's some problem, for example call the function

Example :

I use SqlLite DB with a table with this field = 'aFieldName'
This is a function to update a Dset (simplify here)

function UpdDSet(pDset : TDataSet; pFieldName, pVal : String) : Boolean;
if (pFieldName <> '') then
if (pDset.FindField(pFieldName) <> nil) then
pDset.FieldByName(pFieldName).AsString := pVal;

UpdDSet('AFIELDNAME') => this field recognize with FindField but not in pDset.FieldByName

Since this is a RTL, we'll check this with the pas2js team.

Feedback from pas2js is that it is the same in Delphi.

Other than this, FieldByName() internally uses FindField() , so I cannot see a reason why FindField() would find a field and FieldByName() not.

You’re right.

The problem in fact is only :

if you use a fieldname with no uppercase char (like FieldName) find field return always true.


I retested here with a Delphi VCL TClientDataSet and also there, the fieldname is not case-sensitive.