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 E9F74440F40 for ; Thu, 7 Nov 2019 04:05:07 +0300 (MSK) From: Nikita Pettik Date: Thu, 7 Nov 2019 04:04:50 +0300 Message-Id: <20191107010455.64457-11-korablev@tarantool.org> In-Reply-To: <20191107010455.64457-1-korablev@tarantool.org> References: <20191107010455.64457-1-korablev@tarantool.org> Subject: [Tarantool-patches] [PATCH 10/15] sql: add sql_schema_version() 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 Let's introduce interface function to get schema version of prepared statement. It is required since sturct sql_stmt (i.e. prepared statement) is an opaque object and in fact is an alias to struct Vdbe. Need for #2592 --- src/box/sql/sqlInt.h | 3 +++ src/box/sql/vdbeapi.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h index 1c02bd972..3a1e6d9b4 100644 --- a/src/box/sql/sqlInt.h +++ b/src/box/sql/sqlInt.h @@ -561,6 +561,9 @@ sql_column_name(sql_stmt *, int N); const char * sql_column_datatype(sql_stmt *, int N); +uint32_t +sql_schema_version(sql_stmt *stmt); + int sql_initialize(void); diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c index 482a42288..23c4a250a 100644 --- a/src/box/sql/vdbeapi.c +++ b/src/box/sql/vdbeapi.c @@ -798,6 +798,12 @@ sql_column_decltype(sql_stmt * pStmt, int N) COLNAME_DECLTYPE); } +uint32_t +sql_schema_version(sql_stmt *stmt) +{ + return ((struct Vdbe *)stmt)->schema_ver; +} + /******************************* sql_bind_ ************************** * * Routines used to attach values to wildcards in a compiled SQL statement. -- 2.15.1