From: Kirill Shcherbatov <kshcherbatov@tarantool.org> To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Kirill Shcherbatov <kshcherbatov@tarantool.org> Subject: [tarantool-patches] [PATCH v5 1/3] sql: fix code style in sqlite3Pragma Date: Fri, 11 May 2018 11:49:45 +0300 [thread overview] Message-ID: <a03e216746c96bcfae2c96c49da593de53059ccf.1526028449.git.kshcherbatov@tarantool.org> (raw) In-Reply-To: <cover.1526028449.git.kshcherbatov@tarantool.org> In-Reply-To: <cover.1526028449.git.kshcherbatov@tarantool.org> --- 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..b9038b7 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 == NULL) + break; + FKey *pFK; + Table *pTab; + pTab = sqlite3HashFind(&db->pSchema->tblHash, zRight); + if (pTab == NULL) break; + pFK = pTab->pFKey; + if (pFK == NULL) + break; + int i = 0; + pParse->nMem = 8; + while (pFK != NULL) { + 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
next prev parent reply other threads:[~2018-05-11 8:49 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-11 8:49 [tarantool-patches] [PATCH v5 0/3] sql: refactor SQL Parser structures Kirill Shcherbatov 2018-05-11 8:49 ` Kirill Shcherbatov [this message] 2018-05-11 20:59 ` [tarantool-patches] Re: [PATCH v5 1/3] sql: fix code style in sqlite3Pragma Vladislav Shpilevoy 2018-05-11 8:49 ` [tarantool-patches] [PATCH v5 2/3] sql: remove SQL fields from Table and Column Kirill Shcherbatov 2018-05-11 20:59 ` [tarantool-patches] " Vladislav Shpilevoy 2018-05-14 11:20 ` Kirill Shcherbatov 2018-05-14 13:39 ` Vladislav Shpilevoy 2018-05-15 15:56 ` Kirill Shcherbatov 2018-05-11 8:49 ` [tarantool-patches] [PATCH v5 3/3] sql: space_def* instead of Table* in Expr Kirill Shcherbatov 2018-05-11 20:59 ` [tarantool-patches] " Vladislav Shpilevoy 2018-05-14 11:20 ` Kirill Shcherbatov 2018-05-11 8:58 ` [tarantool-patches] Re: [PATCH v5 0/3] sql: refactor SQL Parser structures Vladislav Shpilevoy 2018-05-11 19:40 ` [tarantool-patches] Re[2]: [tarantool-patches] " Kirill Shcherbatov
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=a03e216746c96bcfae2c96c49da593de53059ccf.1526028449.git.kshcherbatov@tarantool.org \ --to=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH v5 1/3] sql: fix code style in sqlite3Pragma' \ /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