From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v1 3/3] sql: allow to bind uuid values Date: Wed, 7 Jul 2021 23:44:26 +0200 [thread overview] Message-ID: <2dfba75f-e2f3-83f0-6edb-baf07ea2791b@tarantool.org> (raw) In-Reply-To: <e2e290d374e5cb1becda12e24d8cf194f658f0fd.1625497228.git.imeevma@gmail.com> 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 <stdlib.h> > > #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() >
prev parent reply other threads:[~2021-07-07 21:44 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-05 15:04 [Tarantool-patches] [PATCH v1 0/3] Follow ups for uuid introduction Mergen Imeev via Tarantool-patches 2021-07-05 15:06 ` [Tarantool-patches] [PATCH v1 1/3] sql: introduce uuid to quote() Mergen Imeev via Tarantool-patches 2021-07-07 21:41 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-05 15:06 ` [Tarantool-patches] [PATCH v1 2/3] sql: fix uuid behaviour in least() and greatest() Mergen Imeev via Tarantool-patches 2021-07-07 21:42 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-10 14:36 ` Mergen Imeev via Tarantool-patches 2021-07-05 15:06 ` [Tarantool-patches] [PATCH v1 3/3] sql: allow to bind uuid values Mergen Imeev via Tarantool-patches 2021-07-07 21:44 ` Vladislav Shpilevoy via Tarantool-patches [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=2dfba75f-e2f3-83f0-6edb-baf07ea2791b@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1 3/3] sql: allow to bind uuid values' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox