From: Alex Khatskevich <avkhatskevich@tarantool.org> To: "n.pettik" <korablev@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 1/3] sql: delete unused code Date: Thu, 4 Oct 2018 18:16:23 +0300 [thread overview] Message-ID: <9e1a6ed9-a054-85ce-6cb1-9e0c8e38a095@tarantool.org> (raw) In-Reply-To: <FF97634F-5119-485D-8C2E-A2BD5109DF4D@tarantool.org> On 02.10.2018 16:36, n.pettik wrote: > You forgot to delete function declaration from sqliteInt.h > You deleted not all mentions of sqlite3_close_v2(), just grep it. Fixed. Full diff: commit 253c0d51310c5684da94862bb7f8723cf726b0c2 Author: AKhatskevich <avkhatskevich@tarantool.org> Date: Mon Oct 1 14:19:57 2018 +0300 sql: delete unused code Part of #3696 diff --git a/src/box/sql/main.c b/src/box/sql/main.c index 782f99452..86e9bcfcd 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(). */ @@ -660,12 +561,7 @@ connectionIsBusy(sqlite3 * db) static int sqlite3Close(sqlite3 * db, int forceZombie) { - if (!db) { - /* EVIDENCE-OF: R-63257-11740 Calling sqlite3_close() or - * sqlite3_close_v2() with a NULL pointer argument is a harmless no-op. - */ - return SQLITE_OK; - } + assert(db); if (!sqlite3SafetyCheckSickOrOk(db)) { return SQLITE_MISUSE_BKPT; } @@ -701,10 +597,7 @@ sqlite3Close(sqlite3 * db, int forceZombie) * Two variations on the public interface for closing a database * connection. The sqlite3_close() version returns SQLITE_BUSY and * leaves the connection option if there are unfinalized prepared - * statements. The sqlite3_close_v2() - * version forces the connection to become a zombie if there are - * unclosed resources, and arranges for deallocation when the last - * prepare statement. + * statements. */ int sqlite3_close(sqlite3 * db) @@ -712,12 +605,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 +623,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..dd43f32a8 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() @@ -837,9 +826,6 @@ struct sqlite3_io_methods { int sqlite3_os_init(void); -int -sqlite3_db_release_memory(sqlite3 *); - int sqlite3_busy_timeout(sqlite3 *, int ms); @@ -4276,10 +4262,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); /** diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua index 06e6e5bd2..da9872ec5 100755 --- a/test/sql-tap/triggerC.test.lua +++ b/test/sql-tap/triggerC.test.lua @@ -42,7 +42,6 @@ testprefix = "triggerC" -- Enable recursive triggers for this file. -- test:execsql " PRAGMA recursive_triggers = on " ---sqlite3_db_config_lookaside db 0 0 0 --------------------------------------------------------------------------- -- This block of tests, triggerC-1.*, are not aimed at any specific -- property of the triggers sub-system. They were created to debug
next prev parent reply other threads:[~2018-10-04 15:16 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 ` [tarantool-patches] [PATCH 1/3] sql: delete unused code AKhatskevich 2018-10-02 13:36 ` [tarantool-patches] " n.pettik 2018-10-04 15:16 ` Alex Khatskevich [this message] 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=9e1a6ed9-a054-85ce-6cb1-9e0c8e38a095@tarantool.org \ --to=avkhatskevich@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [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