From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp47.i.mail.ru (smtp47.i.mail.ru [94.100.177.107]) (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 B7F1E46970E for ; Wed, 25 Dec 2019 16:37:45 +0300 (MSK) Date: Wed, 25 Dec 2019 16:37:45 +0300 From: Sergey Ostanevich Message-ID: <20191225133744.GM19594@tarantool.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH v3 12/20] sql: add sql_stmt_schema_version() List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the patch, LGTM. Sergos On 20 Dec 15:47, Nikita Pettik wrote: > 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. > Statements with schema version different from the current one are > considered to be expired and should be re-compiled. > > Needed for #2592 > --- > src/box/sql/sqlInt.h | 3 +++ > src/box/sql/vdbeapi.c | 7 +++++++ > 2 files changed, 10 insertions(+) > > diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h > index 09f638268..7dfc29809 100644 > --- a/src/box/sql/sqlInt.h > +++ b/src/box/sql/sqlInt.h > @@ -571,6 +571,9 @@ sql_column_name(sql_stmt *, int N); > const char * > sql_column_datatype(sql_stmt *, int N); > > +uint32_t > +sql_stmt_schema_version(const struct sql_stmt *stmt); > + > int > sql_initialize(void); > > diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c > index b1c556ec3..7d9ce11e7 100644 > --- a/src/box/sql/vdbeapi.c > +++ b/src/box/sql/vdbeapi.c > @@ -798,6 +798,13 @@ sql_column_decltype(sql_stmt * pStmt, int N) > COLNAME_DECLTYPE); > } > > +uint32_t > +sql_stmt_schema_version(const struct sql_stmt *stmt) > +{ > + struct Vdbe *v = (struct Vdbe *) stmt; > + return v->schema_ver; > +} > + > /******************************* sql_bind_ ************************** > * > * Routines used to attach values to wildcards in a compiled SQL statement. > -- > 2.15.1 >