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 03ED829C9D for ; Tue, 2 Oct 2018 06:49:06 -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 cUDKX4ueGKX5 for ; Tue, 2 Oct 2018 06:49:05 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 8F328299F2 for ; Tue, 2 Oct 2018 06:49:05 -0400 (EDT) From: AKhatskevich Subject: [tarantool-patches] [PATCH 1/3] sql: delete unused code Date: Tue, 2 Oct 2018 13:48:34 +0300 Message-Id: <80b97605c05e8de841b476627ca52eda60d77b0e.1538476785.git.avkhatskevich@tarantool.org> 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: korablev@tarantool.org, tarantool-patches@freelists.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