Thursday, June 5, 2008

How to concatenate strings in a mysqltest testcase

Hi Magnus, is there a way to concatenate strings in a mysqltest?
=================================================================


Yes, you can "easily" create more dynamic strings using let and a while loop. For example like this:


let $c= 254;
let $str= t255;

while ($c)
{
let $str= t$c,$str;
dec $c;
}
echo $str;


This will printout t1, t2, t3, ... t255.


You can then use the $str variable in an eval
to CREATE TABLE, VIEW or SELECT


eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str);

No comments: