mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-03-10 00:20:54 +08:00
SELECT ... LIMIT 0 should return no rows, not all rows
This commit is contained in:
@@ -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++;
|
||||||
|
|||||||
Reference in New Issue
Block a user