From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 13ED46EC40; Thu, 8 Jul 2021 00:44:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 13ED46EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1625694270; bh=CLHtqNkdAtgpBp34yJn2ri81YdwybnlB8eDli2qTIlw=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=VCNzZzq8gXkcLp5Cj2z0SYdT+m+YZmeOf2eOpEXOykkO8EVSvI9HOkj9HHU7RplVk vW5/h4xp/DXID1EqbziuLC2Fdmx3TskRVb6T7yLNucuLvik3rgeAOQSYRyWRkvj1r9 00PEfZHOP4tzOyJMaiYxiUxGNfdRV+R1lAiVi2K4= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 4F1A96EC40 for ; Thu, 8 Jul 2021 00:44:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4F1A96EC40 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1m1FLH-0004tZ-LX; Thu, 08 Jul 2021 00:44:28 +0300 To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <2dfba75f-e2f3-83f0-6edb-baf07ea2791b@tarantool.org> Date: Wed, 7 Jul 2021 23:44:26 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD954DFF1DC42D673FB8EEAA58EF109ED2DCA3B880632F394B8182A05F538085040FC660F1DDC4219D0155FFCE93A38F8C91E9C121FB23785BAE813017E6A86AAD5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F9D05773942AAE9CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637EEA194BB48C104EF8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F704F6BFA339E9708C509110B62E6A93117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A563F6D748554FDA14D7BD9043B2B292CC5C2E234492F347D4D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753753CEE10E4ED4A7410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340A58BF0C7EAC340F03B8C5894C0554B866E9F941663E54C5087CE5B654F5FB287573C20D4FEAB6421D7E09C32AA3244CE72875851B60CFEB01ADFD6F8749AC3D30452B15D76AEC14729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojwWhFrYo6Pn2Q+GsdXra3aw== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DBB28AFE165FF539683F489F0B2A2E7603841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 3/3] sql: allow to bind uuid values X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See 4 comments below. On 05.07.2021 17:06, Mergen Imeev via Tarantool-patches wrote: > After this patch, uuid values can be binded like any other supported by 1. binded -> bound. > diff --git a/src/box/bind.h b/src/box/bind.h > index 568c558f3..20f3e7942 100644 > --- a/src/box/bind.h > +++ b/src/box/bind.h > @@ -40,6 +40,8 @@ extern "C" { > #include > > #include "msgpuck.h" > +#include "uuid/tt_uuid.h" > +#include "lib/core/mp_extension_types.h" 2. lib/core is already in the paths. You can omit it. > diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c > index aaae12e41..a9700350d 100644 > --- a/src/box/sql/vdbeapi.c > +++ b/src/box/sql/vdbeapi.c > @@ -840,6 +840,17 @@ sql_bind_zeroblob64(sql_stmt * pStmt, int i, sql_uint64 n) > return sql_bind_zeroblob(pStmt, i, n); > } > > +int > +sql_bind_uuid(struct sql_stmt *stmt, int i, const struct tt_uuid *uuid) > +{ > + struct Vdbe *p = (struct Vdbe *)stmt; > + if (vdbeUnbind(p, i) != 0) > + return -1; > + int rc = sql_bind_type(p, i, "uuid"); > + mem_set_uuid(&p->aVar[i - 1], uuid); 3. Why do you set UUID even if bind_type() failed? > diff --git a/test/sql-tap/gh-6164-uuid-follow-ups.test.lua b/test/sql-tap/gh-6164-uuid-follow-ups.test.lua > index 8872f9f23..426717972 100755 > --- a/test/sql-tap/gh-6164-uuid-follow-ups.test.lua > +++ b/test/sql-tap/gh-6164-uuid-follow-ups.test.lua > @@ -32,4 +32,18 @@ test:do_execsql_test( > true > }) > > +-- Make sure that uuid value can be binded. > +box.execute('CREATE TABLE t(i INT PRIMARY KEY, a UUID);') > +box.execute('INSERT INTO t VALUES(1, ?);', {uuid}); 4. Do you need a table for that? Can you just make 'SELECT ?' with the uuid argument? > + > +test:do_execsql_test( > + "gh-6164-4", > + [[ > + SELECT * FROM t; > + ]], { > + 1, uuid > + }) > + > +box.execute([[DROP TABLE t;]]) > + > test:finish_test() >