fix reset colmap when counting distinct cols #2096

Merged
lunny merged 3 commits from finelog/xorm:fix_find_count_distinct_cols into master 2022-01-25 03:09:42 +00:00
Contributor

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 2022-01-11 03:27:42 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
cb2ee8fafa
fix reset colmap when counting distinct cols
finelog closed this pull request 2022-01-11 04:10:13 +00:00
finelog reopened this pull request 2022-01-11 04:11:12 +00:00
Author
Contributor

I accidently close this pr, reopened, sorry about that

I accidently close this pr, reopened, sorry about that
finelog started working 2022-01-11 10:35:39 +00:00
finelog canceled time tracking 2022-01-11 10:35:55 +00:00
Author
Contributor

ping, is anyone there?

ping, is anyone there?
Owner

Could you add some tests?

Could you add some tests?
Author
Contributor

Could you add some tests?

done

> Could you add some tests? done
finelog force-pushed fix_find_count_distinct_cols from fe027b8f68 to 0dca287ffc 2022-01-24 11:08:15 +00:00 Compare
finelog added 1 commit 2022-01-25 02:18:16 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
ee46b8b099
Merge branch 'master' into fix_find_count_distinct_cols
lunny approved these changes 2022-01-25 03:09:27 +00:00
lunny added the
kind
bug
label 2022-01-25 03:09:37 +00:00
lunny merged commit 7802393d01 into master 2022-01-25 03:09:42 +00:00
Owner

@finelog Thanks!!!

@finelog Thanks!!!
finelog deleted branch fix_find_count_distinct_cols 2022-01-25 03:11:52 +00:00
Author
Contributor

?

?
Sign in to join this conversation.
No description provided.