# ORを使った検索時に並列処理
# Bug report 2370

Begin;
Initialize;
InitializeSession "TESTDB";

Command "drop database TESTDB if exists";
Command "create database TESTDB";

Command "create table TBL (f int, g ntext, h int array[no limit], i char(1))";
Command "create index TBL_f on TBL(f)";
Command "create fulltext index TBL_g on TBL(g)";
Command "create array index TBL_h on TBL(h)";
Command "create bitmap index TBL_i on TBL(i)";

Command "insert TBL values (1, 'foo', array[1,3,5], 'a')";
Command "insert TBL values (2, 'bar', array[2,4,6], 'b')";
Command "insert TBL select f+2, g||' boo', h||array[7], 'c' from TBL";
Command "insert TBL select f+4, g||' bal', h||array[8], 'd' from TBL";
Command "insert TBL select f+8, g||' hoge', h||array[9], 'e' from TBL";

Command "select * from TBL where f > 10 and g contains 'boo' and h[] = 6 and i = 'd'";
Command "select * from TBL where f > 10 and g contains 'boo' or h[] = 6 and i = 'd'";
Command "select * from TBL where f > 10 or g contains 'boo' or h[] = 6 and i = 'd'";
Command "select * from TBL where f > 10 and g contains 'boo' or h[] = 6 or i = 'd'";
Command "select * from TBL where f > 10 or g contains 'boo' or h[] = 6 or i = 'd'";

Command "select * from TBL where f > 10 and (g contains 'boo' or h[] = 6) and i = 'd'";
Command "select * from TBL where (f > 10 or g contains 'boo' or h[] = 6) and i = 'd'";
Command "select * from TBL where f > 10 and (g contains 'boo' or h[] = 6 or i = 'd')";

Command "select * from TBL where f > 10 and g contains 'boo' and h[] = 6 and i = 'd' order by score(g) desc";
Command "select * from TBL where f > 10 and g contains 'boo' or h[] = 6 and i = 'd' order by score(g) desc";
Command "select * from TBL where f > 10 or g contains 'boo' or h[] = 6 and i = 'd' order by score(g) desc";
Command "select * from TBL where f > 10 and g contains 'boo' or h[] = 6 or i = 'd' order by score(g) desc";
Command "select * from TBL where f > 10 or g contains 'boo' or h[] = 6 or i = 'd' order by score(g) desc";

Command "select * from TBL where f > 10 and (g contains 'boo' or h[] = 6) and i = 'd' order by score(g) desc";
Command "select * from TBL where (f > 10 or g contains 'boo' or h[] = 6) and i = 'd' order by score(g) desc";
Command "select * from TBL where f > 10 and (g contains 'boo' or h[] = 6 or i = 'd') order by score(g) desc";

TerminateSession;
Terminate;
End;
