@@ -1450,42 +1450,36 @@ void hqlQueries() {
1450
1450
@ Test // GH-2962
1451
1451
void orderByWithNullsFirstOrLastShouldWork () {
1452
1452
1453
- assertThatNoException ().isThrownBy (() -> {
1454
- parseWithoutChanges ("""
1455
- select a,
1456
- case
1457
- when a.geaendertAm is null then a.erstelltAm
1458
- else a.geaendertAm end as mutationAm
1459
- from Element a
1460
- where a.erstelltDurch = :variable
1461
- order by mutationAm desc nulls first
1462
- """ );
1463
- });
1464
-
1465
- assertThatNoException ().isThrownBy (() -> {
1466
- parseWithoutChanges ("""
1467
- select a,
1468
- case
1469
- when a.geaendertAm is null then a.erstelltAm
1470
- else a.geaendertAm end as mutationAm
1471
- from Element a
1472
- where a.erstelltDurch = :variable
1473
- order by mutationAm desc nulls last
1453
+ assertQuery ("""
1454
+ select a,
1455
+ case
1456
+ when a.geaendertAm is null then a.erstelltAm
1457
+ else a.geaendertAm end as mutationAm
1458
+ from Element a
1459
+ where a.erstelltDurch = :variable
1460
+ order by mutationAm desc nulls first
1461
+ """ );
1462
+
1463
+ assertQuery ("""
1464
+ select a,
1465
+ case
1466
+ when a.geaendertAm is null then a.erstelltAm
1467
+ else a.geaendertAm end as mutationAm
1468
+ from Element a
1469
+ where a.erstelltDurch = :variable
1470
+ order by mutationAm desc nulls last
1474
1471
""" );
1475
- });
1476
1472
}
1477
1473
1478
1474
@ Test // GH-2964
1479
1475
void roundFunctionShouldWorkLikeAnyOtherFunction () {
1480
1476
1481
- assertThatNoException ().isThrownBy (() -> {
1482
- parseWithoutChanges ("""
1483
- select round(count(ri) * 100 / max(ri.receipt.positions), 0) as perc
1484
- from StockOrderItem oi
1485
- right join StockReceiptItem ri
1486
- on ri.article = oi.article
1487
- """ );
1488
- });
1477
+ assertQuery ("""
1478
+ select round(count(ri)*100/max(ri.receipt.positions), 0) as perc
1479
+ from StockOrderItem oi
1480
+ right join StockReceiptItem ri
1481
+ on ri.article = oi.article
1482
+ """ );
1489
1483
}
1490
1484
1491
1485
@ Test // GH-2981
@@ -1605,4 +1599,40 @@ void newShouldBeLegalAsPartOfAStateFieldPathExpression() {
1605
1599
void powerShouldBeLegalInAQuery () {
1606
1600
assertQuery ("select e.power.id from MyEntity e" );
1607
1601
}
1602
+
1603
+ @ Test // GH-3136
1604
+ void doublePipeShouldBeValidAsAStringConcatOperator () {
1605
+
1606
+ assertQuery ("""
1607
+ select e.name || ' ' || e.title
1608
+ from Employee e
1609
+ """ );
1610
+ }
1611
+
1612
+ @ Test // GH-3136
1613
+ void additionalStringOperationsShouldWork () {
1614
+
1615
+ assertQuery ("""
1616
+ select
1617
+ replace(e.name, 'Baggins', 'Proudfeet'),
1618
+ left(e.role, 4),
1619
+ right(e.home, 5),
1620
+ cast(e.distance_from_home, int)
1621
+ from Employee e
1622
+ """ );
1623
+ }
1624
+
1625
+ @ Test // GH-3136
1626
+ void combinedSelectStatementsShouldWork () {
1627
+
1628
+ assertQuery ("""
1629
+ select e from Employee e where e.last_name = 'Baggins'
1630
+ intersect
1631
+ select e from Employee e where e.first_name = 'Samwise'
1632
+ union
1633
+ select e from Employee e where e.home = 'The Shire'
1634
+ except
1635
+ select e from Employee e where e.home = 'Isengard'
1636
+ """ );
1637
+ }
1608
1638
}
0 commit comments