From: "n.pettik" <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: Imeev Mergen <imeevma@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v3 2/6] sql: fix "PRAGMA parser_trace" result Date: Wed, 16 Jan 2019 18:35:06 +0300 [thread overview] Message-ID: <D4002EA5-2AC9-4367-A3C8-3A7A618D462C@tarantool.org> (raw) In-Reply-To: <efa1434cc4186a026f416f7506319f89009fd029.1545844480.git.imeevma@gmail.com> > diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c > index b8edc76..6122986 100644 > --- a/src/box/sql/pragma.c > +++ b/src/box/sql/pragma.c > @@ -466,33 +466,31 @@ sqlite3Pragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */ > switch (pPragma->ePragTyp) { > > case PragTyp_FLAG:{ > - if (zRight == 0) { > - setPragmaResultColumnNames(v, pPragma); > - returnSingleInt(v, > - (user_session-> > - sql_flags & pPragma->iArg) != > - 0); > - } else { > - int mask = pPragma->iArg; /* Mask of bits to set > - * or clear. > - */ > - > - if (sqlite3GetBoolean(zRight, 0)) { > - user_session->sql_flags |= mask; > - } else { > - user_session->sql_flags &= ~mask; > - } > - > - /* Many of the flag-pragmas modify the code > - * generated by the SQL * compiler (eg. > - * count_changes). So add an opcode to expire > - * all * compiled SQL statements after > - * modifying a pragma value. > - */ > - sqlite3VdbeAddOp0(v, OP_Expire); > + if (zRight == 0) { Since you have already aligned code, I propose to fix it according to our codestyle: zRight == NULL > + setPragmaResultColumnNames(v, pPragma); > + returnSingleInt(v, (user_session->sql_flags & > + pPragma->iArg) != 0); > + } else { > + int mask = pPragma->iArg; /* Mask of bits to set > + * or clear. > + */ Smth wrong with comment. > + bool is_value_true = sqlite3GetBoolean(zRight, 0); Bad name imho. I would call it “is_set” or “is_pragma_set” or “pragma_status”. Explanation: variable itself is of type bool and “value” says nothing. > diff --git a/test/sql/sql-debug.test.lua b/test/sql/sql-debug.test.lua > new file mode 100644 > index 0000000..66f47b3 > --- /dev/null > +++ b/test/sql/sql-debug.test.lua > @@ -0,0 +1,17 @@ > +remote = require('net.box') > +test_run = require('test_run').new() > +engine = test_run:get_cfg('engine') > +box.sql.execute('pragma sql_default_engine=\''..engine..'\'') > + > +-- > +-- gh-3832: Some statements do not return column type > + > +-- Check that "PRAGMA parser_trace" returns 0 or 1 if called > +-- without parameter. > +result = box.sql.execute('PRAGMA parser_trace') > +-- Should be nothing. > +box.sql.execute('PRAGMA parser_trace = 1') > +-- Should be 1. > +box.sql.execute('PRAGMA parser_trace') > +-- Should be nothing. These three comments say nothing. Results and mismatches can be seen from .result and .reject files.
next prev parent reply other threads:[~2019-01-16 15:35 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-26 18:17 [tarantool-patches] [PATCH v3 0/6] sql: set column types for EXPLAIN and PRAGMA imeevma 2018-12-26 18:17 ` [tarantool-patches] [PATCH v3 1/6] sql: remove unused macros from pragma.c and pragma.h imeevma 2019-01-16 15:34 ` [tarantool-patches] " n.pettik 2018-12-26 18:18 ` [tarantool-patches] [PATCH v3 2/6] sql: fix "PRAGMA parser_trace" result imeevma 2019-01-16 15:35 ` n.pettik [this message] 2018-12-26 18:18 ` [tarantool-patches] [PATCH v3 3/6] sql: Show currently set sql_default_engine imeevma 2018-12-26 18:18 ` [tarantool-patches] [PATCH v3 4/6] sql: fix "PRAGMA case_sensitive_like" result imeevma 2019-01-16 15:35 ` [tarantool-patches] " n.pettik 2018-12-26 18:18 ` [tarantool-patches] [PATCH v3 5/6] sql: 'PRAGMA' result in the appropriate format imeevma 2019-01-16 15:35 ` [tarantool-patches] " n.pettik 2018-12-26 18:18 ` [tarantool-patches] [PATCH v3 6/6] sql: set column types for EXPLAIN and PRAGMA imeevma 2019-01-16 15:35 ` [tarantool-patches] " n.pettik
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=D4002EA5-2AC9-4367-A3C8-3A7A618D462C@tarantool.org \ --to=korablev@tarantool.org \ --cc=imeevma@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v3 2/6] sql: fix "PRAGMA parser_trace" result' \ /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