Skip to content

Commit

Permalink
Merge pull request #46 from pharo-rdbms/order-by-patch
Browse files Browse the repository at this point in the history
Fix orderBy not accepting blocks
  • Loading branch information
gcotelli authored Sep 22, 2021
2 parents 37cb474 + 5c32cde commit e0ff6a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Glorp-Integration-Tests/GlorpQueryUnionTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ GlorpQueryUnionTest >> testCreateCompoundExpressionOnSQLite3 [
self
assert: compoundString
equals:
'SELECT DISTINCT * FROM ((SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
FROM GR_ADDRESS t1) UNION ALL (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
FROM GR_ADDRESS t1)) t1'
'SELECT DISTINCT * FROM (SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
FROM GR_ADDRESS t1 UNION ALL SELECT t1.ID, t1.STREET, t1.HOUSE_NUM
FROM GR_ADDRESS t1) t1'
]

{ #category : #'tests-unit' }
Expand Down
4 changes: 3 additions & 1 deletion Glorp/ToManyMapping.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ ToManyMapping >> buildQuery [
query := super buildQuery.
orderBy ifNotNil: [ orderBy do: [ :each || attr |
each isString
ifTrue: [ query orderBy: each asSymbol ]
ifTrue: [ query orderBy: each asSymbol ].
each isBlock
ifTrue: [ query orderBy: each ]
ifFalse: [
attr := targetDescriptor directMappingForField: each.
attr notNil ifTrue: [ query orderBy: attr attributeName ] ] ] ].
Expand Down

0 comments on commit e0ff6a1

Please sign in to comment.