@@ -124,7 +124,7 @@ public function analyse(): AnalyserResult
124
124
[
125
125
new AnalyserError (
126
126
"Unsupported query: {$ this ->queryAst ::getQueryType ()->value }" ,
127
- AnalyserErrorTypeEnum::UNSUPPORTED_FEATURE ,
127
+ AnalyserErrorTypeEnum::MARIA_STAN_UNSUPPORTED_FEATURE ,
128
128
),
129
129
],
130
130
null ,
@@ -176,7 +176,7 @@ private function dispatchAnalyseSelectQuery(SelectQuery $select): array
176
176
assert (is_string ($ typeVal ));
177
177
$ this ->errors [] = new AnalyserError (
178
178
"Unhandled SELECT type {$ typeVal }" ,
179
- AnalyserErrorTypeEnum::UNSUPPORTED_FEATURE ,
179
+ AnalyserErrorTypeEnum::MARIA_STAN_UNSUPPORTED_FEATURE ,
180
180
);
181
181
182
182
return [[], null ];
@@ -192,7 +192,7 @@ private function analyseWithSelectQuery(WithSelectQuery $select): array
192
192
if ($ select ->allowRecursive ) {
193
193
$ this ->errors [] = new AnalyserError (
194
194
"WITH RECURSIVE is not currently supported. There may be false positives! " ,
195
- AnalyserErrorTypeEnum::UNSUPPORTED_FEATURE ,
195
+ AnalyserErrorTypeEnum::MARIA_STAN_UNSUPPORTED_FEATURE ,
196
196
);
197
197
}
198
198
@@ -542,7 +542,7 @@ private function analyseTableReference(TableReference $fromClause, ColumnResolve
542
542
default :
543
543
$ this ->errors [] = new AnalyserError (
544
544
'Unhandled table reference type ' . $ fromClause ::getTableReferenceType ()->value ,
545
- AnalyserErrorTypeEnum::UNSUPPORTED_FEATURE ,
545
+ AnalyserErrorTypeEnum::MARIA_STAN_UNSUPPORTED_FEATURE ,
546
546
);
547
547
break ;
548
548
}
@@ -1288,6 +1288,12 @@ private function resolveExprType(Expr\Expr $expr, ?AnalyserConditionTypeEnum $co
1288
1288
$ knowledgeBase = $ leftResult ->knowledgeBase ->and ($ rightResult ->knowledgeBase );
1289
1289
}
1290
1290
1291
+ if ($ expr ->right instanceof Expr \Subquery) {
1292
+ if ($ this ->hasLimitClause ($ expr ->right ->query )) {
1293
+ $ this ->errors [] = AnalyserErrorBuilder::createNoLimitInsideIn ();
1294
+ }
1295
+ }
1296
+
1291
1297
return new ExprTypeResult (
1292
1298
new Schema \DbType \IntType (),
1293
1299
$ leftResult ->isNullable || $ rightResult ->isNullable ,
@@ -1345,7 +1351,7 @@ private function resolveExprType(Expr\Expr $expr, ?AnalyserConditionTypeEnum $co
1345
1351
if ($ functionInfo === null ) {
1346
1352
$ this ->errors [] = new AnalyserError (
1347
1353
"Unhandled function: {$ expr ->getFunctionName ()}" ,
1348
- AnalyserErrorTypeEnum::UNSUPPORTED_FEATURE ,
1354
+ AnalyserErrorTypeEnum::MARIA_STAN_UNSUPPORTED_FEATURE ,
1349
1355
);
1350
1356
}
1351
1357
@@ -1472,7 +1478,7 @@ private function resolveExprType(Expr\Expr $expr, ?AnalyserConditionTypeEnum $co
1472
1478
default :
1473
1479
$ this ->errors [] = new AnalyserError (
1474
1480
"Unhandled expression type: {$ expr ::getExprType ()->value }" ,
1475
- AnalyserErrorTypeEnum::UNSUPPORTED_FEATURE ,
1481
+ AnalyserErrorTypeEnum::MARIA_STAN_UNSUPPORTED_FEATURE ,
1476
1482
);
1477
1483
1478
1484
return new ExprTypeResult (
@@ -1690,4 +1696,25 @@ private function runWithDifferentFieldBehavior(ColumnResolverFieldBehaviorEnum $
1690
1696
$ this ->fieldBehavior = $ bak ;
1691
1697
}
1692
1698
}
1699
+
1700
+ private function hasLimitClause (SelectQuery $ selectQuery ): bool
1701
+ {
1702
+ switch ($ selectQuery ::getSelectQueryType ()) {
1703
+ case SelectQueryTypeEnum::SIMPLE :
1704
+ assert ($ selectQuery instanceof SimpleSelectQuery);
1705
+
1706
+ return $ selectQuery ->limit !== null ;
1707
+ case SelectQueryTypeEnum::WITH :
1708
+ assert ($ selectQuery instanceof WithSelectQuery);
1709
+
1710
+ return $ this ->hasLimitClause ($ selectQuery ->selectQuery );
1711
+ case SelectQueryTypeEnum::TABLE_VALUE_CONSTRUCTOR :
1712
+ return false ;
1713
+ case SelectQueryTypeEnum::COMBINED :
1714
+ assert ($ selectQuery instanceof CombinedSelectQuery);
1715
+
1716
+ return $ selectQuery ->limit !== null || $ this ->hasLimitClause ($ selectQuery ->left )
1717
+ || $ this ->hasLimitClause ($ selectQuery ->right );
1718
+ }
1719
+ }
1693
1720
}
0 commit comments