From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp57.i.mail.ru (smtp57.i.mail.ru [217.69.128.37]) (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 E567D46970E for ; Tue, 24 Dec 2019 23:26:45 +0300 (MSK) Date: Tue, 24 Dec 2019 23:26:44 +0300 From: Sergey Ostanevich Message-ID: <20191224202644.GK19594@tarantool.org> References: <4ba0013eb8ac41efc27efa411116746fc7d89905.1576844632.git.korablev@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4ba0013eb8ac41efc27efa411116746fc7d89905.1576844632.git.korablev@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v3 11/20] sql: resurrect sql_bind_parameter_name() 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: > We may need to get name of parameter to be bound by its index position. > So let's resurrect sql_bind_parameter_name() - put its prototype to > sql/sqlInt.h header and update codestyle. > > Need for #2592 > --- > src/box/sql/sqlInt.h | 8 ++++++++ > src/box/sql/vdbeapi.c | 14 ++++---------- > 2 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h > index a9faaa6e7..09f638268 100644 > --- a/src/box/sql/sqlInt.h > +++ b/src/box/sql/sqlInt.h > @@ -695,6 +695,14 @@ sql_bind_zeroblob64(sql_stmt *, int, > int > sql_bind_parameter_count(const struct sql_stmt *stmt); > > +/** > + * Return the name of a wildcard parameter. Return NULL if the index > + * is out of range or if the wildcard is unnamed. Parameter's index > + * is 0-based. > + */ > +const char * > +sql_bind_parameter_name(const struct sql_stmt *stmt, int i); > + > /** > * Perform pointer parameter binding for the prepared sql > * statement. > diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c > index 7fda525ce..b1c556ec3 100644 > --- a/src/box/sql/vdbeapi.c > +++ b/src/box/sql/vdbeapi.c > @@ -1058,18 +1058,12 @@ sql_bind_parameter_count(const struct sql_stmt *stmt) > return p->nVar; > } > > -/* > - * Return the name of a wildcard parameter. Return NULL if the index > - * is out of range or if the wildcard is unnamed. > - * > - * The result is always UTF-8. > - */ > const char * > -sql_bind_parameter_name(sql_stmt * pStmt, int i) > +sql_bind_parameter_name(const struct sql_stmt *stmt, int i) > { > - Vdbe *p = (Vdbe *) pStmt; > - if (p == 0) > - return 0; > + struct Vdbe *p = (struct Vdbe *) stmt; > + if (p == NULL) > + return NULL; > return sqlVListNumToName(p->pVList, i); > } > > -- > 2.15.1 >