[Tarantool-patches] [PATCH v3 05/20] sql: rename sql_finalize() to sql_stmt_finalize()
Sergey Ostanevich
sergos at tarantool.org
Tue Dec 24 15:08:05 MSK 2019
Hi!
Thanks for the patch, LGTM.
Sergos.
On 20 Dec 15:47, Nikita Pettik wrote:
> Let's follow unified naming rules for SQL high level API which
> manipulates on statements objects. To be more precise, let's use
> 'sql_stmt_' prefix for interface functions operating on statement
> handles.
> ---
> src/box/bind.c | 2 +-
> src/box/ck_constraint.c | 4 ++--
> src/box/execute.c | 2 +-
> src/box/lua/execute.c | 2 +-
> src/box/sql/analyze.c | 6 +++---
> src/box/sql/sqlInt.h | 2 +-
> src/box/sql/vdbe.c | 4 ++--
> src/box/sql/vdbeapi.c | 2 +-
> 8 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/src/box/bind.c b/src/box/bind.c
> index 7eea9fcc8..bbc1f56df 100644
> --- a/src/box/bind.c
> +++ b/src/box/bind.c
> @@ -180,7 +180,7 @@ sql_bind_column(struct sql_stmt *stmt, const struct sql_bind *p,
> * Parameters are allocated within message pack,
> * received from the iproto thread. IProto thread
> * now is waiting for the response and it will not
> - * free the packet until sql_finalize. So
> + * free the packet until sql_stmt_finalize. So
> * there is no need to copy the packet and we can
> * use SQL_STATIC.
> */
> diff --git a/src/box/ck_constraint.c b/src/box/ck_constraint.c
> index a2c66ce00..551bdd397 100644
> --- a/src/box/ck_constraint.c
> +++ b/src/box/ck_constraint.c
> @@ -141,7 +141,7 @@ ck_constraint_program_compile(struct ck_constraint_def *ck_constraint_def,
> diag_set(ClientError, ER_CREATE_CK_CONSTRAINT,
> ck_constraint_def->name,
> box_error_message(box_error_last()));
> - sql_finalize((struct sql_stmt *) v);
> + sql_stmt_finalize((struct sql_stmt *) v);
> return NULL;
> }
> return (struct sql_stmt *) v;
> @@ -254,7 +254,7 @@ error:
> void
> ck_constraint_delete(struct ck_constraint *ck_constraint)
> {
> - sql_finalize(ck_constraint->stmt);
> + sql_stmt_finalize(ck_constraint->stmt);
> ck_constraint_def_delete(ck_constraint->def);
> TRASH(ck_constraint);
> free(ck_constraint);
> diff --git a/src/box/execute.c b/src/box/execute.c
> index af66447b5..fb83e1194 100644
> --- a/src/box/execute.c
> +++ b/src/box/execute.c
> @@ -100,7 +100,7 @@ static void
> port_sql_destroy(struct port *base)
> {
> port_tuple_vtab.destroy(base);
> - sql_finalize(((struct port_sql *)base)->stmt);
> + sql_stmt_finalize(((struct port_sql *)base)->stmt);
> }
>
> const struct port_vtab port_sql_vtab = {
> diff --git a/src/box/lua/execute.c b/src/box/lua/execute.c
> index ffa3d4d2e..68adacf72 100644
> --- a/src/box/lua/execute.c
> +++ b/src/box/lua/execute.c
> @@ -217,7 +217,7 @@ lua_sql_bind_list_decode(struct lua_State *L, struct sql_bind **out_bind,
> size_t size = sizeof(struct sql_bind) * bind_count;
> /*
> * Memory allocated here will be freed in
> - * sql_finalize() or in txn_commit()/txn_rollback() if
> + * sql_stmt_finalize() or in txn_commit()/txn_rollback() if
> * there is an active transaction.
> */
> struct sql_bind *bind = (struct sql_bind *) region_alloc(region, size);
> diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c
> index 42e2a1a2f..f74f9b358 100644
> --- a/src/box/sql/analyze.c
> +++ b/src/box/sql/analyze.c
> @@ -1424,7 +1424,7 @@ load_stat_from_space(const char *sql_select_prepare,
> current_idx_count++;
>
> }
> - rc = sql_finalize(stmt);
> + rc = sql_stmt_finalize(stmt);
> if (rc)
> goto finalize;
> rc = sql_stmt_compile(sql_select_load, -1, NULL, &stmt, 0);
> @@ -1475,7 +1475,7 @@ load_stat_from_space(const char *sql_select_prepare,
> sample->sample_key = region_alloc(&fiber()->gc,
> sample->key_size);
> if (sample->sample_key == NULL) {
> - sql_finalize(stmt);
> + sql_stmt_finalize(stmt);
> rc = -1;
> diag_set(OutOfMemory, sample->key_size,
> "region", "sample_key");
> @@ -1488,7 +1488,7 @@ load_stat_from_space(const char *sql_select_prepare,
> }
> stats[current_idx_count].sample_count++;
> }
> - rc = sql_finalize(stmt);
> + rc = sql_stmt_finalize(stmt);
> if (rc == 0 && prev_index != NULL)
> init_avg_eq(prev_index, &stats[current_idx_count]);
> assert(current_idx_count <= index_count);
> diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
> index 03deb733c..cf0b946f1 100644
> --- a/src/box/sql/sqlInt.h
> +++ b/src/box/sql/sqlInt.h
> @@ -521,7 +521,7 @@ sql_column_value(sql_stmt *,
> int iCol);
>
> int
> -sql_finalize(sql_stmt * pStmt);
> +sql_stmt_finalize(sql_stmt * pStmt);
>
> /*
> * Terminate the current execution of an SQL statement and reset
> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index ab86be9a9..336fd4a52 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -1084,7 +1084,7 @@ case OP_Yield: { /* in1, jump */
> * automatically.
> *
> * P1 is the result code returned by sql_exec(),
> - * sql_reset(), or sql_finalize(). For a normal halt,
> + * sql_reset(), or sql_stmt_finalize(). For a normal halt,
> * this should be 0.
> * For errors, it can be some other value. If P1!=0 then P2 will
> * determine whether or not to rollback the current transaction.
> @@ -2887,7 +2887,7 @@ case OP_MakeRecord: {
> * memory shouldn't be reused until it is written into WAL.
> *
> * However, if memory for ephemeral space is allocated
> - * on region, it will be freed only in sql_finalize()
> + * on region, it will be freed only in sql_stmt_finalize()
> * routine.
> */
> if (bIsEphemeral) {
> diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
> index ab8441bc5..7463fb9d7 100644
> --- a/src/box/sql/vdbeapi.c
> +++ b/src/box/sql/vdbeapi.c
> @@ -76,7 +76,7 @@ invokeProfileCallback(sql * db, Vdbe * p)
> * machine.
> */
> int
> -sql_finalize(sql_stmt * pStmt)
> +sql_stmt_finalize(sql_stmt * pStmt)
> {
> if (pStmt == NULL)
> return 0;
> --
> 2.15.1
>
More information about the Tarantool-patches
mailing list