maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12280
Re: (no subject)
Hi, Игорь!
On Jun 12, Игорь Балашенко wrote:
> Hello mariaDB developers!
> I am a participant of GSOC 2020 mentored by Nikita Malyavin and Sergey
> Golubchik.
> Currently I am working on mysqltest parser improvements and I have a
> question to discuss with everyone:
>
> To be short:
>
> Currently there are expressions in if and while to be calculated
> i.e
>
> if(<expr>)
> code
> But it is written using switch and works only in condition block.
and it only supports the form of "var OP const" where OP is a comparison
operator.
> Code like:
>
> let $a= 1 + 2
> Makes $a = "1 + 2"
>
> Obviously mysqltest syntax needs proper expressions thats why I
> decided to make them.
> There are following questions:
>
> What syntax do you want to see?
>
> let $a = 1 + 2
> $a = 3
> Is a bad idea because we will break lots of previous taest cases.
On the other hand, they just need to be fixed once. Old behavior is
quite unexpected and confusing. I think the result will be easier to use
if let will just work as one intuitively expects.
> let $a = $((1 + 2))
> That is done in a bash style, so it seems to be more comfortable to
> everyone.
Also there's an approach that MySQL took:
expr $a = 1 + 2
we don't have to be compatible with MySQL on the mysqltest language,
still it's an option to consider.
> Another question is what operators should be in expressions?
> To begin with I want to implement:
>
> +, -. *, /, ++, --, <, >, ==, !=
if/while support ==, !=, <, <=, >, >= so you have to do at least those.
And then, yes, math, +, -, *, /, %. increment/decrement are less useful,
may be do them later?
Don't forget query_get_value(), it's an existing "function", should still
be supported.
I'd like to see more string functions, but let's start from simple math.
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx
References