Merge pull request #18 from nyalldawson/fix_limit

Fix LIMIT clause is ignored when executing SQL via ODBC, incorrect behavior with LIMIT 0
This commit is contained in:
Evan Miller
2020-08-18 07:02:00 -04:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@@ -590,7 +590,7 @@ void mdb_sql_reset(MdbSQL *sql)
sql->sel_count = 0;
sql->max_rows = -1;
sql->row_count = 0;
sql->limit = 0;
sql->limit = -1;
}
static void print_break(int sz, int first)
{
@@ -886,7 +886,7 @@ mdb_sql_fetch_row(MdbSQL *sql, MdbTableDef *table)
{
int rc = mdb_fetch_row(table);
if (rc) {
if (sql->row_count + 1 > sql->limit) {
if (sql->limit >= 0 && sql->row_count + 1 > sql->limit) {
return 0;
}
sql->row_count++;