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

Fixes list query for 0.5 branch #13

Open
wants to merge 1 commit into
base: dev-0.5.0
Choose a base branch
from

Conversation

Sylvyrfysh
Copy link
Contributor

No description provided.

appendSelectSql(sb, alias)
appendSelectSql(sb).append(whereClause, alias)
val aliasedWhereClause = if(!alias.isNullOrEmpty()) {
whereClause.split(" ").joinToString(" ") {
Copy link
Owner

@vsch vsch Dec 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The where clause is a user provided string. I don't see why it should be changed instead of the user providing one already properly aliased. The alias parameter in this method is intended for the model generated select query.

  2. You are splitting on spaces and comparing if the split part is a column name. So it will only work if the column is surrounded by spaces but that is not a requirement in SQL. So column=value will not be aliased.

    One solution here would be to go through all the properties and defaults and see if the part starts with a column name but then more checks would be needed to make sure that it is not a false positive match.

I do not see a use case for this because the where clause provided by the user should already have the columns with table alias.

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

Successfully merging this pull request may close these issues.

2 participants