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 C8B1425DBE for ; Wed, 16 Jan 2019 10:35:08 -0500 (EST) 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 u1gjXYgKmbrO for ; Wed, 16 Jan 2019 10:35:08 -0500 (EST) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 783B025C01 for ; Wed, 16 Jan 2019 10:35:08 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: [tarantool-patches] Re: [PATCH v3 2/6] sql: fix "PRAGMA parser_trace" result From: "n.pettik" In-Reply-To: Date: Wed, 16 Jan 2019 18:35:06 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: 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: tarantool-patches@freelists.org Cc: Imeev Mergen > 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) { >=20 > case PragTyp_FLAG:{ > - if (zRight =3D=3D 0) { > - setPragmaResultColumnNames(v, pPragma); > - returnSingleInt(v, > - (user_session-> > - sql_flags & = pPragma->iArg) !=3D > - 0); > - } else { > - int mask =3D pPragma->iArg; /* Mask = of bits to set > - * or = clear. > - */ > - > - if (sqlite3GetBoolean(zRight, 0)) { > - user_session->sql_flags |=3D = mask; > - } else { > - user_session->sql_flags &=3D = ~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 =3D=3D 0) { Since you have already aligned code, I propose to fix it according to our codestyle: zRight =3D=3D NULL > + setPragmaResultColumnNames(v, pPragma); > + returnSingleInt(v, (user_session->sql_flags & > + pPragma->iArg) !=3D 0); > + } else { > + int mask =3D pPragma->iArg; /* Mask of bits = to set > + * or clear. > + */ Smth wrong with comment. > + bool is_value_true =3D sqlite3GetBoolean(zRight, = 0); Bad name imho. I would call it =E2=80=9Cis_set=E2=80=9D or = =E2=80=9Cis_pragma_set=E2=80=9D or =E2=80=9Cpragma_status=E2=80=9D. Explanation: variable itself is of type bool and =E2=80=9Cvalue=E2=80=9D = 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 =3D require('net.box') > +test_run =3D require('test_run').new() > +engine =3D test_run:get_cfg('engine') > +box.sql.execute('pragma sql_default_engine=3D\''..engine..'\'') > + > +-- > +-- gh-3832: Some statements do not return column type > + > +-- Check that "PRAGMA parser_trace" returns 0 or 1 if called > +-- without parameter. > +result =3D box.sql.execute('PRAGMA parser_trace') > +-- Should be nothing. > +box.sql.execute('PRAGMA parser_trace =3D 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.