[tarantool-patches] [PATCH 1/7] sql: remove struct schema from struct Table

Nikita Pettik korablev at tarantool.org
Fri Aug 24 01:55:47 MSK 2018


Part of #3561
---
 src/box/sql/build.c     | 7 ++-----
 src/box/sql/select.c    | 2 +-
 src/box/sql/sqliteInt.h | 1 -
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index dc00b5d8c..47fa7c305 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -392,8 +392,6 @@ sqlite3PrimaryKeyIndex(Table * pTab)
 static Table *
 sql_table_new(Parse *parser, char *name)
 {
-	sqlite3 *db = parser->db;
-
 	struct Table *table = sql_ephemeral_table_new(parser, name);
 	if (table == NULL)
 		return NULL;
@@ -401,7 +399,6 @@ sql_table_new(Parse *parser, char *name)
 	strcpy(table->def->engine_name,
 	       sql_storage_engine_strs[current_session()->sql_default_engine]);
 
-	table->pSchema = db->pSchema;
 	table->nTabRef = 1;
 	return table;
 }
@@ -1650,8 +1647,8 @@ sqlite3EndTable(Parse * pParse,	/* Parse context */
 		 * Add the table to the in-memory representation
 		 * of the database.
 		 */
-		struct Table *pOld = sqlite3HashInsert(&p->pSchema->tblHash,
-							p->def->name, p);
+		struct Table *pOld = sqlite3HashInsert(&db->pSchema->tblHash,
+						       p->def->name, p);
 		if (pOld != NULL) {
 			assert(p == pOld);
 			sqlite3OomFault(db);
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index d22f4e0a9..12f55cedf 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -1672,7 +1672,7 @@ columnTypeImpl(NameContext * pNC, Expr * pExpr
 					    columnType(&sNC, p, &zOrigTab,
 						       &zOrigCol);
 				}
-			} else if (pTab->pSchema) {
+			} else {
 				/* A real table */
 				assert(!pS);
 				assert(iCol >= 0 &&
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index d2ef85846..35d3f4cec 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -1857,7 +1857,6 @@ struct Table {
 	 * can be fetched from space struct.
 	 */
 	LogEst tuple_log_count;
-	Schema *pSchema;	/* Schema that contains this table */
 	Table *pNextZombie;	/* Next on the Parse.pZombieTab list */
 	/** Space definition with Tarantool metadata. */
 	struct space_def *def;
-- 
2.15.1





More information about the Tarantool-patches mailing list