[tarantool-patches] [PATCH] sql: remove nKey from struct BtCursor
Nikita Pettik
korablev at tarantool.org
Fri Oct 26 17:59:26 MSK 2018
nKey member (indicating number of parts in key) now is used only for
COUNT routine. On the other hand, it is always equal to 0 (as well as
key is really NULL). Hence, nothing prevents us from removing this
field at all.
---
https://github.com/tarantool/tarantool/tree/np/remove-nkey-from-cursor
src/box/sql.c | 7 ++-----
src/box/sql/cursor.h | 1 -
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/box/sql.c b/src/box/sql.c
index c7b87e57a..9d58b8fcf 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -340,8 +340,7 @@ int tarantoolSqlite3EphemeralCount(struct BtCursor *pCur, i64 *pnEntry)
assert(pCur->curFlags & BTCF_TEphemCursor);
struct index *primary_index = space_index(pCur->space, 0 /* PK */);
- *pnEntry = index_count(primary_index, pCur->iter_type, pCur->key,
- pCur->nKey);
+ *pnEntry = index_count(primary_index, pCur->iter_type, 0, 0);
return SQLITE_OK;
}
@@ -349,8 +348,7 @@ int tarantoolSqlite3Count(BtCursor *pCur, i64 *pnEntry)
{
assert(pCur->curFlags & BTCF_TaCursor);
- *pnEntry = index_count(pCur->index, pCur->iter_type, pCur->key,
- pCur->nKey);
+ *pnEntry = index_count(pCur->index, pCur->iter_type, 0, 0);
return SQLITE_OK;
}
@@ -1031,7 +1029,6 @@ key_alloc(BtCursor *cur, size_t key_size)
}
cur->key = new_key;
}
- cur->nKey = key_size;
return 0;
}
diff --git a/src/box/sql/cursor.h b/src/box/sql/cursor.h
index da711a7de..d40ca87c8 100644
--- a/src/box/sql/cursor.h
+++ b/src/box/sql/cursor.h
@@ -41,7 +41,6 @@ typedef struct BtCursor BtCursor;
* for ordinary space, or to TEphemCursor for ephemeral space.
*/
struct BtCursor {
- i64 nKey; /* Size of pKey, or last integer key */
u8 curFlags; /* zero or more BTCF_* flags defined below */
u8 eState; /* One of the CURSOR_XXX constants (see below) */
u8 hints; /* As configured by CursorSetHints() */
--
2.15.1
More information about the Tarantool-patches
mailing list