Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: korablev@tarantool.org
Subject: [tarantool-patches] [PATCH 1/1] sql: remove unused struct AutoinfInfo
Date: Tue, 17 Apr 2018 23:50:07 +0300	[thread overview]
Message-ID: <8824c72027064da22b146df01653b8da6277a7f9.1523998076.git.v.shpilevoy@tarantool.org> (raw)

---
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)

             reply	other threads:[~2018-04-17 20:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 20:50 Vladislav Shpilevoy [this message]
2018-04-18  5:50 ` [tarantool-patches] " Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8824c72027064da22b146df01653b8da6277a7f9.1523998076.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/1] sql: remove unused struct AutoinfInfo' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox