mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
SELECT ... LIMIT 0 should return no rows, not all rows
This commit is contained in:
parent
4e3ed3a5fd
commit
083ec7f9e4
@ -590,7 +590,7 @@ void mdb_sql_reset(MdbSQL *sql)
|
|||||||
sql->sel_count = 0;
|
sql->sel_count = 0;
|
||||||
sql->max_rows = -1;
|
sql->max_rows = -1;
|
||||||
sql->row_count = 0;
|
sql->row_count = 0;
|
||||||
sql->limit = 0;
|
sql->limit = -1;
|
||||||
}
|
}
|
||||||
static void print_break(int sz, int first)
|
static void print_break(int sz, int first)
|
||||||
{
|
{
|
||||||
@ -883,7 +883,7 @@ mdb_sql_fetch_row(MdbSQL *sql, MdbTableDef *table)
|
|||||||
{
|
{
|
||||||
int rc = mdb_fetch_row(table);
|
int rc = mdb_fetch_row(table);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
if (sql->row_count + 1 > sql->limit) {
|
if (sql->limit >= 0 && sql->row_count + 1 > sql->limit) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sql->row_count++;
|
sql->row_count++;
|
||||||
|
Loading…
Reference in New Issue
Block a user