Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 26 Apr 2024, 10:22

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 09 May 2018, 14:57 
Offline

Joined: 09 May 2018, 14:22
Posts: 6
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?


Top
 Profile  
 
PostPosted: 27 Jun 2018, 22:21 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

You can try to use GetOneExpressionAsSQLWhereString instead of GetOneExpressionAsLocalFilterString.
The expression interpreter in the Filter properties is very dependent on the DataSet type.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group