From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0896B45C317 for ; Fri, 20 Dec 2019 15:47:46 +0300 (MSK) From: Nikita Pettik Date: Fri, 20 Dec 2019 15:47:21 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH v3 16/20] sql: move sql_stmt_busy() declaration to box/execute.h List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org We are going to use it in box/execute.c and in SQL prepared statement cache implementation. So to avoid including whole sqlInt.h let's move it to relative small execute.h header. Let's also fix codestyle of this function. Needed for #2592 --- src/box/execute.h | 4 ++++ src/box/sql/sqlInt.h | 3 --- src/box/sql/vdbeapi.c | 10 ++++------ src/box/sql/vdbeaux.c | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/box/execute.h b/src/box/execute.h index f3d6c38b3..61c8e0281 100644 --- a/src/box/execute.h +++ b/src/box/execute.h @@ -127,6 +127,10 @@ sql_stmt_est_size(const struct sql_stmt *stmt); const char * sql_stmt_query_str(const struct sql_stmt *stmt); +/** Return true if statement executes right now. */ +int +sql_stmt_busy(const struct sql_stmt *stmt); + /** * Prepare (compile into VDBE byte-code) statement. * diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h index 7dfc29809..cbe46e790 100644 --- a/src/box/sql/sqlInt.h +++ b/src/box/sql/sqlInt.h @@ -718,9 +718,6 @@ sql_bind_parameter_name(const struct sql_stmt *stmt, int i); int sql_bind_ptr(struct sql_stmt *stmt, int i, void *ptr); -int -sql_stmt_busy(sql_stmt *); - int sql_init_db(sql **db); diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c index 7278d2ab3..01185af5f 100644 --- a/src/box/sql/vdbeapi.c +++ b/src/box/sql/vdbeapi.c @@ -1190,14 +1190,12 @@ sql_db_handle(sql_stmt * pStmt) return pStmt ? ((Vdbe *) pStmt)->db : 0; } -/* - * Return true if the prepared statement is in need of being reset. - */ int -sql_stmt_busy(sql_stmt * pStmt) +sql_stmt_busy(const struct sql_stmt *stmt) { - Vdbe *v = (Vdbe *) pStmt; - return v != 0 && v->magic == VDBE_MAGIC_RUN && v->pc >= 0; + assert(stmt != NULL); + const struct Vdbe *v = (const struct Vdbe *) stmt; + return v->magic == VDBE_MAGIC_RUN && v->pc >= 0; } /* diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c index 619105820..afe1ecb2a 100644 --- a/src/box/sql/vdbeaux.c +++ b/src/box/sql/vdbeaux.c @@ -43,6 +43,7 @@ #include "sqlInt.h" #include "vdbeInt.h" #include "tarantoolInt.h" +#include "box/execute.h" /* * Create a new virtual database engine. -- 2.15.1