Tim He
Tim He

Reputation: 420

A strange SQL syntax

I can't understand the SQL syntax here: CREATE... and INSERT... are OK, while the last snippet failed, the mysql-client doesn't recognize let,eval and dec. I didn't find any supporting documents. Does it need special command line tool or plugins to execute?

I know that may be a stupid question.

create table t1 (
  pk int primary key auto_increment,
  i int,
  j int,
  k int,
  index (i),
  index (j),
  index (k)
) engine=myisam;

insert into t1 (i,j,k) values (1,1,1);

let $1=12;
set @d=1;
while ($1)
{
  eval insert into t1 (i,j,k) select i+@d, j+@d, k+@d from t1;
  eval set @d=@d*2;
  dec $1;
}

Here is the source of the sqls above.

Thank you.

Upvotes: 1

Views: 141

Answers (1)

Barmar
Barmar

Reputation: 780974

This is the mysqltest language used by the MySQL Test Framework. The syntax is documented here.

It looks to me like it's inspired by BASIC and PHP.

Upvotes: 3

Related Questions