I'm trying out the evaluation version of EhLib 9.2 and having some trouble with square brackets in the generated filter sql while filtering on server (MySQL 5.7.20) via UniDAC 7.2.7.
EhLibUniDAC.pas is in uses clause and works fine for sorting.
If I'm trying to filter on server I get the follwoing error:
Quote:
#42000 You have an error in your SQL syntax, check the manual that corresponds to your MySQL server version for the right syntax to use near '[user_id] >'b'' at line 4.
user_id is the field I'm trying to filter.
It seems the problem are the [ ] square brackets.
If I change one line in the
Code:
procedure TUniDatasetFeaturesEh.ApplyFilter(Sender: TObject; DataSet: TDataSet; IsReopen: Boolean);
in EhLibUniDAC.pas from
Code:
TCustomUniDataSet(DataSet).FilterSQL := GetExpressionAsFilterString(TDBGridEh(Sender),
GetOneExpressionAsLocalFilterString, nil);
to
Code:
TCustomUniDataSet(DataSet).FilterSQL := ReplaceStr(ReplaceStr(GetExpressionAsFilterString(TDBGridEh(Sender),
GetOneExpressionAsLocalFilterString, nil), '[', ''), ']', '');
it works fine.
So (the?) my problem exists in GetExpressionAsFilterString or GetOneExpressionAsLocalFilterString which I'm not possible to examine since I don't have the source code.
I don't think this a UniDAC problem since I can't query WHERE [user_id]>'b' in HeidiSQL or dbforge.
Is there any way to prevent this behaviour (inserting [ ] for the field names) in the filtering?