-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug: DelayedLoadRelations uses inconsistent quoting for string-litera…
…ls. (#95) * Bug: DelayedLoadRelations uses inconsistent quoting for string-literals. If using HQL on an Entity that is implicitly joined to other Entities via @OnetoOne, @onetomany, @manytoone, or @manytomany, and an ID value has a single-quote (') in it, the HQL-escaping ('') is not unescaped, and it gets escaped into the dialect, resulting in (\\'\\'), and a query that fails to join. Example debug statements: === [trace] session.d:1207:delayedLoadRelations unknownKeys = [Bucky O'Hare] [trace] session.d:1208:delayedLoadRelations createCommaSeparatedKeyList(unknownKeys) = 'Bucky O''Hare' extra quote is being added here ^ [trace] session.d:1290:listObjects SQL: SELECT _t1.contract_code, ... FROM finance_contract_refs AS _t1 WHERE _t1.contract_code IN ( 'Bucky O\\'\\'Hare') === The fix is to modify the HQL Parser to unescape ('') as ('), and then let specific dialects re-escape the ('). PostgreSQL, by default, does not support C-style escape characters unless quoted as E'hello\nthere\n' (note the leading (E)). However, all dialects support the SQL standard ('') syntax. * Remove debug output. * Add another quoting test with the string literal directly in the query rather than a parameter.
- Loading branch information
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,7 +266,6 @@ struct ManyToMany { | |
immutable string joinColumn2; | ||
} | ||
|
||
|
||
unittest { | ||
@Entity | ||
@Table("user") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters