fix issue #2782 that orm builder generate incorrect sql in some case#2787
Conversation
|
@Agzer0 Thanks for your contribution, but please commit associated unit testing case for this update. Please add the unit testing case here: https://github.com/gogf/gf/blob/master/contrib/drivers/mysql/mysql_issue_test.go . There're reference cases already for you. |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #2787 +/- ##
=======================================
Coverage 79.15% 79.15%
=======================================
Files 632 632
Lines 52174 52174
=======================================
+ Hits 41298 41300 +2
+ Misses 8830 8828 -2
Partials 2046 2046
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
|
okay, i`ve added testing case |
Add 38 issue regression tests ported from MariaDB baseline, bringing the total from 9 to 47. Tests cover JSON scanning (gogf#1380), ScanList (gogf#1570), With/WithAll (gogf#1401, gogf#1412, gogf#2119), timestamp comparison (gogf#1002), case-sensitive columns (gogf#1700), OmitEmpty (gogf#2561, gogf#3204), FieldsEx soft-time (gogf#3754), Hook+concurrent (gogf#3238), cache Hook (gogf#3626), Order variations (gogf#3932), ScanAndCount+Hook (gogf#3968), column comparison with Raw (gogf#3915), AllAndCount/Distinct (gogf#4698), Fields empty string (gogf#4697), ClearTableFields (gogf#2552), sub-query model (gogf#2339), Delete guard (gogf#2427), batch duplicate key (gogf#3086), JSON null/array scan (gogf#4086), sys_config JSON (gogf#3218), Transaction+Save (gogf#4034), Builder conditions (gogf#2787), WherePrefixNotIn (gogf#2907), InnerJoinOnField (gogf#2439), and captured SQL quoting (gogf#3649). MySQL-specific tests (IF(), zerofill, BIGINT UNSIGNED, cross-schema, lpad/concat_ws, MariaDB regex) are present as skip stubs to maintain function-name parity. 12 PgSQL-dialect testdata SQL files added for tests that depend on external schema definitions. ref gogf#4689
Add 38 issue regression tests ported from MariaDB baseline, bringing the total from 9 to 47. Tests cover JSON scanning (gogf#1380), ScanList (gogf#1570), With/WithAll (gogf#1401, gogf#1412, gogf#2119), timestamp comparison (gogf#1002), case-sensitive columns (gogf#1700), OmitEmpty (gogf#2561, gogf#3204), FieldsEx soft-time (gogf#3754), Hook+concurrent (gogf#3238), cache Hook (gogf#3626), Order variations (gogf#3932), ScanAndCount+Hook (gogf#3968), column comparison with Raw (gogf#3915), AllAndCount/Distinct (gogf#4698), Fields empty string (gogf#4697), ClearTableFields (gogf#2552), sub-query model (gogf#2339), Delete guard (gogf#2427), batch duplicate key (gogf#3086), JSON null/array scan (gogf#4086), sys_config JSON (gogf#3218), Transaction+Save (gogf#4034), Builder conditions (gogf#2787), WherePrefixNotIn (gogf#2907), InnerJoinOnField (gogf#2439), and captured SQL quoting (gogf#3649). MySQL-specific tests (IF(), zerofill, BIGINT UNSIGNED, cross-schema, lpad/concat_ws, MariaDB regex) are present as skip stubs to maintain function-name parity. 12 PgSQL-dialect testdata SQL files added for tests that depend on external schema definitions. ref gogf#4689
fix issues #2782 : When ORM is constructing multiple SQL conditions, the OmitEmpty option is used. If the first condition is empty conditions and the second condition is the compound condition. At this time, when there is still a third condition, the generated SQL is wrong.