From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, Kirill Shcherbatov <kshcherbatov@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v1 1/1] box: ability to omit box.cfg() call in sql Date: Wed, 16 May 2018 16:10:35 +0300 [thread overview] Message-ID: <52ef9ff2-8b64-d68d-23d4-757303680135@tarantool.org> (raw) In-Reply-To: <6056f62646b1aee1ce8c99b7d3fe5cc3d78a993d.1526475084.git.kshcherbatov@tarantool.org> Hello. Thanks for the short and simple patch! See my 6 minor comments below. On 16/05/2018 15:51, Kirill Shcherbatov wrote: > This makes possible to call box.sql.execute without pre-calling box.cfg. > Introduced metatable __index function for box.sql that called when no > appropriate box.sql methods (execute, debug) is defined. It calls > box.cfg() itself that redefines box.sql table. > > Closes #3266 > --- > src/box/lua/load_cfg.lua | 15 +++++++++++++++ > test/box/cfg.result | 17 +++++++++++++++++ > test/box/cfg.test.lua | 10 ++++++++++ > 3 files changed, 42 insertions(+) > > diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua > index 4ace1e1..781de3e 100644 > --- a/src/box/lua/load_cfg.lua > +++ b/src/box/lua/load_cfg.lua > @@ -418,6 +418,21 @@ local function load_cfg(cfg) > end > box.cfg = load_cfg > > +-- > +-- gh-3266: box.cfg{} still not optional on 2.0 brach 1. Please, do not reference github issues in the code. Only in tests. I see, that it is ignored few lines above, but it was wrong too. Unfortunately, the author of this ' -- gh-810:' line sometimes ignores its own rules. > +-- > +-- This makes possible do box.sql.execute without calling box.cfg > +-- manually. The load_cfg call would overwrite following table and > +-- metatable. 2. Why 'would'? It actually overrides (it is ok, only the comment is strange). > diff --git a/test/box/cfg.result b/test/box/cfg.result > index 14dceac..42a0a89 100644 > --- a/test/box/cfg.result > +++ b/test/box/cfg.result > @@ -434,6 +434,23 @@ box.cfg{net_msg_max = old + 1000} > box.cfg{net_msg_max = old} > --- > ... > +-- > +-- gh-3266: box.cfg{} still not optional on 2.0 brach > +-- > +-- box.sql defined with __index function in metatable overriten with first 3. overridden. > +-- sql.cfg() call 4. sql.cfg -> box.cfg. > +-- > +box.cfg() > +--- > +... > +assert(next(box.sql) ~= box.NULL) 5. Why box.NULL? NULL is cdata, and used mostly to insert NULL into spaces. Lets use nil. > +--- > +- true > +... > +assert(getmetatable(box.sql) == box.NULL) 6. Same.
next prev parent reply other threads:[~2018-05-16 13:10 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-16 12:51 [tarantool-patches] " Kirill Shcherbatov 2018-05-16 13:10 ` Vladislav Shpilevoy [this message] 2018-05-16 13:22 ` [tarantool-patches] " Kirill Shcherbatov 2018-05-17 9:29 ` Vladislav Shpilevoy 2018-05-18 11:39 ` n.pettik 2018-05-18 11:58 ` 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=52ef9ff2-8b64-d68d-23d4-757303680135@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v1 1/1] box: ability to omit box.cfg() call in sql' \ /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