[Tarantool-patches] [PATCH v2 1/2] sql: rename some sql_ephemeral_space_* functions
imeevma at tarantool.org
imeevma at tarantool.org
Tue Aug 17 14:55:01 MSK 2021
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
More information about the Tarantool-patches
mailing list