[
https://issues.apache.org/jira/browse/OPENJPA-2960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Romain Manni-Bucau resolved OPENJPA-2960.
-----------------------------------------
Resolution: Fixed
> NULLS FIRST/LAST string rewrite breaks on commas, triplicated
> -------------------------------------------------------------
>
> Key: OPENJPA-2960
> URL: https://issues.apache.org/jira/browse/OPENJPA-2960
> Project: OpenJPA
> Issue Type: Sub-task
> Components: jpa
> Affects Versions: 4.2.0
> Reporter: Maxim Solodovnik
> Assignee: Romain Manni-Bucau
> Priority: Major
> Fix For: 4.2.0
>
>
> Discussion thread:
> https://github.com/apache/openjpa/pull/144#discussion_r3683001538)
> **(high)** The NULLS FIRST/LAST emulation finds the last order term with
> `sql.lastIndexOf(", ", termDirStart)`, so any ORDER BY expression containing
> a comma (e.g. `COALESCE(t0.x, 0) DESC`) is split mid-argument-list and the
> rewrite produces corrupt SQL; duplicating the expression also duplicates `?`
> markers without duplicating bound parameters. The block is triplicated in
> MariaDBDictionary (~575) and SQLServerDictionary (~484) - can it be extracted
> to a shared helper operating on the order term before it is appended to the
> buffer instead of string-parsing it back out?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)