Begin;
Initialize;
InitializeSession  "TESTDB";
Command "create database TESTDB";
TerminateSession;
InitializeSession  "TESTDB";
Command "create table T(f1 int, f2 int)";
Command "create  index I_f1 on T(f1)";
Command "insert T values (?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?),(?,?)" [6543210,-34567890,-34567890,2147483647,2147483647,-2147483648,-2147483648,0,0,1,1,-1,-1,6543210,6543210,-34567890,-34567890,2147483647,2147483647,-2147483648];
CreatePreparedCommand "sel1" "select * from T where f1 between 0 and 20000000";
PreparedCommand "sel1" [];
PreparedCommand "sel1" [];
Command "start transaction read write";
PreparedCommand "sel1" [];
Command "commit";
ErasePreparedCommand "sel1";
CreatePreparedCommand "sel2" "select * from T where f1 between ? and ? or f2 > -5000000 limit 1";
PreparedCommand "sel2" [0,20000000];
PreparedCommand "sel2" [0,20000000];
Command "start transaction read write";
PreparedCommand "sel2" [0,20000000];
Command "commit";
ErasePreparedCommand "sel2";
CreatePreparedCommand "sel3" "select * from T where not(f1 between 0 and ?)";
PreparedCommand "sel3" [20000000];
PreparedCommand "sel3" [20000000];
Command "start transaction read write";
PreparedCommand "sel3" [20000000];
Command "commit";
ErasePreparedCommand "sel3";
CreatePreparedCommand "sel4" "select * from T where f1 between ? and 20000000 limit 1";
PreparedCommand "sel4" [0];
PreparedCommand "sel4" [0];
Command "start transaction read write";
PreparedCommand "sel4" [0];
Command "commit";
ErasePreparedCommand "sel4";
CreatePreparedCommand "sel5" "select * from T where f1 between 0 and 20000000 or f2 > -5000000 limit 1";
PreparedCommand "sel5" [];
PreparedCommand "sel5" [];
Command "start transaction read write";
PreparedCommand "sel5" [];
Command "commit";
ErasePreparedCommand "sel5";
CreatePreparedCommand "sel6" "select * from T where not(f1 between ? and 20000000)";
PreparedCommand "sel6" [0];
PreparedCommand "sel6" [0];
Command "start transaction read write";
PreparedCommand "sel6" [0];
Command "commit";
ErasePreparedCommand "sel6";
CreatePreparedCommand "sel7" "select * from T where f1 between 0 and ? limit 1";
PreparedCommand "sel7" [20000000];
PreparedCommand "sel7" [20000000];
Command "start transaction read write";
PreparedCommand "sel7" [20000000];
Command "commit";
ErasePreparedCommand "sel7";
CreatePreparedCommand "sel8" "select * from T where f1 between ? and ? or f2 > -5000000";
PreparedCommand "sel8" [0,20000000];
PreparedCommand "sel8" [0,20000000];
Command "start transaction read write";
PreparedCommand "sel8" [0,20000000];
Command "commit";
ErasePreparedCommand "sel8";
CreatePreparedCommand "sel9" "select * from T where not(f1 between 0 and 20000000) limit 1";
PreparedCommand "sel9" [];
PreparedCommand "sel9" [];
Command "start transaction read write";
PreparedCommand "sel9" [];
Command "commit";
ErasePreparedCommand "sel9";
Command "drop table T";
TerminateSession;
InitializeSession  "TESTDB";
Command "drop database TESTDB";
TerminateSession;
Terminate;
End;
