-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
FINERACT-854 Removed string concatenated SQL from CenterReadPlatform #1123
Conversation
extraCriteria.append(" and (").append(sqlQueryCriteria).append(") "); | ||
this.columnValidator.validateSqlInjection(schemaSl, sqlQueryCriteria); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also removing this part is not correct as of NOW, the problem is we are talking SQL query as a query to give users more functionality and certainly that is not supported in SQL builder currently, we probably would need to parse things find relevant queries and then add those to extra criteria still thinking on it.
Will be looked after limit and order by are supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vorburger WDYT on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thesmallstar I'm not sure I fully understand what you mean here, but starting to think about adding parsing things sounds like the wrong direction - try not to have to do that (it will be a mess - trust me).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thesmallstar sorry for the huge delay in getting back to you on this one. I've re-read it again now (took me a minute to get back into it). Are you suggesting that we merge this now? Because, unless I misunderstand, this would break the currently existing functionality for these sqlQueryCriteria, agreed? But they really are a problem, huh? I need to dig more into the code to understand where this is coming from..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't (shouldn't) merge this PR as is, because it will break support for sqlSearch
. We need to EITHER support it here, OR (my preference) should just cleanly remove it all together - as (now) suggested in https://issues.apache.org/jira/browse/FINERACT-1095.
|
19d9137
to
4ab4d9d
Compare
Failed due to https://issues.apache.org/jira/browse/FINERACT-1016 |
@vorburger @awasum if you like this approach Before we merge this I will add the tests for the same, if not do you have any suggestions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with something like this, but have several feedbacks:
-
I don't know if this actually works (PreparedStatement), so will have to trust you that you test that it really does.
-
The current implementation seems to assume that
setLimit()
& Co. would only ever be called afteraddCriteria()
- right? That's... not a good idea. Imagine some dumb developer coming along in a few months, not knowing how you implemented this internally (and correctly so, they should not have to). So they donew SQLBuilder().addOrderBy().addCriteria(...).getSQLTemplate()
- and that would create invalid SQL - agreed? -
SQLBuidlerTest
must be extended to cover these new methods.
I'll re-review this week after next (vacation).
* @param orderBy | ||
* The value that will be used as orderBy | ||
*/ | ||
public void addOrderBY(Object orderBy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lower-case y:
public void addOrderBY(Object orderBy) { | |
public void addOrderBy(Object orderBy) { |
-> Yes it works! I have tested it :)
->Agreed I am making the change.
->Extending, I was waiting for the approach to be marked correct :) |
failed due to connection error. Closing and opening this PR to retest. |
I am removing the part to add limit and orderby to SQL builder separate from this PR, so as to review this properly, and also we can merge this quickly then and not keep it blocked by the work and testing on that part. |
f70ae3b
to
adc0701
Compare
extraCriteria.append(" and (").append(sqlQueryCriteria).append(") "); | ||
this.columnValidator.validateSqlInjection(schemaSl, sqlQueryCriteria); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thesmallstar sorry for the huge delay in getting back to you on this one. I've re-read it again now (took me a minute to get back into it). Are you suggesting that we merge this now? Because, unless I misunderstand, this would break the currently existing functionality for these sqlQueryCriteria, agreed? But they really are a problem, huh? I need to dig more into the code to understand where this is coming from..
This pull request seems to be stale. Are you still planning to work on it? We will automatically close it in 30 days. |
@thesmallstar any updates on this? |
e9249ad
to
67d4126
Compare
This build will fail now, will pass only after rebase from #1171 |
@vorburger review/merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Refer: https://issues.apache.org/jira/browse/FINERACT-854 and #725 #723 for background.
The work for this part is completed, but SQLbuilder currently does not support the use of "limit" and "order by" query which I will be adding before this can be merged.