Begin;
SetEncodingType "utf8";
# 日本語

Initialize;
InitializeSession "DefaultDB";

# 表を作成
Command "create table T (N int, C ntext array [no limit], L language array [no limit])";

# 索引作成
Command "create fulltext index FTIndex on T(C) language column L hint 'sectionized, 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, [textsjisfile "..\\..\\doc\\kenpou.txt",
			   textsjisfile "..\\..\\doc\\rasyoumon.txt"], ["ja", "ja+en"]];
PreparedCommand "ins" [1, [textsjisfile "..\\..\\doc\\KINGARTHURS_ROUNDTABLE.txt",
			   textsjisfile "..\\..\\doc\\RainyNight.txt"], ["ja", "ja+en"]];
PreparedCommand "ins" [2, [textsjisfile "..\\..\\doc\\ricoh.txt",
			   textsjisfile "..\\..\\doc\\introduction.txt"], ["ja", "ja+en"]];
ErasePreparedCommand "ins";

# verify
Command "verify index FTIndex cascade continue";

# いろいろ検索
Command "select N, sectionized(C) from T where C like ?" ["%昭和%"];
Command "select N, sectionized(C) from T where C like ?" ["%デレクトリ%"];

Command "drop index FTIndex";

Command "select N from T where C like ?" ["%昭和%"];
Command "select N from T where C like ?" ["%デレクトリ%"];

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


TerminateSession;
Terminate;
End;

