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 3803222E5B for ; Wed, 25 Apr 2018 12:52:28 -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 vLzWC6OL2JlV for ; Wed, 25 Apr 2018 12:52:28 -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 7F27922E54 for ; Wed, 25 Apr 2018 12:52:27 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v3 1/4] sql: Fix code style in sqlite3Pragma. Date: Wed, 25 Apr 2018 19:52:20 +0300 Message-Id: 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 --- src/box/sql/pragma.c | 56 +++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c index e41f69b..4a68cad 100644 --- a/src/box/sql/pragma.c +++ b/src/box/sql/pragma.c @@ -544,37 +544,35 @@ sqlite3Pragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */ #ifndef SQLITE_OMIT_FOREIGN_KEY case PragTyp_FOREIGN_KEY_LIST:{ - if (zRight) { - FKey *pFK; - Table *pTab; - pTab = sqlite3HashFind(&db->pSchema->tblHash, - zRight); - if (pTab != NULL) { - pFK = pTab->pFKey; - if (pFK) { - int i = 0; - pParse->nMem = 8; - while (pFK) { - int j; - for (j = 0; - j < pFK->nCol; - j++) { - sqlite3VdbeMultiLoad(v, 1, "iissssss", i, j, pFK->zTo, pTab->aCol[pFK->aCol[j].iFrom].zName, pFK->aCol[j].zCol, actionName(pFK->aAction[1]), /* ON UPDATE */ - actionName(pFK->aAction[0]), /* ON DELETE */ - "NONE"); - sqlite3VdbeAddOp2 - (v, - OP_ResultRow, - 1, 8); - } - ++i; - pFK = pFK->pNextFrom; - } - } - } - } + if (!zRight) + break; + FKey *pFK; + Table *pTab; + pTab = sqlite3HashFind(&db->pSchema->tblHash, zRight); + if (pTab == NULL) break; + pFK = pTab->pFKey; + if (!pFK) + break; + int i = 0; + pParse->nMem = 8; + while (pFK) { + for (int j = 0; j < pFK->nCol; j++) { + const char *name = + pTab->aCol[pFK->aCol[j].iFrom].zName; + sqlite3VdbeMultiLoad(v, 1, "iissssss", i, j, + pFK->zTo, name, + pFK->aCol[j].zCol, + actionName(pFK->aAction[1]), + actionName(pFK->aAction[0]), + "NONE"); + sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8); + } + ++i; + pFK = pFK->pNextFrom; } + break; + } #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */ #ifndef SQLITE_OMIT_FOREIGN_KEY -- 2.7.4