From: "n.pettik" <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: Ivan Koptelov <ivan.koptelov@tarantool.org> Subject: [tarantool-patches] Re: [PATCH] sql: LIKE/LENGTH process '\0' Date: Tue, 29 Jan 2019 19:35:57 +0300 [thread overview] Message-ID: <1560FF96-FECD-4368-8AF8-F8F2AE7696E3@tarantool.org> (raw) In-Reply-To: <15e143f4-3ea7-c7d6-d8ac-8a0e20b76449@tarantool.org> > Fixes LIKE and LENGTH functions. '\0' now treated as Nit: is treated. > a usual symbol. Strings with '\0' are now processed > entirely. Consider examples: > > LENGTH(CHAR(65,00,65)) == 3 > LIKE(CHAR(65,00,65), CHAR(65,00,66)) == False Also, I see that smth wrong with text in this mail again. > > Closes #3542 Please, check other functions working with strings. For instance, now I see that replace ignores \0 as well: tarantool> box.sql.execute("select replace(CHAR(65,00,66), char(0), char(1))") --- - - ["A\0B"] ... > @@ -150,9 +150,13 @@ lengthFunc(sqlite3_context * context, int argc, sqlite3_value ** argv) > const unsigned char *z = sqlite3_value_text(argv[0]); > if (z == 0) > return; > + Nit: don’t abuse empty lines. > len = 0; > - while (*z) { > + size_t byte_len = sqlite3_value_bytes(argv[0]); > + const unsigned char *prev_z; > + for (size_t cnt = 0; cnt < byte_len; cnt += (z - prev_z)) { Out of 80. > diff --git a/test/sql-tap/gh-3542-like-len-null-term.test.lua b/test/sql-tap/gh-3542-like-len-null-term.test.lua > new file mode 100755 > index 000000000..e9ea9ea30 > --- /dev/null > +++ b/test/sql-tap/gh-3542-like-len-null-term.test.lua > @@ -0,0 +1,97 @@ > +#!/usr/bin/env tarantool > +test = require("sqltester") > +test:plan(14) > + > +-- gh-3542 - LIKE/LENGTH do not scan if '\0' is encountered. > +-- This test ensures that LIKE and LENGTH functions does NOT stop > +-- string processing if '\0' is encountered. I’d rather put these tests to sql-tap/func.test.lua
next prev parent reply other threads:[~2019-01-29 16:36 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-29 9:56 [tarantool-patches] " Ivan Koptelov 2019-01-29 16:35 ` n.pettik [this message] 2019-02-04 12:34 ` [tarantool-patches] " Ivan Koptelov 2019-02-05 13:50 ` n.pettik 2019-02-07 15:14 ` i.koptelov 2019-02-11 13:15 ` n.pettik 2019-02-13 15:46 ` i.koptelov 2019-02-14 12:57 ` n.pettik 2019-02-20 13:54 ` i.koptelov 2019-02-20 15:47 ` i.koptelov 2019-02-20 16:04 ` n.pettik 2019-02-20 18:08 ` Vladislav Shpilevoy 2019-02-20 19:24 ` i.koptelov 2019-02-22 12:59 ` n.pettik 2019-02-25 11:09 ` i.koptelov 2019-02-25 15:10 ` n.pettik 2019-02-26 13:33 ` i.koptelov 2019-02-26 17:50 ` n.pettik 2019-02-26 18:44 ` i.koptelov 2019-02-26 20:16 ` Vladislav Shpilevoy 2019-03-04 11:59 ` i.koptelov 2019-03-04 15:30 ` Kirill Yukhin
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=1560FF96-FECD-4368-8AF8-F8F2AE7696E3@tarantool.org \ --to=korablev@tarantool.org \ --cc=ivan.koptelov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH] sql: LIKE/LENGTH process '\''\0'\''' \ /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