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 C856A26859 for ; Wed, 4 Jul 2018 13:18:04 -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 z5XkyuHsqca1 for ; Wed, 4 Jul 2018 13:18:04 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 838B8266C2 for ; Wed, 4 Jul 2018 13:18:04 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v1 2/2] sql: remove usless sqlite3NestedParse function Date: Wed, 4 Jul 2018 20:17:55 +0300 Message-Id: <444b91093cc6ea1648f0e8bdd9b0923694ca3f8a.1530724375.git.kshcherbatov@tarantool.org> In-Reply-To: References: In-Reply-To: References: 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: v.shpilevoy@tarantool.org, Kirill Shcherbatov As sqlite3NestedParse become totaly useless, let's remove unreacheble code and all mentioning. Resolves #3496. --- src/box/sql/build.c | 40 ---------------------------------------- src/box/sql/delete.c | 6 +----- src/box/sql/insert.c | 6 +----- src/box/sql/sqliteInt.h | 1 - src/box/sql/update.c | 6 +----- 5 files changed, 3 insertions(+), 56 deletions(-) diff --git a/src/box/sql/build.c b/src/box/sql/build.c index ac53906..573da9a 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -116,46 +116,6 @@ sql_finish_coding(struct Parse *parse_context) } } -/* - * Run the parser and code generator recursively in order to generate - * code for the SQL statement given onto the end of the pParse context - * currently under construction. When the parser is run recursively - * this way, the final OP_Halt is not appended and other initialization - * and finalization steps are omitted because those are handling by the - * outermost parser. - * - * Not everything is nestable. This facility is designed to perform - * basic DDL operations. Use care if you decide to try to use this routine - * for some other purposes. - */ -void -sqlite3NestedParse(Parse * pParse, const char *zFormat, ...) -{ - va_list ap; - char *zSql; - char *zErrMsg = 0; - sqlite3 *db = pParse->db; - char saveBuf[PARSE_TAIL_SZ]; - - if (pParse->nErr) - return; - assert(pParse->nested < 10); /* Nesting should only be of limited depth */ - va_start(ap, zFormat); - zSql = sqlite3VMPrintf(db, zFormat, ap); - va_end(ap); - if (zSql == 0) { - return; /* A malloc must have failed */ - } - pParse->nested++; - memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ); - memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); - sqlite3RunParser(pParse, zSql, &zErrMsg); - sqlite3DbFree(db, zErrMsg); - sqlite3DbFree(db, zSql); - memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ); - pParse->nested--; -} - /** * This is a function which should be called during execution * of sqlite3EndTable. It ensures that only PRIMARY KEY diff --git a/src/box/sql/delete.c b/src/box/sql/delete.c index 5a79971..5f78062 100644 --- a/src/box/sql/delete.c +++ b/src/box/sql/delete.c @@ -403,11 +403,7 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list, } } - /* Return the number of rows that were deleted. If this - * routine is generating code because of a call to - * sqlite3NestedParse(), do not invoke the callback - * function. - */ + /* Return the number of rows that were deleted. */ if ((user_session->sql_flags & SQLITE_CountRows) != 0 && parse->nested == 0 && parse->pTriggerTab != NULL) { sqlite3VdbeAddOp2(v, OP_ResultRow, reg_count, 1); diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c index c12043b..6ce5be7 100644 --- a/src/box/sql/insert.c +++ b/src/box/sql/insert.c @@ -904,11 +904,7 @@ sqlite3Insert(Parse * pParse, /* Parser context */ insert_end: - /* - * Return the number of rows inserted. If this routine is - * generating code because of a call to sqlite3NestedParse(), do not - * invoke the callback function. - */ + /* Return the number of rows inserted. */ if ((user_session->sql_flags & SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab) { sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h index a0a874c..7a3a3d1 100644 --- a/src/box/sql/sqliteInt.h +++ b/src/box/sql/sqliteInt.h @@ -4449,7 +4449,6 @@ void sqlite3AlterRenameTable(Parse *, SrcList *, Token *); int sql_token(const char *z, int *type, bool *is_reserved); -void sqlite3NestedParse(Parse *, const char *, ...); void sqlite3ExpirePreparedStatements(sqlite3 *); int sqlite3CodeSubselect(Parse *, Expr *, int); void sqlite3SelectPrep(Parse *, Select *, NameContext *); diff --git a/src/box/sql/update.c b/src/box/sql/update.c index 212adbc..3a5c6f0 100644 --- a/src/box/sql/update.c +++ b/src/box/sql/update.c @@ -625,11 +625,7 @@ sqlite3Update(Parse * pParse, /* The parser context */ } sqlite3VdbeResolveLabel(v, labelBreak); - /* - * Return the number of rows that were changed. If this routine is - * generating code because of a call to sqlite3NestedParse(), do not - * invoke the callback function. - */ + /* Return the number of rows that were changed. */ if ((user_session->sql_flags & SQLITE_CountRows) && !pParse->pTriggerTab && !pParse->nested) { sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); -- 2.7.4