From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: kyukhin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v2 1/2] sql: rename some sql_ephemeral_space_* functions Date: Tue, 17 Aug 2021 14:55:01 +0300 [thread overview] Message-ID: <58ae14ebee1aa6d28b11a395d37f270b29d40f72.1629201235.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1629201235.git.imeevma@gmail.com> This patch renames sql_ephemeral_space_new() to sql_template_space_new() and sql_ephemeral_space_def_new() to sql_template_space_def_new(). The objects created by these functions are not really ephemeral space or space_def and have a single purpose - to create a "template" space that will be used later when creating real space. Needed for #6213 --- src/box/sql.c | 11 +++++------ src/box/sql.h | 4 ++-- src/box/sql/build.c | 4 ++-- src/box/sql/select.c | 8 ++++---- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/box/sql.c b/src/box/sql.c index c805a1e5c..0e93aa7bb 100644 --- a/src/box/sql.c +++ b/src/box/sql.c @@ -1161,14 +1161,14 @@ space_column_default_expr(uint32_t space_id, uint32_t fieldno) } /** - * Create and initialize a new ephemeral space_def object. + * Create and initialize a new template space_def object. * @param parser SQL Parser object. * @param name Name of space to be created. * @retval NULL on memory allocation error, Parser state changed. * @retval not NULL on success. */ static struct space_def * -sql_ephemeral_space_def_new(struct Parse *parser, const char *name) +sql_template_space_def_new(struct Parse *parser, const char *name) { struct space_def *def = NULL; size_t name_len = name != NULL ? strlen(name) : 0; @@ -1178,8 +1178,7 @@ sql_ephemeral_space_def_new(struct Parse *parser, const char *name) def = (struct space_def *)region_aligned_alloc(&parser->region, size, alignof(*def)); if (def == NULL) { - diag_set(OutOfMemory, size, "region_aligned_alloc", - "sql_ephemeral_space_def_new"); + diag_set(OutOfMemory, size, "region_aligned_alloc", "def"); parser->is_aborted = true; return NULL; } @@ -1192,7 +1191,7 @@ sql_ephemeral_space_def_new(struct Parse *parser, const char *name) } struct space * -sql_ephemeral_space_new(Parse *parser, const char *name) +sql_template_space_new(Parse *parser, const char *name) { size_t sz; struct space *space = region_alloc_object(&parser->region, @@ -1204,7 +1203,7 @@ sql_ephemeral_space_new(Parse *parser, const char *name) } memset(space, 0, sz); - space->def = sql_ephemeral_space_def_new(parser, name); + space->def = sql_template_space_def_new(parser, name); if (space->def == NULL) return NULL; diff --git a/src/box/sql.h b/src/box/sql.h index 2ac97c762..3ff00e64a 100644 --- a/src/box/sql.h +++ b/src/box/sql.h @@ -221,14 +221,14 @@ void sql_expr_delete(struct sql *db, struct Expr *expr, bool extern_alloc); /** - * Create and initialize a new ephemeral space object. + * Create and initialize a new template space object. * @param parser SQL Parser object. * @param name Name of space to be created. * @retval NULL on memory allocation error, Parser state changed. * @retval not NULL on success. */ struct space * -sql_ephemeral_space_new(struct Parse *parser, const char *name); +sql_template_space_new(struct Parse *parser, const char *name); /** * Duplicate Expr list. diff --git a/src/box/sql/build.c b/src/box/sql/build.c index 6470e0300..478037f29 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -225,7 +225,7 @@ sqlStartTable(Parse *pParse, Token *pName) if (sqlCheckIdentifierName(pParse, zName) != 0) goto cleanup; - new_space = sql_ephemeral_space_new(pParse, zName); + new_space = sql_template_space_new(pParse, zName); if (new_space == NULL) goto cleanup; @@ -300,7 +300,7 @@ static struct space * sql_shallow_space_copy(struct Parse *parse, struct space *space) { assert(space->def != NULL); - struct space *ret = sql_ephemeral_space_new(parse, space->def->name); + struct space *ret = sql_template_space_new(parse, space->def->name); if (ret == NULL) goto error; ret->index_count = space->index_count; diff --git a/src/box/sql/select.c b/src/box/sql/select.c index b9107fccc..7cfe60db6 100644 --- a/src/box/sql/select.c +++ b/src/box/sql/select.c @@ -2061,7 +2061,7 @@ sqlResultSetOfSelect(Parse * pParse, Select * pSelect) while (pSelect->pPrior) pSelect = pSelect->pPrior; pParse->sql_flags = saved_flags; - struct space *space = sql_ephemeral_space_new(pParse, NULL); + struct space *space = sql_template_space_new(pParse, NULL); if (space == NULL) return NULL; /* The sqlResultSetOfSelect() is only used in contexts where lookaside @@ -4688,7 +4688,7 @@ withExpand(Walker * pWalker, struct SrcList_item *pFrom) } assert(pFrom->space == NULL); - pFrom->space = sql_ephemeral_space_new(pParse, pCte->zName); + pFrom->space = sql_template_space_new(pParse, pCte->zName); if (pFrom->space == NULL) return WRC_Abort; pFrom->pSelect = sqlSelectDup(db, pCte->pSelect, 0); @@ -4888,8 +4888,8 @@ selectExpander(Walker * pWalker, Select * p) */ const char *name = "sql_sq_DEADBEAFDEADBEAF"; struct space *space = - sql_ephemeral_space_new(sqlParseToplevel(pParse), - name); + sql_template_space_new(sqlParseToplevel(pParse), + name); if (space == NULL) return WRC_Abort; pFrom->space = space; -- 2.25.1
next prev parent reply other threads:[~2021-08-17 11:55 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-17 11:54 [Tarantool-patches] [PATCH v2 0/2] Define field types in ephemeral spaces Mergen Imeev via Tarantool-patches 2021-08-17 11:55 ` Mergen Imeev via Tarantool-patches [this message] 2021-08-17 11:55 ` [Tarantool-patches] [PATCH v2 2/2] sql: define ephemeral space fields Mergen Imeev via Tarantool-patches 2021-08-18 10:31 ` Vitaliia Ioffe via Tarantool-patches 2021-08-17 12:29 ` [Tarantool-patches] [PATCH v2 0/2] Define field types in ephemeral spaces Vladimir Davydov via Tarantool-patches 2021-08-18 12:18 ` Kirill Yukhin via Tarantool-patches -- strict thread matches above, loose matches on Subject: below -- 2021-08-17 10:43 Mergen Imeev via Tarantool-patches 2021-08-17 10:43 ` [Tarantool-patches] [PATCH v2 1/2] sql: rename some sql_ephemeral_space_* functions Mergen Imeev via Tarantool-patches 2021-08-17 11:40 ` Vladimir Davydov 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=58ae14ebee1aa6d28b11a395d37f270b29d40f72.1629201235.git.imeevma@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=kyukhin@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 1/2] sql: rename some sql_ephemeral_space_* functions' \ /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