From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Nikita Pettik <korablev@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 1/2] sql: remove obsolete SQLite routine Date: Tue, 3 Apr 2018 20:54:56 +0300 [thread overview] Message-ID: <7a18a3e7-9076-087e-df93-dde6955adc70@tarantool.org> (raw) In-Reply-To: <0e28c9181b19643504f335a164f8d098fdab6614.1522769126.git.korablev@tarantool.org> Hello. See 7 comments below. 03.04.2018 19:14, Nikita Pettik пишет: > Some of legacy functions seem to be useless, since they serve as > wrappers around others; the rest rely on capabilities which are no > longer relevant. This patch provides slight refactoring of such > functions. > > Removed entities: > - sqlite3LocateTableItem() - replaced with sqlite3LocateTable(); > - sqlite3FindTable() - replaced with sqlite3HashFind(); > - sqlite3ColumnOfIndex() - in Tarantool order of columns always the same; > - sqlite3FindIndex() - replaced with sqlite3LocateIndex(); > - sqlite3CodeVerifySchema(); > - sqlite3SchemaToIndex(); > - sqlite3MultiWrite(); > - Parse->cookieMast; > - Vdbe->usesStmtJournal; > --- > src/box/sql/alter.c | 13 ++- > src/box/sql/analyze.c | 25 +++--- > src/box/sql/build.c | 213 ++++++++++-------------------------------------- > src/box/sql/delete.c | 5 +- > src/box/sql/expr.c | 9 +- > src/box/sql/fkey.c | 3 +- > src/box/sql/insert.c | 10 +-- > src/box/sql/pragma.c | 18 ++-- > src/box/sql/prepare.c | 29 ------- > src/box/sql/select.c | 4 +- > src/box/sql/sqliteInt.h | 11 +-- > src/box/sql/trigger.c | 7 +- > src/box/sql/update.c | 2 +- > src/box/sql/vdbe.c | 1 - > src/box/sql/vdbeInt.h | 1 - > src/box/sql/vdbeaux.c | 1 - > src/box/sql/where.c | 2 - > src/box/sql/wherecode.c | 7 +- > 18 files changed, 83 insertions(+), 278 deletions(-) > > diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c > index 054c0856c..a19324ed2 100644 > --- a/src/box/sql/alter.c > +++ b/src/box/sql/alter.c > @@ -122,7 +121,7 @@ sqlite3AlterRenameTable(Parse * pParse, /* Parser context. */ > if (v == 0) { > goto exit_rename_table; > } > - sqlite3BeginWriteOperation(pParse, false); > + sql_set_multi_write(pParse, false); 1. Can you please alongside with this patch make sql_set_multi_write take boolean as the last argument? Now it sometimes gets true/false, sometimes 1/0. It is strange. > > /* Drop and reload the internal table schema. */ > reloadTableSchema(pParse, pTab, zName); > > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index 5e3ed0f39..61194e06b 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -93,23 +93,16 @@ sqlite3FinishCoding(Parse * pParse) > * transaction on each used database and to verify the schema cookie > * on each used database. > */ > - if (db->mallocFailed == 0 > - && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr) > - ) { > + if (db->mallocFailed == 0 || pParse->pConstExpr) { 2. Please, together with cookie mask checking remove or refactor a comment above. > @@ -2240,7 +2164,6 @@ sqlite3CodeDropTable(Parse * pParse, Table * pTab, int isView) > > v = sqlite3GetVdbe(pParse); > assert(v != 0); > - sqlite3BeginWriteOperation(pParse, 1); 3. Why did you delete it with no replacement by sql_set_multi_write(false) ? > @@ -2376,15 +2299,12 @@ sqlite3DropTable(Parse * pParse, SrcList * pName, int isView, int noErr) > if (noErr) > db->suppressErr++; > assert(isView == 0 || isView == LOCATE_VIEW); > - pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); > + pTab = sqlite3LocateTable(pParse, isView, pName->a[0].zName); > if (noErr) > db->suppressErr--; > > - if (pTab == 0) { > - if (noErr) > - sqlite3CodeVerifySchema(pParse); > + if (pTab == 0) 4. Lets use ==/!= NULL in all new code. Same about checking sqlite3HashFind results. And if it is possible with not huge diff, can you please rename sqlite3HashFind to sql_hash_find ? 5. sqlite3MultiWrite in commit message is listed among deleted functions, but its declaration still exists. 6. cookieMast - typo in commit message. And how about do not list deleted functions in a commit body? I can not imagine, that somebody except me will search for any of these functions. And the list is deprecated - for example, sqlite3BeginWriteOperation is deleted too, but does not presence in the list. 7. How about remove DbMaskTest, DbMaskZero and other dbmask shit?
next prev parent reply other threads:[~2018-04-03 17:55 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-03 16:14 [tarantool-patches] [PATCH 0/2] rework SQL 'DROP' routine Nikita Pettik 2018-04-03 16:14 ` [tarantool-patches] [PATCH 1/2] sql: remove obsolete SQLite routine Nikita Pettik 2018-04-03 17:54 ` Vladislav Shpilevoy [this message] 2018-04-04 18:09 ` [tarantool-patches] " n.pettik 2018-04-05 11:16 ` Vladislav Shpilevoy 2018-04-05 12:13 ` n.pettik 2018-04-05 13:28 ` Vladislav Shpilevoy 2018-04-03 16:14 ` [tarantool-patches] [PATCH 2/2] sql: rework 'DROP INDEX' and 'DROP TABLE' handling Nikita Pettik 2018-04-03 18:27 ` [tarantool-patches] " Vladislav Shpilevoy 2018-04-04 18:11 ` n.pettik 2018-04-05 11:20 ` Vladislav Shpilevoy 2018-04-05 14:12 ` [tarantool-patches] Re: [PATCH 0/2] rework SQL 'DROP' routine 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=7a18a3e7-9076-087e-df93-dde6955adc70@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH 1/2] sql: remove obsolete SQLite routine' \ /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