Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: remove unnecessary templates for bindings
Date: Wed, 16 May 2018 21:28:37 +0300	[thread overview]
Message-ID: <ca4fb1e5-ea74-0ca3-9744-219bc7438043@tarantool.org> (raw)
In-Reply-To: <f0dadd5a02b6b0b97e22fcb22117f20e814613d9.1526490830.git.kshcherbatov@tarantool.org>

Hello. Thanks for the patch! See my 7 comments below.

On 16/05/2018 20:14, Kirill Shcherbatov wrote:
> Removed ?N binding, changed $V to $N semantics to match
> other vendors standarts.
> 
> Closes #2948
> ---

1. Put the branch and issue links here please.

>   src/box/sql/expr.c           | 13 +++++++-----
>   test/sql-tap/e_expr.test.lua | 50 +++-----------------------------------------
>   test/sql/iproto.result       | 33 +++++++++++++++++++++++++----
>   test/sql/iproto.test.lua     | 14 +++++++++++--
>   4 files changed, 52 insertions(+), 58 deletions(-)
> 
> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
> index 1b51823..cd2f549 100644
> --- a/src/box/sql/expr.c
> +++ b/src/box/sql/expr.c
> @@ -1073,11 +1073,11 @@ sqlite3ExprFunction(Parse * pParse, ExprList * pList, Token * pToken)
>    * Wildcards consisting of a single "?" are assigned the next sequential
>    * variable number.
>    *
> - * Wildcards of the form "?nnn" are assigned the number "nnn".  We make
> + * Wildcards of the form "$nnn" are assigned the number "nnn".  We make

2. I still can grep ?nnn in sqliteLimit.h.

>    * sure "nnn" is not too big to avoid a denial of service attack when
>    * the SQL statement comes from an external source.
>    *
> - * Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number
> + * Wildcards of the form ":aaa", "@aaa", are assigned the same number

3. I still see tests on $aaa here: sql-tap/e_expr.test.lua.

4. When you fix comments, please, align them by 66 symbols.

> @@ -1104,7 +1104,10 @@ sqlite3ExprAssignVarNumber(Parse * pParse, Expr * pExpr, u32 n)
>   	} else {
>   		int doAdd = 0;
>   		if (z[0] == '?') {
> -			/* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
> +			sqlite3ErrorMsg(pParse, "Unsupported variable format");

5. This function always must take valid variable, it is guaranteed by a parser. Please,
do this check in parse.y. ?nnn - is syntax error.

> +			return;
> +		} else if (z[0] == '$') {

6. Error message in this 'if' body still outputs '?NNN'

7. I found, that :NNN works too, including SQLite. Please, remove it too.
It works because SQLite interprets any symbols except '$' and '?' as prefix for
name or number parameter.

Example:
tarantool> cn:execute('select * from test where id = :1', {1})
---
- metadata: [{'name': ID}, {'name': 'A'}, {'name': 'B'}]
   rows:
   - [1, 2, '3']
...

We must forbid it.

  reply	other threads:[~2018-05-16 18:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 17:14 [tarantool-patches] " Kirill Shcherbatov
2018-05-16 18:28 ` Vladislav Shpilevoy [this message]
2018-05-17 10:39   ` [tarantool-patches] " Kirill Shcherbatov
2018-05-17 11:56     ` Vladislav Shpilevoy
2018-05-23 15:42       ` Kirill Shcherbatov
2018-05-24 12:20         ` Vladislav Shpilevoy
2018-05-24 12:37           ` Kirill Shcherbatov
2018-05-24 14:51             ` Kirill Yukhin
2018-05-17 14:20 ` Konstantin Osipov
2018-05-18  5:55 ` Konstantin Osipov

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=ca4fb1e5-ea74-0ca3-9744-219bc7438043@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: remove unnecessary templates for bindings' \
    /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