fix reset colmap when counting distinct cols #2096

Merged
lunny merged 3 commits from finelog/xorm:fix_find_count_distinct_cols into master 4 months ago
finelog commented 4 months ago

when using distinct cols with FindAndCount, reset statement.ColumnMap will make the counting sql an syntax error, this pr try fix this.
is this pr ok for merge?

error sql logging:

[SQL] SELECT DISTINCT `Fid` FROM `table_demo` WHERE Fkey = ? [val]

[SQL] SELECT count(DISTINCT ) FROM `table_demo` WHERE Fkey = ? [val]

after fix:

[SQL] SELECT DISTINCT `Fid` FROM `table_demo` WHERE Fkey = ? [val]

[SQL] SELECT count(DISTINCT `Fid`) FROM `table_demo` WHERE Fkey = ? [val]
when using distinct cols with FindAndCount, reset statement.ColumnMap will make the counting sql an syntax error, this pr try fix this. is this pr ok for merge? error sql logging: ```sql [SQL] SELECT DISTINCT `Fid` FROM `table_demo` WHERE Fkey = ? [val] [SQL] SELECT count(DISTINCT ) FROM `table_demo` WHERE Fkey = ? [val] ``` after fix: ```sql [SQL] SELECT DISTINCT `Fid` FROM `table_demo` WHERE Fkey = ? [val] [SQL] SELECT count(DISTINCT `Fid`) FROM `table_demo` WHERE Fkey = ? [val] ```
finelog added 1 commit 4 months ago
cb2ee8fafa fix reset colmap when counting distinct cols
finelog closed this pull request 4 months ago
finelog reopened this pull request 4 months ago
Poster

I accidently close this pr, reopened, sorry about that

I accidently close this pr, reopened, sorry about that
finelog started working 4 months ago
finelog cancelled time tracking 4 months ago
Poster

ping, is anyone there?

ping, is anyone there?
Owner

Could you add some tests?

Could you add some tests?
finelog added 2 commits 4 months ago
Poster

Could you add some tests?

done

> Could you add some tests? done
finelog force-pushed fix_find_count_distinct_cols from fe027b8f68 to 0dca287ffc 4 months ago
finelog added 1 commit 4 months ago
lunny approved these changes 4 months ago
lunny added the
kind/bug
label 4 months ago
lunny merged commit 7802393d01 into master 4 months ago
Owner

@finelog Thanks!!!

@finelog Thanks!!!
finelog deleted branch fix_find_count_distinct_cols 4 months ago
Poster

🤝

🤝

Reviewers

lunny approved these changes 4 months ago
continuous-integration/drone/pr Build is passing
The pull request has been merged as 7802393d01.
Sign in to join this conversation.
Loading…
There is no content yet.