From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 3FAEC4696CB for ; Thu, 21 Nov 2019 00:28:32 +0300 (MSK) From: Nikita Pettik Date: Thu, 21 Nov 2019 00:28:12 +0300 Message-Id: <203fef6b30097343b51bf31dc624a8219dd8a736.1574277369.git.korablev@tarantool.org> In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH v2 13/16] sql: introduce sql_stmt_query_str() method List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: v.shpilevoy@tarantool.org It is getter to fetch string of SQL query from prepared statement. Needed for #2592 --- src/box/execute.h | 6 ++++++ src/box/sql/vdbeapi.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/box/execute.h b/src/box/execute.h index d5b4d8421..16b424d36 100644 --- a/src/box/execute.h +++ b/src/box/execute.h @@ -124,6 +124,12 @@ sql_finalize(struct sql_stmt *stmt); size_t sql_stmt_sizeof(const struct sql_stmt *stmt); +/** + * Return string of SQL query. + */ +const char * +sql_stmt_query_str(const struct sql_stmt *stmt); + /** * Prepare (compile into VDBE byte-code) statement. * diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c index 10135bb68..0978e12fd 100644 --- a/src/box/sql/vdbeapi.c +++ b/src/box/sql/vdbeapi.c @@ -858,6 +858,13 @@ sql_stmt_sizeof(const sql_stmt *stmt) return size; } +const char * +sql_stmt_query_str(const sql_stmt *stmt) +{ + struct Vdbe *v = (struct Vdbe *) stmt; + return v->zSql; +} + /******************************* sql_bind_ ************************** * * Routines used to attach values to wildcards in a compiled SQL statement. -- 2.15.1