From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Chris Sosnin <k.sosnin@tarantool.org>,
korablev@tarantool.org, tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 4/4] sql: provide a user friendly frontend for accessing session settings
Date: Sat, 4 Apr 2020 23:56:39 +0200 [thread overview]
Message-ID: <736e6bf5-aea4-ffe4-be7b-2dcc9539065a@tarantool.org> (raw)
In-Reply-To: <68bbb40b963e1c4ef4a1950a01e67453fc252347.1585559306.git.k.sosnin@tarantool.org>
Hi! Thanks for the patch!
> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> index a00da31f9..cdcf8b6d8 100644
> --- a/src/box/sql/build.c
> +++ b/src/box/sql/build.c
> @@ -3481,3 +3481,28 @@ sql_session_settings_init()
> setting->set = sql_session_setting_set;
> }
> }
> +
> +void
> +sql_setting_set(struct Parse *parse_context, struct Token *name,
> + struct Expr *expr)
> +{
> + struct Vdbe *vdbe = sqlGetVdbe(parse_context);
> + if (vdbe == NULL)
> + goto abort;
> + sqlVdbeCountChanges(vdbe);
> + char *key = sql_name_from_token(parse_context->db, name);
> + if (key == NULL)
> + goto abort;
> + int index = session_setting_find(key);
I agree with Nikita. Better make this call part of OP_SetSetting.
> + if (index >= 0) {
> + int target = ++parse_context->nMem;
> + sqlExprCode(parse_context, expr, target);
> + sqlVdbeAddOp2(vdbe, OP_SetSetting, index, target);
> + return;
> + }
> + diag_set(ClientError, ER_SQL_PARSER_GENERIC,
> + tt_sprintf("Session setting %s doesn't exist", key));
> +abort:
> + parse_context->is_aborted = true;
> + return;
> +}
Talking of the syntax, I don't have a strong opinion here
regarding any particular option. I only want the new statement
be short, and not involving _session_settings manipulations.
next prev parent reply other threads:[~2020-04-04 21:56 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 9:13 [Tarantool-patches] [PATCH 0/4] session settings fixes Chris Sosnin
2020-03-30 9:13 ` [Tarantool-patches] [PATCH 1/4] box: replace session_settings modules with a single array Chris Sosnin
2020-04-03 13:32 ` Nikita Pettik
2020-03-30 9:13 ` [Tarantool-patches] [PATCH 2/4] box: add binary search for _session_settings space Chris Sosnin
2020-04-03 14:00 ` Nikita Pettik
2020-04-13 13:40 ` Kirill Yukhin
2020-03-30 9:13 ` [Tarantool-patches] [PATCH 3/4] box: provide a user friendly frontend for accessing session settings Chris Sosnin
2020-04-03 14:47 ` Nikita Pettik
2020-03-30 9:13 ` [Tarantool-patches] [PATCH 4/4] sql: " Chris Sosnin
2020-04-03 15:19 ` Nikita Pettik
2020-04-04 21:56 ` Vladislav Shpilevoy [this message]
2020-04-10 15:40 ` Chris Sosnin
2020-04-11 17:18 ` Vladislav Shpilevoy
2020-04-13 7:50 ` Timur Safin
2020-04-02 9:14 ` [Tarantool-patches] [PATCH 0/4] session settings fixes Timur Safin
2020-04-02 10:18 ` Chris Sosnin
2020-04-03 12:47 ` Nikita Pettik
2020-04-03 13:09 ` Nikita Pettik
2020-04-03 14:02 ` Chris Sosnin
2020-04-13 14:18 ` Kirill Yukhin
-- strict thread matches above, loose matches on Subject: below --
2020-02-17 12:12 [Tarantool-patches] [PATCH 0/4] box: " Chris Sosnin
2020-02-17 12:12 ` [Tarantool-patches] [PATCH 4/4] sql: provide a user friendly frontend for accessing session settings Chris Sosnin
2020-03-16 17:02 ` Nikita Pettik
2020-03-16 22:53 ` Vladislav Shpilevoy
2020-03-17 17:26 ` Chris Sosnin
2020-03-17 20:12 ` Nikita Pettik
2020-03-17 21:00 ` Chris Sosnin
2020-03-18 10:00 ` Chris Sosnin
2020-02-03 22:17 [Tarantool-patches] [PATCH] " Vladislav Shpilevoy
2020-02-04 19:32 ` [Tarantool-patches] [PATCH 4/4] " Chris Sosnin
2020-02-06 22:16 ` Vladislav Shpilevoy
2020-02-07 9:40 ` Chris Sosnin
2020-02-10 22:09 ` Vladislav Shpilevoy
2020-02-17 11:46 ` Chris Sosnin
2020-02-17 11:56 ` Nikita 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=736e6bf5-aea4-ffe4-be7b-2dcc9539065a@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=k.sosnin@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 4/4] sql: provide a user friendly frontend for accessing session settings' \
/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