From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0B5562E48A for ; Tue, 17 Apr 2018 16:50:12 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KNEV8pcvl3uQ for ; Tue, 17 Apr 2018 16:50:11 -0400 (EDT) Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id B6CD32E489 for ; Tue, 17 Apr 2018 16:50:11 -0400 (EDT) From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 1/1] sql: remove unused struct AutoinfInfo Date: Tue, 17 Apr 2018 23:50:07 +0300 Message-Id: <8824c72027064da22b146df01653b8da6277a7f9.1523998076.git.v.shpilevoy@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: korablev@tarantool.org --- Branch: https://github.com/tarantool/tarantool/tree/remove-autoincinfo I was trying to remove iAutoIncPKey from struct Table, but it appeared, that it can be not only 0. SQL allows to create autoincrement not only on a first field. During researching I have removed struct AutoinfInfo, so there is the patch. src/box/sql/build.c | 2 -- src/box/sql/sqliteInt.h | 16 ---------------- src/box/sql/tokenize.c | 5 ----- src/box/sql/trigger.c | 2 +- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/box/sql/build.c b/src/box/sql/build.c index c6185e41a..4aff123ac 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -119,8 +119,6 @@ sqlite3FinishCoding(Parse * pParse) /* A minimum of one cursor is required if autoincrement is used * See ticket [a696379c1f08866] */ - if (pParse->pAinc != 0 && pParse->nTab == 0) - pParse->nTab = 1; sqlite3VdbeMakeReady(v, pParse); pParse->rc = SQLITE_DONE; } else { diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h index 59662cf14..a49c636a2 100644 --- a/src/box/sql/sqliteInt.h +++ b/src/box/sql/sqliteInt.h @@ -1455,7 +1455,6 @@ void *sqlite3_wsd_find(void *K, int L); * Forward references to structures */ typedef struct AggInfo AggInfo; -typedef struct AutoincInfo AutoincInfo; typedef struct Bitvec Bitvec; typedef struct Column Column; typedef struct Schema Schema; @@ -2854,20 +2853,6 @@ struct SelectDest { ExprList *pOrderBy; /* Key columns for SRT_Queue and SRT_DistQueue */ }; -/* - * During code generation of statements that do inserts into AUTOINCREMENT - * tables, the following information is attached to the Table.u.autoInc.p - * pointer of each autoincrement table to record some side information that - * the code generator needs. We have to keep per-table autoincrement - * information in case inserts are done within triggers. Triggers do not - * normally coordinate their activities, but we do need to coordinate the - * loading and saving of autoincrement information. - */ -struct AutoincInfo { - AutoincInfo *pNext; /* Next info block in a list of them all */ - Table *pTab; /* Table this info block refers to */ -}; - /* * Size of the column cache */ @@ -2947,7 +2932,6 @@ struct Parse { int nSelect; /* Number of SELECT statements seen */ int nSelectIndent; /* How far to indent SELECTTRACE() output */ #endif - AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ Parse *pToplevel; /* Parse structure for main program (or NULL) */ Table *pTriggerTab; /* Table triggers are being coded for */ u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ diff --git a/src/box/sql/tokenize.c b/src/box/sql/tokenize.c index 2894f8d7e..c77aa9bcf 100644 --- a/src/box/sql/tokenize.c +++ b/src/box/sql/tokenize.c @@ -639,11 +639,6 @@ sqlite3RunParser(Parse * pParse, const char *zSql, char **pzErrMsg) sqlite3WithDelete(db, pParse->pWithToFree); sqlite3DeleteTrigger(db, pParse->pNewTrigger); sqlite3DbFree(db, pParse->pVList); - while (pParse->pAinc) { - AutoincInfo *p = pParse->pAinc; - pParse->pAinc = p->pNext; - sqlite3DbFree(db, p); - } while (pParse->pZombieTab) { Table *p = pParse->pZombieTab; pParse->pZombieTab = p->pNextZombie; diff --git a/src/box/sql/trigger.c b/src/box/sql/trigger.c index ed7b948ab..28c56db3a 100644 --- a/src/box/sql/trigger.c +++ b/src/box/sql/trigger.c @@ -932,7 +932,7 @@ codeRowTrigger(Parse * pParse, /* Current parse context */ sqlite3VdbeDelete(v); } - assert(!pSubParse->pAinc && !pSubParse->pZombieTab); + assert(!pSubParse->pZombieTab); assert(!pSubParse->pTriggerPrg && !pSubParse->nMaxArg); sqlite3ParserReset(pSubParse); sqlite3StackFree(db, pSubParse); -- 2.15.1 (Apple Git-101)