# lang情報のついた全文索引のテスト(scalar, delayed, fixed text)

Begin;
Initialize;
InitializeSession "DefaultDB";

# 表を作成
Command "create table T (N int, C ntext, L language)";
Command "create index T_I on T(N)";

# 索引作成
Command "create fulltext index FTIndex on T(C) language column L hint 'delayed, inverted=(normalized=true, indexing=dual, tokenizer=DUAL:JAP:ALL:1 @NORMRSCID:1 @UNARSCID:1)'";

#insert
CreatePreparedCommand "ins" "insert into T (N, C, L) values (?, ?, ?)";
PreparedCommand "ins" [0, textucsfile "..\\..\\doc\\takekurabe.txt", "ja+en"];
PreparedCommand "ins" [1, textucsfile "..\\..\\doc\\takekurabe.txt", "ja+en"];
PreparedCommand "ins" [2, textucsfile "..\\..\\doc\\takekurabe.txt", "ja+en"];
PreparedCommand "ins" [3, null, "ja+en"];
ErasePreparedCommand "ins";

CreatePreparedCommand "langs" "select (N, L) from T";
PreparedCommand "langs";
CreatePreparedCommand "sel" "select N from T where C like ? or C like ?";
PreparedCommand "sel" ["%Google%", "%google%"];
Command "verify index FTIndex cascade continue";

Command "select N from T where C like ?" ["%ペイジ%"];
Command "select N from T where C like ?" ["%improve%"];

#update(1)
CreatePreparedCommand "upd1" "update T set L=?";
PreparedCommand "upd1" ["ja+en"];
PreparedCommand "langs";
PreparedCommand "sel" ["%Google%", "%google%"];

PreparedCommand "upd1" ["ja"];
PreparedCommand "langs";
PreparedCommand "sel" ["%Google%", "%google%"];

PreparedCommand "upd1" ["en"];
PreparedCommand "langs";
PreparedCommand "sel" ["%Google%", "%google%"];

PreparedCommand "upd1" ["ja+en"];

PreparedCommand "langs";
PreparedCommand "sel" ["%Google%", "%google%"];
Command "verify index FTIndex cascade continue";

ErasePreparedCommand "upd1";
ErasePreparedCommand "langs";
ErasePreparedCommand "sel";

# 全文ファイルテスト用の表を消去
Command "drop table T";

TerminateSession;
Terminate;
End;

