Tarantool development patches archive
 help / color / mirror / Atom feed
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 v6 1/4] sql: fix code style in sqlite3Pragma
Date: Tue, 15 May 2018 20:03:18 +0300	[thread overview]
Message-ID: <b5dd9a6a65d398d291675d7c0e535d7d31df6d10.1526403792.git.kshcherbatov@tarantool.org> (raw)
In-Reply-To: <cover.1526403792.git.kshcherbatov@tarantool.org>
In-Reply-To: <cover.1526403792.git.kshcherbatov@tarantool.org>

---
 src/box/sql/pragma.c | 54 ++++++++++++++++++++++++----------------------------
 1 file changed, 25 insertions(+), 29 deletions(-)

diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index e41f69b..2f2878b 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -544,37 +544,33 @@ 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;
+		Table *pTab = sqlite3HashFind(&db->pSchema->tblHash, zRight);
+		if (pTab == NULL)
 			break;
+		FKey *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

  reply	other threads:[~2018-05-15 17:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 17:03 [tarantool-patches] [PATCH v6 0/4] sql: moved Checks to server Kirill Shcherbatov
2018-05-15 17:03 ` Kirill Shcherbatov [this message]
2018-05-15 17:03 ` [tarantool-patches] [PATCH v6 2/4] sql: remove SQL fields from Table and Column Kirill Shcherbatov
2018-05-17 17:25   ` [tarantool-patches] " n.pettik
2018-05-18 15:35     ` Kirill Shcherbatov
2018-05-18 17:24       ` n.pettik
2018-05-18 19:45         ` Kirill Shcherbatov
2018-05-18 20:13           ` n.pettik
2018-05-15 17:03 ` [tarantool-patches] [PATCH v6 3/4] sql: space_def* instead of Table* in Expr Kirill Shcherbatov
2018-05-16 12:33   ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-16 13:10     ` Kirill Shcherbatov
2018-05-16 13:11       ` Vladislav Shpilevoy
     [not found]   ` <26E4269B-2BCB-42C3-8216-D51E290E4723@corp.mail.ru>
2018-05-18 15:26     ` Kirill Shcherbatov
2018-05-18 17:04       ` n.pettik
2018-05-21 12:48       ` [tarantool-patches] " Nikita Pettik
2018-05-15 17:03 ` [tarantool-patches] [PATCH v6 4/4] sql: remove Checks to server Kirill Shcherbatov
2018-05-16 17:59   ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-16 11:52 ` [tarantool-patches] Re: [PATCH v6 0/4] sql: moved " Vladislav Shpilevoy
2018-05-16 13:13   ` Kirill Shcherbatov
2018-05-23  5:19 ` 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=b5dd9a6a65d398d291675d7c0e535d7d31df6d10.1526403792.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v6 1/4] 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