From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v2 2/6] sql: introduce sql_func_find() Date: Fri, 6 Aug 2021 00:15:20 +0200 [thread overview] Message-ID: <af9e6fa8-3dc0-80f6-f61c-106b75af6635@tarantool.org> (raw) In-Reply-To: <1f3fed85601ae3bb7680d3ba8cb523fb0e412299.1628081224.git.imeevma@gmail.com> Thanks for the patch! > diff --git a/src/box/sql/func.c b/src/box/sql/func.c > index 28d383293..9514d070a 100644 > --- a/src/box/sql/func.c > +++ b/src/box/sql/func.c > @@ -2655,6 +2643,30 @@ static struct { > }, > }; > > +struct func * > +sql_func_find(struct Expr *expr) > +{ > + const char *name = expr->u.zToken; > + struct func *func = func_by_name(name, strlen(name)); > + if (func == NULL) { > + diag_set(ClientError, ER_NO_SUCH_FUNCTION, name); > + return NULL; > + } > + if (!func->def->exports.sql) { > + diag_set(ClientError, ER_SQL_PARSER_GENERIC, > + tt_sprintf("function %s() is not available in SQL", > + name)); > + return NULL; > + } > + int n = expr->x.pList ? expr->x.pList->nExpr : 0; != NULL. > + if (func->def->param_count != -1 && func->def->param_count != n) { > + diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, name, > + tt_sprintf("%d", func->def->param_count), n); > + return NULL; > + } > + return func; > +}
next prev parent reply other threads:[~2021-08-05 22:15 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-04 12:58 [Tarantool-patches] [PATCH v2 0/6] Remove SQL built-in functions from _func Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 1/6] sql: introduce sql_func_flags() Mergen Imeev via Tarantool-patches 2021-08-05 22:14 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:41 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 2/6] sql: introduce sql_func_find() Mergen Imeev via Tarantool-patches 2021-08-05 22:15 ` Vladislav Shpilevoy via Tarantool-patches [this message] 2021-08-06 19:42 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 3/6] sql: remove SQL built-in functions from _func Mergen Imeev via Tarantool-patches 2021-08-05 22:17 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:45 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 4/6] alter: parse data dictionary version Mergen Imeev via Tarantool-patches 2021-08-05 22:17 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:47 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 5/6] alter: disallow creation of SQL built-in function Mergen Imeev via Tarantool-patches 2021-08-05 22:18 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:54 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 6/6] sql: remove unnecessary function initialization Mergen Imeev via Tarantool-patches 2021-08-06 19:59 ` Mergen Imeev via Tarantool-patches 2021-08-08 12:08 ` [Tarantool-patches] [PATCH v2 0/6] Remove SQL built-in functions from _func Vladislav Shpilevoy via Tarantool-patches 2021-08-09 7:18 Mergen Imeev via Tarantool-patches 2021-08-09 7:18 ` [Tarantool-patches] [PATCH v2 2/6] sql: introduce sql_func_find() Mergen Imeev via Tarantool-patches
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=af9e6fa8-3dc0-80f6-f61c-106b75af6635@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 2/6] sql: introduce sql_func_find()' \ /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