1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Add the SQLITE_MAX_COMPOUND_SELECT compile-time parameter for limiting

the number of terms in a compound select statement.  Set the default limit
to 100. (CVS 4046)

FossilOrigin-Name: 0d71ad4591eae9de8749fb2da6455ac661587f7a
This commit is contained in:
drh
2007-06-07 10:55:35 +00:00
parent 39984cdc8b
commit 0325d8731b
6 changed files with 57 additions and 16 deletions

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.349 2007/05/31 08:20:44 danielk1977 Exp $
** $Id: select.c,v 1.350 2007/06/07 10:55:36 drh Exp $
*/
#include "sqliteInt.h"
@@ -2870,9 +2870,14 @@ int sqlite3Select(
if( p->pPrior ){
if( p->pRightmost==0 ){
Select *pLoop;
for(pLoop=p; pLoop; pLoop=pLoop->pPrior){
int cnt = 0;
for(pLoop=p; pLoop; pLoop=pLoop->pPrior, cnt++){
pLoop->pRightmost = p;
}
if( SQLITE_MAX_COMPOUND_SELECT>0 && cnt>SQLITE_MAX_COMPOUND_SELECT ){
sqlite3ErrorMsg(pParse, "too many terms in compound SELECT");
return 1;
}
}
return multiSelect(pParse, p, eDest, iParm, aff);
}