Tarantool development patches archive
 help / color / mirror / Atom feed
From: AlexeyIvushkin <ivushkinalex@gmail.com>
To: tarantool-patches@freelists.org
Cc: Morgan-iv <ivushkinalex@gmail.com>
Subject: [tarantool-patches] [PATCH 2/2] sql: remove unused SQLITE_CONSTRAINT_ error codes
Date: Tue,  2 Oct 2018 23:50:35 +0300	[thread overview]
Message-ID: <160387838b78fe8387a9896f34140a66b887a4f4.1538511704.git.ivushkinalex@gmail.com> (raw)
In-Reply-To: <cover.1538511704.git.ivushkinalex@gmail.com>
In-Reply-To: <cover.1538511704.git.ivushkinalex@gmail.com>

From: Morgan-iv <ivushkinalex@gmail.com>

Remove SQLITE_CONSTRAINT_ error codes that only defined, but don't used
anywhere. Change its implementation from define macro to enum statement.

Part of #3315
---
 src/box/sql/main.c      |  9 ---------
 src/box/sql/sqliteInt.h | 13 ++++++-------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/box/sql/main.c b/src/box/sql/main.c
index 532d324..885cdcc 100644
--- a/src/box/sql/main.c
+++ b/src/box/sql/main.c
@@ -826,9 +826,6 @@ sqlite3ErrName(int rc)
 		case SQLITE_CONSTRAINT:
 			zName = "SQLITE_CONSTRAINT";
 			break;
-		case SQLITE_CONSTRAINT_UNIQUE:
-			zName = "SQLITE_CONSTRAINT_UNIQUE";
-			break;
 		case SQLITE_CONSTRAINT_TRIGGER:
 			zName = "SQLITE_CONSTRAINT_TRIGGER";
 			break;
@@ -838,15 +835,9 @@ sqlite3ErrName(int rc)
 		case SQLITE_CONSTRAINT_CHECK:
 			zName = "SQLITE_CONSTRAINT_CHECK";
 			break;
-		case SQLITE_CONSTRAINT_PRIMARYKEY:
-			zName = "SQLITE_CONSTRAINT_PRIMARYKEY";
-			break;
 		case SQLITE_CONSTRAINT_NOTNULL:
 			zName = "SQLITE_CONSTRAINT_NOTNULL";
 			break;
-		case SQLITE_CONSTRAINT_FUNCTION:
-			zName = "SQLITE_CONSTRAINT_FUNCTION";
-			break;
 		case SQLITE_MISMATCH:
 			zName = "SQLITE_MISMATCH";
 			break;
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 00c0309..5c031e1 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -619,13 +619,12 @@ enum sql_ioerr_code {
 	SQLITE_IOERR_GETTEMPPATH       = (SQLITE_IOERR | (11<<8))
 };
 
-#define SQLITE_CONSTRAINT_CHECK        (SQLITE_CONSTRAINT | (1<<8))
-#define SQLITE_CONSTRAINT_FOREIGNKEY   (SQLITE_CONSTRAINT | (3<<8))
-#define SQLITE_CONSTRAINT_FUNCTION     (SQLITE_CONSTRAINT | (4<<8))
-#define SQLITE_CONSTRAINT_NOTNULL      (SQLITE_CONSTRAINT | (5<<8))
-#define SQLITE_CONSTRAINT_PRIMARYKEY   (SQLITE_CONSTRAINT | (6<<8))
-#define SQLITE_CONSTRAINT_TRIGGER      (SQLITE_CONSTRAINT | (7<<8))
-#define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))
+enum sql_constrant_code {
+	SQLITE_CONSTRAINT_CHECK        = (SQLITE_CONSTRAINT | (1<<8)),
+	SQLITE_CONSTRAINT_FOREIGNKEY   = (SQLITE_CONSTRAINT | (2<<8)),
+	SQLITE_CONSTRAINT_NOTNULL      = (SQLITE_CONSTRAINT | (3<<8)),
+	SQLITE_CONSTRAINT_TRIGGER      = (SQLITE_CONSTRAINT | (4<<8))
+};
 
 enum sql_type {
 	SQLITE_INTEGER = 1,
-- 
2.7.4

  parent reply	other threads:[~2018-10-02 20:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 20:50 [tarantool-patches] [PATCH 0/2] First part of SQLite error codes refactoring AlexeyIvushkin
2018-10-02 20:50 ` [tarantool-patches] [PATCH] box: add tuple:size function AlexeyIvushkin
2018-10-02 20:50 ` [tarantool-patches] [PATCH 1/2] sql: refactor SQLITE_IOERR_ error codes AlexeyIvushkin
2018-10-03 20:06   ` [tarantool-patches] " Vladislav Shpilevoy
2018-10-02 20:50 ` AlexeyIvushkin [this message]
2018-10-03 20:07   ` [tarantool-patches] Re: [PATCH 2/2] sql: remove unused SQLITE_CONSTRAINT_ " Vladislav Shpilevoy
2018-10-03 20:04 ` [tarantool-patches] Re: [PATCH 0/2] First part of SQLite error codes refactoring Vladislav Shpilevoy

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=160387838b78fe8387a9896f34140a66b887a4f4.1538511704.git.ivushkinalex@gmail.com \
    --to=ivushkinalex@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 2/2] sql: remove unused SQLITE_CONSTRAINT_ error codes' \
    /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