Hi Rishi,

I think we can fix the problem in the SQL generation and not worry about it
anywhere else. Just wrap alias names in double quotes - see
https://en.wikibooks.org/wiki/SQL_Dialects_Reference/Data_structure_definition/Delimited_identifiers
 .

For MySQL and Microsoft SQL Server, there are configuration options to get
double quotes to work as per the ISO SQL standard. We could either document
that that's necessary, or use the native characters instead of double
quotes for those databases (backquotes for MySQL, square brackets for
MSSQL).

I've had a quick look and I think the changes might need to be in
GenericDAO. The point is once we get this right you can use any alias name
without needing to know the complete list of SQL keywords, and nowhere else
in OFBiz needs to worry about the issue.

What do you think?

Thanks

Paul Foxworthy

On Sat, 27 Jul 2019 at 23:56, Rishi Solanki <rishisolan...@gmail.com> wrote:

> Hello All,
> While working on one view entity creation, I faced one problem and thought
> to share with you all.
> I used OR as entity alias for OrderRole, and while fetching the data the
> entity throws exception of incorrect SQL.
>
> On research I found that while creating SQL query sql executer treat OR as
> OR operator and misinterpret the query. So I would suggest never ever use
> any SQL keyword for entity alias in view entity like OR, AND or any other
> while creating abbreviations for entity alias.
>
> Now I would like to ask to community, do we need to handle this?
>
> If yes then how, in code or in best practice document. Please advise.
>
> Best Regards,
> --
> Rishi Solanki
> Sr Manager, Enterprise Software Development
> *HotWax Systems*
> *Enterprise open source experts*
> cell: +91-98932-87847
> http://www.hotwaxsystems.com
>


-- 
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Australia

Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Email: i...@coherentsoftware.com.au

Reply via email to