# PreparedCommandのテスト
Begin;
Initialize;
# テスト用のDBを作る
InitializeSession "";
Command "create database TESTDB";
TerminateSession;

InitializeSession "TESTDB";

# 列がスカラ型であるtableのテスト
# Tableを準備する
Command  "create table T1(C1 int, C2 ntext)";
Command  "create fulltext index I1_2 on T1(C2) hint 'inverted=(nolocation=true)'";
# 検索対象となるタプルを準備する
CreatePreparedCommand "ins" "insert into T1 (C1, C2) values (?, ?)";
PreparedCommand "ins" [1, "ほげ"];
PreparedCommand "ins" [2, "ほげほげ"];
PreparedCommand "ins" [3, "げほげほ"];
PreparedCommand "ins" [4, "はらほげ"];
PreparedCommand "ins" [5, "ほえ"];
PreparedCommand "ins" [6, ""];
ErasePreparedCommand "ins";

Command "select * from T1";

# スコア検索を行う
CreatePreparedCommand "sel" "select C1, score(C2) from T1 where C2 like ?";
PreparedCommand "sel" ["ほげ"];
PreparedCommand "sel" ["%ほげ"];
PreparedCommand "sel" ["ほげ%"];
PreparedCommand "sel" ["%ほげ%"];
ErasePreparedCommand "sel";

# tableの後始末
Command  "drop table T1";
TerminateSession;

# DBの後始末
InitializeSession "";
Command "drop database TESTDB";
TerminateSession;
Terminate;
End;
