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 66DFE6DB24; Thu, 11 Nov 2021 13:56:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 66DFE6DB24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1636628196; bh=9qAp+qjpJYYb9rtpGGCPQNoJW6OkJsZtSA4Iq7lzRAo=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=x1sxuuIlhVSIKmapQEIArXYFbsBl1em+3PauOodLXZ4Jl2EdiZK0lqzwYh/phX18P za35gL0IEOMqEgYdfRwRbgTQhr9W/fZ2OtH2tkM+rvU20mit4Psa2E/kOoFc+94Yav RYlgBbo4aZwxVk2STn9OLQZzGudqkBzIS2bSzlQw= 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 0D7E17106B for ; Thu, 11 Nov 2021 13:49:14 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0D7E17106B Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1ml7dp-00055C-4r; Thu, 11 Nov 2021 13:49:13 +0300 To: kyukhin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Thu, 11 Nov 2021 13:49:12 +0300 Message-Id: <772e09304164181b8cdd9a859fbe9dd074ac16f7.1636627579.git.imeevma@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9731B3922EC063979EDB9C2FB80C34FA759345864EB942FB700894C459B0CD1B9E3196DC6F75256D57032FE3D0DF10BCCBD7B9CED87D2556700FA531A9826DDA8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE749E89BD568380EECC2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7BF6702EC5472AA0FEA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F27661B8B68CFFDF8BC7938594E20BA1DDCC7F00164DA146DAFE8445B8C89999728AA50765F790063783E00425F71A4181389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8C2B5EEE3591E0D35F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BDC0F6C5B2EEF3D0C75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C7E9FEBB9C11794A10AD8DBE42F2437D01B54CF356FF302939C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFCDE59DDCCE53AF2B699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34B5900AD87B4159A4BA582729007EB1634DF4B0D52FC977620F3C853DBC5474BFD8A6832DDD2730671D7E09C32AA3244C819CE8DFD51171808A63627DCB284E2C3A76366E8A9DE7CA729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj4t8MBgWr8bKxyIK+hU2Vww== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D25581762BE41E774CAAD653D6DB4E44283D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH v1 13/21] sql: refactor VERSION() function 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: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Part of #4145 --- src/box/sql/func.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/box/sql/func.c b/src/box/sql/func.c index dcd0157d0..59447df56 100644 --- a/src/box/sql/func.c +++ b/src/box/sql/func.c @@ -1021,6 +1021,15 @@ func_uuid(struct sql_context *ctx, int argc, struct Mem *argv) mem_set_uuid(ctx->pOut, &uuid); } +/** Implementation of the VERSION() function. */ +static void +func_version(struct sql_context *ctx, int argc, struct Mem *argv) +{ + (void)argc; + (void)argv; + return mem_set_str0_static(ctx->pOut, (char *)tarantool_version()); +} + static const unsigned char * mem_as_ustr(struct Mem *mem) { @@ -1346,22 +1355,6 @@ likeFunc(sql_context *context, int argc, struct Mem *argv) mem_set_bool(context->pOut, res == MATCH); } -/** - * Implementation of the version() function. The result is the - * version of the Tarantool that is running. - * - * @param context Context being used. - * @param unused1 Unused. - * @param unused2 Unused. - */ -static void -sql_func_version(struct sql_context *context, int argc, struct Mem *argv) -{ - (void)argc; - (void)argv; - sql_result_text(context, tarantool_version(), -1, SQL_STATIC); -} - /* * Implementation of the QUOTE() function. This function takes a single * argument. If the argument is numeric, the return value is the same as @@ -1912,7 +1905,7 @@ static struct sql_func_definition definitions[] = { NULL}, {"UUID", 0, {}, FIELD_TYPE_UUID, func_uuid, NULL}, {"UUID", 1, {FIELD_TYPE_INTEGER}, FIELD_TYPE_UUID, func_uuid, NULL}, - {"VERSION", 0, {}, FIELD_TYPE_STRING, sql_func_version, NULL}, + {"VERSION", 0, {}, FIELD_TYPE_STRING, func_version, NULL}, {"ZEROBLOB", 1, {FIELD_TYPE_INTEGER}, FIELD_TYPE_VARBINARY, func_zeroblob, NULL}, }; -- 2.25.1