[tarantool-patches] [PATCH v1 10/28] sql: remove SQL_NOTFOUND error/status code
imeevma at tarantool.org
imeevma at tarantool.org
Mon Jun 10 16:56:41 MSK 2019
Removing this error/status code is part of getting rid of the SQL
error system.
---
src/box/sql/os_unix.c | 2 +-
src/box/sql/sqlInt.h | 2 --
src/box/sql/where.c | 14 ++------------
3 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c
index 18e42e5..75263e3 100644
--- a/src/box/sql/os_unix.c
+++ b/src/box/sql/os_unix.c
@@ -1047,7 +1047,7 @@ unixFileControl(sql_file * id, int op, void *pArg)
return rc;
}
}
- return SQL_NOTFOUND;
+ return -1;
}
/*
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index 17033eb..5bdec67 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -366,8 +366,6 @@ enum sql_ret_code {
SQL_NOMEM,
/** Some kind of disk I/O error occurred. */
SQL_IOERR,
- /** Unknown opcode in sql_file_control(). */
- SQL_NOTFOUND,
/** Insertion failed because database is full. */
SQL_FULL,
/** The database schema changed. */
diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index ab277c5..6781ab0 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -1526,22 +1526,14 @@ whereEqualScanEst(Parse * pParse, /* Parsing & code generating context */
assert(nEq >= 1);
assert(nEq <= (int) p->key_def->part_count);
- assert(pBuilder->nRecValid < nEq);
-
- /* If values are not available for all fields of the index to the left
- * of this one, no estimate can be made. Return SQL_NOTFOUND.
- */
- if (pBuilder->nRecValid < (nEq - 1)) {
- return SQL_NOTFOUND;
- }
+ assert(pBuilder->nRecValid == (nEq - 1));
rc = sqlStat4ProbeSetValue(pParse, p, &pRec, pExpr, 1, nEq - 1,
&bOk);
pBuilder->pRec = pRec;
if (rc != 0)
return rc;
- if (bOk == 0)
- return SQL_NOTFOUND;
+ assert(bOk != 0);
pBuilder->nRecValid = nEq;
whereKeyStats(pParse, p, pRec, 0, a);
@@ -2541,8 +2533,6 @@ whereLoopAddBtreeIndex(WhereLoopBuilder * pBuilder, /* The WhereLoop factory */
pExpr->x.pList,
&nOut);
}
- if (rc == SQL_NOTFOUND)
- rc = 0;
if (rc != 0)
break; /* Jump out of the pTerm loop */
if (nOut) {
--
2.7.4
More information about the Tarantool-patches
mailing list