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
UpdateDSet(aDSet,'MyFieldName','aVal')

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;
begin
if (pFieldName <> '') then
if (pDset.FindField(pFieldName) <> nil) then
begin
pDset.FieldByName(pFieldName).AsString := pVal;
end;
end;

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.

thank’s

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