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

Make LIMIT 0 return no rows. LIMIT -1 still returns all rows. Ticket #346. (CVS 1053)

FossilOrigin-Name: a31d0bd90af7cc95f8e36ca8ece21515f872235e
This commit is contained in:
drh
2003-07-16 11:51:35 +00:00
parent ef0cae500d
commit a88dc3f629
5 changed files with 32 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.142 2003/07/16 02:19:38 drh Exp $
** $Id: select.c,v 1.143 2003/07/16 11:51:36 drh Exp $
*/
#include "sqliteInt.h"
@@ -2148,8 +2148,14 @@ int sqliteSelect(
** p->nLimit<0 then "LIMIT 0" show no rows at all.
** "LIMIT -1" always shows all rows. There is some
** contraversy about what the correct behavior should be.
**
** Note that up until this point, the nLimit and nOffset hold
** the numeric values of the limit and offset that appeared in
** the original SQL. After this code, the nLimit and nOffset hold
** the register number of counters used to track the limit and
** offset.
*/
if( p->nLimit<=0 ){
if( p->nLimit<0 ){
p->nLimit = -1;
}else{
int iMem = pParse->nMem++;