File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed
Sources/StructuredQueriesCore
Tests/StructuredQueriesTests Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -275,11 +275,9 @@ extension QueryExpression where QueryValue: _OptionalProtocol {
275275 public func map< T> (
276276 _ transform: ( SQLQueryExpression < QueryValue . Wrapped > ) -> some QueryExpression < T >
277277 ) -> some QueryExpression < T ? > {
278- SQLQueryExpression (
279- """
280- IIF( \( self ) , \( transform ( SQLQueryExpression ( queryFragment) ) ) , NULL)
281- """
282- )
278+ Case ( SQLQueryExpression ( " \( self ) IS NULL " ) )
279+ . when ( SQLQueryExpression ( " 1 " ) , then: SQLQueryExpression ( " NULL " ) )
280+ . else ( SQLQueryExpression ( transform ( SQLQueryExpression ( queryFragment) ) . queryFragment) )
283281 }
284282
285283 /// Creates a new optional expression from this one by applying an unwrapped version of this
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ extension SnapshotTests {
2929 }
3030 ) {
3131 """
32- SELECT IIF( " optionalIntegers " . " value " , " increment " ( " optionalIntegers " . " value " ), NULL)
32+ SELECT CASE " optionalIntegers " . " value " IS NULL WHEN 1 THEN NULL ELSE " increment " ( " optionalIntegers " . " value " ) END
3333 FROM " optionalIntegers "
3434 """
3535 } results: {
Original file line number Diff line number Diff line change @@ -1369,7 +1369,7 @@ extension SnapshotTests {
13691369 }
13701370 assertQuery ( query) {
13711371 """
1372- SELECT ( " reminders " . " priority " ) < (3)
1372+ SELECT CASE " reminders " . " priority " IS NULL WHEN 1 THEN NULL ELSE (" reminders " . " priority " ) < (3) END
13731373 FROM " reminders "
13741374 """
13751375 } results: {
You can’t perform that action at this time.
0 commit comments