Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 3/3] box: local sql_flags for parser and vdbe
Date: Fri, 17 May 2019 02:08:34 +0300	[thread overview]
Message-ID: <A8FC8EDC-38D2-4966-AA85-AA821BC6114E@tarantool.org> (raw)
In-Reply-To: <5d4de78a-0ffe-5238-c2c9-8854a15b842f@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 2367 bytes --]



> On 15 May 2019, at 21:54, Kirill Shcherbatov <kshcherbatov@tarantool.org> wrote:
> The sql_flags is a parser parameter that describe

-> describes

Nit: not only how to parse, but it determines general behaviour:
like whether foreign keys are handled as deferred or not etc.

> how to parse the
> SQL request, but now this information is taken from the global
> user session object.
> When we need to run the parser with some other parameters, it is
> necessary to change global session object, which may lead to
> unpredictable consequences in general case.
> Introduced a new parser and vdbe field sql_flags is responsible

-> which is responsible

> diff --git a/src/box/sql/delete.c b/src/box/sql/delete.c
> index a95b07155..bde70a4d3 100644
> --- a/src/box/sql/delete.c
> +++ b/src/box/sql/delete.c
> @@ -30,7 +30,6 @@
>  */
> 
> #include "box/box.h"
> -#include "box/session.h"
> #include "box/schema.h"
> #include "sqlInt.h"
> #include "tarantoolInt.h"
> @@ -151,7 +150,8 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
> 	struct space *space = sql_lookup_space(parse, tab_list->a);
> 	if (space == NULL)
> 		goto delete_from_cleanup;
> -	trigger_list = sql_triggers_exist(space->def, TK_DELETE, NULL, NULL);
> +	trigger_list = sql_triggers_exist(parse, space->def, TK_DELETE,
> +					  NULL, NULL);

Why not pass only flags from parsing context?

> @@ -5444,7 +5439,7 @@ default: {          /* This is really OP_Noop and OP_Explain */
> 		assert(pOp>=&aOp[-1] && pOp<&aOp[p->nOp-1]);
> 
> #ifdef SQL_DEBUG
> -		if (user_session->sql_flags & SQL_VdbeTrace) {
> +		if ((p->sql_flags & SQL_VdbeTrace) != 0) {
> 			u8 opProperty = sqlOpcodeProperty[pOrigOp->opcode];
> 			if (rc!=0) printf("rc=%d\n",rc);
> 			if (opProperty & (OPFLG_OUT2)) {
> diff --git a/src/box/sql/vdbeInt.h b/src/box/sql/vdbeInt.h
> index a3100e513..86fd92da1 100644
> --- a/src/box/sql/vdbeInt.h
> +++ b/src/box/sql/vdbeInt.h
> @@ -446,6 +446,8 @@ struct Vdbe {
> 	u32 expmask;		/* Binding to these vars invalidates VM */
> 	SubProgram *pProgram;	/* Linked list of all sub-programs used by VM */
> 	AuxData *pAuxData;	/* Linked list of auxdata allocations */
> +	/** Parser flags with which this object was built. */

Strictly speaking, they these flags are not only parsing flags.

The rest is OK.

[-- Attachment #2: Type: text/html, Size: 49991 bytes --]

  reply	other threads:[~2019-05-16 23:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 17:34 [tarantool-patches] [PATCH v1 0/3] " Kirill Shcherbatov
2019-05-15 17:34 ` [tarantool-patches] [PATCH v1 1/3] sql: get rid of SQL_NullCallback flag Kirill Shcherbatov
2019-05-16 23:08   ` [tarantool-patches] " n.pettik
2019-05-15 17:34 ` [tarantool-patches] [PATCH v1 2/3] sql: ban sql functions coinciding with builtins Kirill Shcherbatov
2019-05-16 23:12   ` [tarantool-patches] " n.pettik
2019-05-17  8:22     ` Kirill Shcherbatov
2019-05-17 15:20       ` n.pettik
2019-05-17  8:22     ` Kirill Shcherbatov
2019-05-15 17:34 ` [tarantool-patches] [PATCH v1 3/3] box: local sql_flags for parser and vdbe Kirill Shcherbatov
2019-05-15 18:54   ` [tarantool-patches] " Kirill Shcherbatov
2019-05-16 23:08     ` n.pettik [this message]
2019-05-17  8:22       ` Kirill Shcherbatov

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=A8FC8EDC-38D2-4966-AA85-AA821BC6114E@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 3/3] box: local sql_flags for parser and vdbe' \
    /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