Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to support custom SQL #599

Open
daiagou opened this issue Jun 2, 2023 · 1 comment
Open

Need to support custom SQL #599

daiagou opened this issue Jun 2, 2023 · 1 comment

Comments

@daiagou
Copy link

daiagou commented Jun 2, 2023

For example, I just mentioned a login optimization issue:#598
The SQL I suggest:DELETE from user_login_key where USER_ID=? and THRU_DATE < ?;
update table set amount=amount-1 where amount>?;
select max(xxx) from table;
and so on.
But currently, Moqui does not support it.

@acetousk
Copy link
Member

acetousk commented Jun 2, 2023

Your first example, it looked like this was tried at some point see this. I bet that with a bit more effort, this problem could be resolved instead of supporting custom SQL for a whole bunch of different databases.

If you want to code a SQL function call in a screen or service, you can use the sqlFind method in EntityFacade.java line 87 for finding an entity list (just like an entity-find).

For a more general SQL implementation, it might be good to have one that can be accessed programatically. This would allow for something like what you suggested. One problem with this is that Moqui supports multiple databases that have different SQL syntax. Moqui currently handles that by making simple CRUD queries easy which is the 90% of the database query use-cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants