From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id AF9682A349 for ; Tue, 26 Mar 2019 10:51:38 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sFtGUPea0W8e for ; Tue, 26 Mar 2019 10:51:38 -0400 (EDT) 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 turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E97E92A2EB for ; Tue, 26 Mar 2019 10:51:37 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH] sql: make SQL_BIND optional in an iproto request From: "n.pettik" In-Reply-To: Date: Tue, 26 Mar 2019 17:51:35 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <416B71F5-C59B-4C35-9C4B-818BB1F766CE@tarantool.org> References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Alexander Turenko Patch is OK as obvious. A few nits below. You could skip them though. > diff --git a/src/box/iproto.cc b/src/box/iproto.cc > index 3b0ba6234..3c054338b 100644 > --- a/src/box/iproto.cc > +++ b/src/box/iproto.cc > @@ -1622,8 +1622,8 @@ tx_process_sql(struct cmsg *m) > struct iproto_msg *msg =3D tx_accept_msg(m); > struct obuf *out; > struct sql_response response; > - struct sql_bind *bind; > - int bind_count; > + struct sql_bind *bind =3D NULL; > + int bind_count =3D 0; > const char *sql; > uint32_t len; >=20 > @@ -1633,7 +1633,8 @@ tx_process_sql(struct cmsg *m) > goto error; > assert(msg->header.type =3D=3D IPROTO_EXECUTE); > tx_inject_delay(); > - bind_count =3D sql_bind_list_decode(msg->sql.bind, &bind); > + if (msg->sql.bind !=3D NULL) > + bind_count =3D sql_bind_list_decode(msg->sql.bind, = &bind); You may apply this diff (that=E2=80=99s matter of taste): diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 3c054338b..8934b7488 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -1633,10 +1633,11 @@ tx_process_sql(struct cmsg *m) goto error; assert(msg->header.type =3D=3D IPROTO_EXECUTE); tx_inject_delay(); - if (msg->sql.bind !=3D NULL) + if (msg->sql.bind !=3D NULL) { bind_count =3D sql_bind_list_decode(msg->sql.bind, = &bind); - if (bind_count < 0) - goto error; + if (bind_count < 0) + goto error; + } sql =3D msg->sql.sql_text; sql =3D mp_decode_str(&sql, &len); if (sql_prepare_and_execute(sql, len, bind, bind_count, = &response, > diff --git a/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua = b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua > new file mode 100755 > index 000000000..55804768c > --- /dev/null > +++ b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua Mb it=E2=80=99s better to move it to sql/iproto.test.lua ?