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 7116945C316 for ; Fri, 20 Dec 2019 15:47:45 +0300 (MSK) From: Nikita Pettik Date: Fri, 20 Dec 2019 15:47:20 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH v3 15/20] 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 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 2dd4fca03..f3d6c38b3 100644 --- a/src/box/execute.h +++ b/src/box/execute.h @@ -121,6 +121,12 @@ sql_stmt_finalize(struct sql_stmt *stmt); size_t sql_stmt_est_size(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 2ac174112..7278d2ab3 100644 --- a/src/box/sql/vdbeapi.c +++ b/src/box/sql/vdbeapi.c @@ -858,6 +858,13 @@ sql_stmt_est_size(const struct sql_stmt *stmt) return size; } +const char * +sql_stmt_query_str(const struct sql_stmt *stmt) +{ + const struct Vdbe *v = (const struct Vdbe *) stmt; + return v->zSql; +} + /******************************* sql_bind_ ************************** * * Routines used to attach values to wildcards in a compiled SQL statement. -- 2.15.1