Skip to content

columnsWithAlias: Only prepend table name if not empty #359

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

Merged
merged 2 commits into from
Aug 7, 2015

Conversation

julienschmidt
Copy link
Member

Fixes Issue #357

ToDo:

  • Test

@arnehormann
Copy link
Member

I prefer moving the table name length comparison into the outer condition, e.g.

if rows.mc.cfg.columnsWithAlias && rows.columns[i].tableName != "" {
    for i, col := range rows.columns {
        columns[i] = col.tableName + "." + col.name
    }
} else {
    for i := range columns {
        columns[i] = rows.columns[i].name
    }
}

LGTM after test - if you still want to add one.

@julienschmidt
Copy link
Member Author

Unless Go suddenly has Prolog style unification, I'm afraid that we can't use the index i outside the loop before we bind it inside the loop 😉

@arnehormann
Copy link
Member

... ugh. You got me there...

@julienschmidt
Copy link
Member Author

Test added; PTAL

@arnehormann
Copy link
Member

LGTM

julienschmidt added a commit that referenced this pull request Aug 7, 2015
columnsWithAlias: Only prepend table name if not empty
@julienschmidt julienschmidt merged commit 3dd7008 into master Aug 7, 2015
@julienschmidt julienschmidt deleted the columnsWithAlias branch August 7, 2015 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants