From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>,
tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v1 0/4] sql: remove Triggers to server
Date: Mon, 4 Jun 2018 16:27:29 +0300 [thread overview]
Message-ID: <18d2ee06-3eca-bd53-be41-d580ae0f834e@tarantool.org> (raw)
In-Reply-To: <cover.1527765756.git.kshcherbatov@tarantool.org>
Thanks for the patch! Why did not you send it? See 1 comment below.
> commit 7e6143c51e520f68db9a4fe96d6980ba65f653d8
> Author: Kirill Shcherbatov <kshcherbatov@gmail.com>
> Date: Fri Jun 1 15:38:30 2018 +0300
>
> sql: refactor sql_expr_compile to return AST
>
> diff --git a/src/box/sql/tokenize.c b/src/box/sql/tokenize.c
> index 42c70a255..2555adbf4 100644
> --- a/src/box/sql/tokenize.c
> +++ b/src/box/sql/tokenize.c
> @@ -539,9 +539,8 @@ sqlite3RunParser(Parse * pParse, const char *zSql, char **pzErrMsg)
> return nErr;
> }
>
> -int
> -sql_expr_compile(sqlite3 *db, const char *expr, int expr_len,
> - struct Expr **result)
> +struct Expr *
> +sql_expr_compile(sqlite3 *db, const char *expr, int expr_len)
> {
> const char *outer = "SELECT ";
> int len = strlen(outer) + expr_len;
> @@ -550,19 +549,23 @@ sql_expr_compile(sqlite3 *db, const char *expr, int expr_len,
> sql_parser_create(&parser, db);
> parser.parse_only = true;
>
> + struct Expr *expression = NULL;
> char *stmt = (char *)region_alloc(&parser.region, len + 1);
> if (stmt == NULL) {
> diag_set(OutOfMemory, len + 1, "region_alloc", "stmt");
> - return -1;
> + goto cleanup;
> }
> sprintf(stmt, "%s%.*s", outer, expr_len, expr);
>
> - char *unused;
> - if (sqlite3RunParser(&parser, stmt, &unused) != SQLITE_OK) {
> - diag_set(ClientError, ER_SQL_EXECUTE, expr);
> - return -1;
> + char *sql_error;
> + if (sqlite3RunParser(&parser, stmt, &sql_error) != SQLITE_OK) {
> + char *error = tt_static_buf();
> + snprintf(error, TT_STATIC_BUF_LEN, "%s", sql_error);
> + diag_set(ClientError, ER_SQL_EXECUTE, stmt);
> + goto cleanup;
1. What is happening here? 'Error' variable is unused, as well as sql_error
as I can see.
next prev parent reply other threads:[~2018-06-04 13:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 11:22 [tarantool-patches] " Kirill Shcherbatov
2018-05-31 11:22 ` [tarantool-patches] [PATCH v1 1/4] box: move db->pShchema init to sql_init Kirill Shcherbatov
2018-05-31 17:36 ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-01 20:24 ` Kirill Shcherbatov
2018-05-31 11:22 ` [tarantool-patches] [PATCH v1 2/4] sql: fix sql len in tarantoolSqlite3RenameTrigger Kirill Shcherbatov
2018-05-31 11:22 ` [tarantool-patches] [PATCH v1 3/4] box: introduce box_space_id_by_name Kirill Shcherbatov
2018-05-31 17:36 ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-01 20:24 ` Kirill Shcherbatov
2018-06-04 13:27 ` Vladislav Shpilevoy
2018-06-04 19:21 ` Kirill Shcherbatov
2018-06-05 13:31 ` Vladislav Shpilevoy
2018-05-31 11:22 ` [tarantool-patches] [PATCH v1 4/4] sql: move Triggers to server Kirill Shcherbatov
2018-05-31 17:36 ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-01 20:24 ` Kirill Shcherbatov
2018-06-01 20:25 ` Kirill Shcherbatov
2018-06-04 13:27 ` Vladislav Shpilevoy
2018-06-04 19:21 ` Kirill Shcherbatov
2018-06-05 13:31 ` Vladislav Shpilevoy
2018-06-09 9:32 ` Kirill Shcherbatov
2018-06-01 18:51 ` Konstantin Osipov
2018-05-31 17:36 ` [tarantool-patches] Re: [PATCH v1 0/4] sql: remove " Vladislav Shpilevoy
2018-06-04 13:27 ` Vladislav Shpilevoy [this message]
2018-06-05 13:31 ` Vladislav Shpilevoy
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=18d2ee06-3eca-bd53-be41-d580ae0f834e@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH v1 0/4] sql: remove Triggers to server' \
/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