[Tarantool-patches] [PATCH v5 39/52] sql: introduce mem_to_int*() functions

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Apr 13 02:39:01 MSK 2021


Good job on the fixes!

This is the last email for today, I will continue the review of
the patchset tomorrow.

See 2 comments below.

> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index 71a827034..e61ad4251 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -1432,17 +1432,14 @@ case OP_AddImm: {            /* in1 */
>   */
>  case OP_MustBeInt: {            /* jump, in1 */
>  	pIn1 = &aMem[pOp->p1];
> -	if (!mem_is_int(pIn1)) {
> -		mem_apply_type(pIn1, FIELD_TYPE_INTEGER);
> -		if (!mem_is_int(pIn1)) {
> -			if (pOp->p2==0) {
> -				diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
> -					 mem_str(pIn1), "integer");
> -				goto abort_due_to_error;
> -			} else {
> -				goto jump_to_p2;
> -			}
> -		}
> +	if (mem_is_int(pIn1))

1. The same check is done inside mem_to_int_precise(). You
don't need to do it manually.

> +		break;
> +	if (mem_to_int_precise(pIn1) != 0) {
> +		if (pOp->p2 !=0 )

2. Whitespace should be before '0', not after.

> +			goto jump_to_p2;
> +		diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
> +			 mem_str(pIn1), "integer");
> +		goto abort_due_to_error;
>  	}
>  	break;
>  }
> 


More information about the Tarantool-patches mailing list