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 BC1A46EC5B; Wed, 14 Apr 2021 01:58:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BC1A46EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618354687; bh=MokozjXzYKbswoXw2AMZJk3B0qM0x8bWA6rYGh80LCM=; 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=dSBRGOdiO2chXXBapuFkBWEQA+yFA2DwUMvbtNFdSyrJxIxS583qPTflwokUlv7q+ aBZAbI6EymkFoZf6t59lR7L5ZcsoHv5omboqHhEcAlXPmE1/i+aMA+mQfVPvPRfq9h rTs+vY/7nYv2r19xeoJFoiLPjkKe1fhrFlzeXJp4= 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 2EE826EC5B for ; Wed, 14 Apr 2021 01:58:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2EE826EC5B Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lWRyw-0004qK-Bs; Wed, 14 Apr 2021 01:58:06 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <39f3cc5d8873f763fb0d609f64e026120cbf6de4.1618000037.git.imeevma@gmail.com> Message-ID: Date: Wed, 14 Apr 2021 00:58:05 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <39f3cc5d8873f763fb0d609f64e026120cbf6de4.1618000037.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74809299FB6B3996B874F289A033C44AD400182A05F538085040C42F31E1355F5A626D5F791EE8EF97870FD72D762ED4E395084A1988C35CD562 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE727FD6E7FC3A8F857EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370EBB47D88F71BB738638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2B3E168F6CFB34A6215E7C57545E0403B8F4427C359EA06A0D2E47CDBA5A96583C09775C1D3CA48CF17B107DEF921CE79117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE74A95F4E53E8DCE969FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73542F54486E6D6388DC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5B3BFE40AA096B66C9053A8F959C8CEC91DF0D86788C7F504D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D341C998A3771F041534773C4B89C57475D9DAC031756EFA22EC723E20E97F3326A6CF91FC148665ADD1D7E09C32AA3244C4E2FA3F298F4C6B82CD22DA013463F2CB018FE5BB746DCD1FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXGnpxSElXnzlQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382276870DAA3178D773AEB6856979C6344E3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 42/52] sql: introduce mem_to_str() and mem_to_str0() 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 working on this! > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > index 9a0234e60..be7b47e76 100644 > --- a/src/box/sql/mem.c > +++ b/src/box/sql/mem.c > @@ -822,6 +822,130 @@ mem_to_number(struct Mem *mem) <...> > + > +int > +mem_to_str0(struct Mem *mem) > +{ > + if ((mem->flags & (MEM_Str | MEM_Term)) == (MEM_Str | MEM_Term)) > + return 0; > + if ((mem->flags & MEM_Str) != 0) > + return str_to_str0(mem); > + if ((mem->flags & (MEM_Int | MEM_UInt)) != 0) > + return int_to_str0(mem); > + if ((mem->flags & MEM_Real) != 0) > + return double_to_str0(mem); > + if ((mem->flags & MEM_Bool) != 0) > + return bool_to_str0(mem); > + if ((mem->flags & MEM_Blob) != 0) { > + if ((mem->flags & MEM_Subtype) == 0) > + return bin_to_str0(mem); > + if (mp_typeof(*mem->z) == MP_MAP) > + return map_to_str0(mem); > + return array_to_str0(mem); > + } > + return -1; > +} > + > +int > +mem_to_str(struct Mem *mem) > +{ > + if ((mem->flags & MEM_Str) != 0) > + return 0; > + if ((mem->flags & (MEM_Int | MEM_UInt)) != 0) > + return int_to_str0(mem); > + if ((mem->flags & MEM_Real) != 0) > + return double_to_str0(mem); > + if ((mem->flags & MEM_Bool) != 0) > + return bool_to_str0(mem); > + if ((mem->flags & MEM_Blob) != 0) { > + if ((mem->flags & MEM_Subtype) == 0) > + return bin_to_str(mem); > + if (mp_typeof(*mem->z) == MP_MAP) > + return map_to_str0(mem); > + return array_to_str0(mem); > + } > + return -1; In the old function there was an assertion that only simple types are passed (no Aggs, Frames). Please, keep it, or add a diag_set() here. The same above.