Tarantool development patches archive
 help / color / mirror / Atom feed
From: AKhatskevich <avkhatskevich@tarantool.org>
To: korablev@tarantool.org, tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH 1/3] sql: delete unused code
Date: Tue,  2 Oct 2018 13:48:34 +0300	[thread overview]
Message-ID: <80b97605c05e8de841b476627ca52eda60d77b0e.1538476785.git.avkhatskevich@tarantool.org> (raw)
In-Reply-To: <cover.1538476785.git.avkhatskevich@tarantool.org>
In-Reply-To: <cover.1538476785.git.avkhatskevich@tarantool.org>

Part of #3696
---
 src/box/sql/main.c      | 291 ------------------------------------------------
 src/box/sql/sqliteInt.h |  15 ---
 2 files changed, 306 deletions(-)

diff --git a/src/box/sql/main.c b/src/box/sql/main.c
index 782f99452..3a01f1207 100644
--- a/src/box/sql/main.c
+++ b/src/box/sql/main.c
@@ -483,105 +483,6 @@ setupLookaside(sqlite3 * db, void *pBuf, int sz, int cnt)
 	return SQLITE_OK;
 }
 
-/*
- * Free up as much memory as we can from the given database
- * connection.
- */
-int
-sqlite3_db_release_memory(sqlite3 * db)
-{
-	(void)db;
-#ifdef SQLITE_ENABLE_API_ARMOR
-	if (!sqlite3SafetyCheckOk(db))
-		return SQLITE_MISUSE_BKPT;
-#endif
-	return SQLITE_OK;
-}
-
-/*
- * Flush any dirty pages in the pager-cache for any attached database
- * to disk.
- */
-int
-sqlite3_db_cacheflush(sqlite3 * db)
-{
-	int rc = SQLITE_OK;
-	int bSeenBusy = 0;
-	(void)db;
-#ifdef SQLITE_ENABLE_API_ARMOR
-	if (!sqlite3SafetyCheckOk(db))
-		return SQLITE_MISUSE_BKPT;
-#endif
-	return ((rc == SQLITE_OK && bSeenBusy) ? SQLITE_BUSY : rc);
-}
-
-/*
- * Configuration settings for an individual database connection
- */
-int
-sqlite3_db_config(sqlite3 * db, int op, ...)
-{
-	va_list ap;
-	int rc;
-	struct session *user_session = current_session();
-
-	va_start(ap, op);
-	switch (op) {
-	case SQLITE_DBCONFIG_LOOKASIDE:{
-			void *pBuf = va_arg(ap, void *);	/* IMP: R-26835-10964 */
-			int sz = va_arg(ap, int);	/* IMP: R-47871-25994 */
-			int cnt = va_arg(ap, int);	/* IMP: R-04460-53386 */
-			rc = setupLookaside(db, pBuf, sz, cnt);
-			break;
-		}
-	default:{
-			static const struct {
-				int op;	/* The opcode */
-				u32 mask;	/* Mask of the bit in sqlite3.flags to set/clear */
-			} aFlagOp[] = {
-				{
-				SQLITE_DBCONFIG_ENABLE_FKEY,
-					    SQLITE_ForeignKeys}, {
-				SQLITE_DBCONFIG_ENABLE_TRIGGER,
-					    SQLITE_EnableTrigger}, {
-			SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,
-					    SQLITE_NoCkptOnClose},};
-			unsigned int i;
-			rc = SQLITE_ERROR;	/* IMP: R-42790-23372 */
-			for (i = 0; i < ArraySize(aFlagOp); i++) {
-				if (aFlagOp[i].op == op) {
-					int onoff = va_arg(ap, int);
-					int *pRes = va_arg(ap, int *);
-					uint32_t oldFlags =
-					    user_session->sql_flags;
-					if (onoff > 0) {
-						user_session->sql_flags |=
-						    aFlagOp[i].mask;
-					} else if (onoff == 0) {
-						user_session->sql_flags &=
-						    ~aFlagOp[i].mask;
-					}
-					if (oldFlags != user_session->sql_flags) {
-						sqlite3ExpirePreparedStatements
-						    (db);
-					}
-					if (pRes) {
-						*pRes =
-						    (user_session->
-						     sql_flags & aFlagOp[i].
-						     mask) != 0;
-					}
-					rc = SQLITE_OK;
-					break;
-				}
-			}
-			break;
-		}
-	}
-	va_end(ap);
-	return rc;
-}
-
 /*
  * Return the number of changes in the most recent call to sqlite3_exec().
  */
@@ -712,12 +613,6 @@ sqlite3_close(sqlite3 * db)
 	return sqlite3Close(db, 0);
 }
 
-int
-sqlite3_close_v2(sqlite3 * db)
-{
-	return sqlite3Close(db, 1);
-}
-
 /*
  * Rollback all database files.  If tripCode is not SQLITE_OK, then
  * any write cursors are invalidated ("tripped" - as in "tripping a circuit
@@ -736,192 +631,6 @@ sqlite3RollbackAll(Vdbe * pVdbe)
 	}
 }
 
-/*
- * Return a static string containing the name corresponding to the error code
- * specified in the argument.
- */
-#if defined(SQLITE_NEED_ERR_NAME)
-const char *
-sqlite3ErrName(int rc)
-{
-	const char *zName = 0;
-	int i, origRc = rc;
-	for (i = 0; i < 2 && zName == 0; i++, rc &= 0xff) {
-		switch (rc) {
-		case SQLITE_OK:
-			zName = "SQLITE_OK";
-			break;
-		case SQLITE_ERROR:
-			zName = "SQLITE_ERROR";
-			break;
-		case SQLITE_PERM:
-			zName = "SQLITE_PERM";
-			break;
-		case SQLITE_ABORT:
-			zName = "SQLITE_ABORT";
-			break;
-		case SQLITE_BUSY:
-			zName = "SQLITE_BUSY";
-			break;
-		case SQLITE_LOCKED:
-			zName = "SQLITE_LOCKED";
-			break;
-		case SQLITE_NOMEM:
-			zName = "SQLITE_NOMEM";
-			break;
-		case SQLITE_INTERRUPT:
-			zName = "SQLITE_INTERRUPT";
-			break;
-		case SQLITE_IOERR:
-			zName = "SQLITE_IOERR";
-			break;
-		case SQLITE_IOERR_READ:
-			zName = "SQLITE_IOERR_READ";
-			break;
-		case SQLITE_IOERR_SHORT_READ:
-			zName = "SQLITE_IOERR_SHORT_READ";
-			break;
-		case SQLITE_IOERR_WRITE:
-			zName = "SQLITE_IOERR_WRITE";
-			break;
-		case SQLITE_IOERR_FSYNC:
-			zName = "SQLITE_IOERR_FSYNC";
-			break;
-		case SQLITE_IOERR_DIR_FSYNC:
-			zName = "SQLITE_IOERR_DIR_FSYNC";
-			break;
-		case SQLITE_IOERR_TRUNCATE:
-			zName = "SQLITE_IOERR_TRUNCATE";
-			break;
-		case SQLITE_IOERR_FSTAT:
-			zName = "SQLITE_IOERR_FSTAT";
-			break;
-		case SQLITE_IOERR_UNLOCK:
-			zName = "SQLITE_IOERR_UNLOCK";
-			break;
-		case SQLITE_IOERR_RDLOCK:
-			zName = "SQLITE_IOERR_RDLOCK";
-			break;
-		case SQLITE_IOERR_DELETE:
-			zName = "SQLITE_IOERR_DELETE";
-			break;
-		case SQLITE_IOERR_NOMEM:
-			zName = "SQLITE_IOERR_NOMEM";
-			break;
-		case SQLITE_IOERR_ACCESS:
-			zName = "SQLITE_IOERR_ACCESS";
-			break;
-		case SQLITE_IOERR_CHECKRESERVEDLOCK:
-			zName = "SQLITE_IOERR_CHECKRESERVEDLOCK";
-			break;
-		case SQLITE_IOERR_LOCK:
-			zName = "SQLITE_IOERR_LOCK";
-			break;
-		case SQLITE_IOERR_CLOSE:
-			zName = "SQLITE_IOERR_CLOSE";
-			break;
-		case SQLITE_IOERR_DIR_CLOSE:
-			zName = "SQLITE_IOERR_DIR_CLOSE";
-			break;
-		case SQLITE_IOERR_SHMOPEN:
-			zName = "SQLITE_IOERR_SHMOPEN";
-			break;
-		case SQLITE_IOERR_SHMSIZE:
-			zName = "SQLITE_IOERR_SHMSIZE";
-			break;
-		case SQLITE_IOERR_SHMLOCK:
-			zName = "SQLITE_IOERR_SHMLOCK";
-			break;
-		case SQLITE_IOERR_SHMMAP:
-			zName = "SQLITE_IOERR_SHMMAP";
-			break;
-		case SQLITE_IOERR_SEEK:
-			zName = "SQLITE_IOERR_SEEK";
-			break;
-		case SQLITE_IOERR_DELETE_NOENT:
-			zName = "SQLITE_IOERR_DELETE_NOENT";
-			break;
-		case SQLITE_IOERR_MMAP:
-			zName = "SQLITE_IOERR_MMAP";
-			break;
-		case SQLITE_IOERR_GETTEMPPATH:
-			zName = "SQLITE_IOERR_GETTEMPPATH";
-			break;
-		case SQLITE_IOERR_CONVPATH:
-			zName = "SQLITE_IOERR_CONVPATH";
-			break;
-		case SQLITE_NOTFOUND:
-			zName = "SQLITE_NOTFOUND";
-			break;
-		case SQLITE_FULL:
-			zName = "SQLITE_FULL";
-			break;
-		case SQLITE_CANTOPEN:
-			zName = "SQLITE_CANTOPEN";
-			break;
-		case SQLITE_SCHEMA:
-			zName = "SQLITE_SCHEMA";
-			break;
-		case SQLITE_TOOBIG:
-			zName = "SQLITE_TOOBIG";
-			break;
-		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;
-		case SQLITE_CONSTRAINT_FOREIGNKEY:
-			zName = "SQLITE_CONSTRAINT_FOREIGNKEY";
-			break;
-		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;
-		case SQLITE_MISUSE:
-			zName = "SQLITE_MISUSE";
-			break;
-		case SQLITE_RANGE:
-			zName = "SQLITE_RANGE";
-			break;
-		case SQL_TARANTOOL_ERROR:
-			zName = "SQLITE_TARANTOOL_ERROR";
-			break;
-		case SQLITE_ROW:
-			zName = "SQLITE_ROW";
-			break;
-		case SQLITE_WARNING:
-			zName = "SQLITE_WARNING";
-			break;
-		case SQLITE_DONE:
-			zName = "SQLITE_DONE";
-			break;
-		}
-	}
-	if (zName == 0) {
-		static char zBuf[50];
-		sqlite3_snprintf(sizeof(zBuf), zBuf, "SQLITE_UNKNOWN(%d)",
-				 origRc);
-		zName = zBuf;
-	}
-	return zName;
-}
-#endif
-
 /*
  * Return a static string that describes the kind of error specified in the
  * argument.
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 53188e74d..e9c15dbb3 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -284,17 +284,6 @@ void sqlite3Coverage(int);
 #define NEVER(X)       (X)
 #endif
 
-/*
- * Is the sqlite3ErrName() function needed in the build?  Currently,
- * it is needed by several "test*.c" files (which are
- * compiled using SQLITE_TEST).
- */
-#if defined(SQLITE_TEST)
-#define SQLITE_NEED_ERR_NAME
-#else
-#undef  SQLITE_NEED_ERR_NAME
-#endif
-
 /*
  * Return true (non-zero) if the input is an integer that is too large
  * to fit in 32-bits.  This macro is used inside of various testcase()
@@ -4276,10 +4265,6 @@ void sqlite3SystemError(sqlite3 *, int);
 void *sqlite3HexToBlob(sqlite3 *, const char *z, int n);
 u8 sqlite3HexToInt(int h);
 
-#if defined(SQLITE_NEED_ERR_NAME)
-const char *sqlite3ErrName(int);
-#endif
-
 const char *sqlite3ErrStr(int);
 
 /**
-- 
2.14.1

  reply	other threads:[~2018-10-02 10:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 10:48 [tarantool-patches] [PATCH 0/3] Delete foreign_keys and ignore_check_constraints pragmas AKhatskevich
2018-10-02 10:48 ` AKhatskevich [this message]
2018-10-02 13:36   ` [tarantool-patches] Re: [PATCH 1/3] sql: delete unused code n.pettik
2018-10-04 15:16     ` Alex Khatskevich
2018-10-02 10:48 ` [tarantool-patches] [PATCH 2/3] sql: delete foreign_keys pragma AKhatskevich
2018-10-02 13:36   ` [tarantool-patches] " n.pettik
2018-10-04 15:16     ` Alex Khatskevich
2018-10-02 10:48 ` [tarantool-patches] [PATCH 3/3] sql: delete ignore_check_constraints pragma AKhatskevich
2018-10-02 13:36   ` [tarantool-patches] " n.pettik
2018-10-04 15:16     ` Alex Khatskevich
2018-10-04 16:27 ` [tarantool-patches] Re: [PATCH 0/3] Delete foreign_keys and ignore_check_constraints pragmas n.pettik
2018-10-05  7:15 ` 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=80b97605c05e8de841b476627ca52eda60d77b0e.1538476785.git.avkhatskevich@tarantool.org \
    --to=avkhatskevich@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/3] sql: delete unused code' \
    /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