Вверх ↑
Разработчик
Ответов: 26113
Рейтинг: 2126
#1: 2008-08-16 23:59:57 ЛС | профиль | цитата
Детальное рассмотрение показало...
Короче, на этот IC можно забить -- не будет он работать с UTF-8, он рассчитан только на ASCII

------------ Дoбавленo:


Вот тебе пример, который может делать запрос Upper c UTF-8 (среднее поле Edit), в нем есть переделанный IC


Add(MainForm,16668706,343,147)
{
Left=20
Top=105
Width=575
Height=440
Point(onClose)
link(onCreate,7134383:doOpen,[])
link(onClose,7134383:doClose,[])
}
Add(SQLite_DB,7134383,406,161)
{
FileName="test.db"
link(onOpen,11929758:doEvent1,[(457,167)(457,342)])
link(onError,15899502:doWork1,[(655,174)])
}
Add(SQLite_Exec,14862701,560,336)
{
SQL="select * from fio;"
link(onError,7971196:doExec,[])
link(dbHandle,12317758:Var3,[(566,324)])
}
Add(Message,8822109,672,336)
{
}
Add(ChildPanelEx,3911616,343,336)
{
link(onEventData,430754:doWork1,[])
}
BEGIN_SDK
Add(EditMultiEx,7294489,21,21)
{
EventCount=#11:onEventData|
Width=321
Height=312
}
Add(Panel,1320748,98,294)
{
Width=567
Height=91
Align=2
}
Add(Button,2510032,49,91)
{
Left=5
Top=5
Caption="ALL"
link(onClick,3797737:doData,[])
}
Add(Button,3648128,98,161)
{
Left=5
Top=35
Caption="Find RU"
link(onClick,10557716:doData,[])
}
Add(Edit,15272826,189,112)
{
Left=70
Top=32
Width=455
Height=25
Text="SELECT * FROM fio WHERE upper(f) LIKE 'ИВА%';"
}
Add(Edit,15694199,98,49)
{
Left=70
Top=4
Width=455
Height=25
Text="SELECT f,i,o FROM fio;"
}
Add(DoData,10557716,189,161)
{
link(onEventData,4239470:doCharset,[])
link(Data,15272826:Text,[])
}
Add(DoData,3797737,98,91)
{
link(onEventData,5780134:doWork2,[(208,97)(208,27)])
link(Data,15694199:Text,[])
}
Add(HubEx,5780134,315,14)
{
link(onEvent,7294489:onEventData,[])
}
Add(Button,11951259,98,259)
{
Left=5
Top=65
Caption="Find EN"
link(onClick,3186870:doData,[])
}
Add(Edit,935612,147,210)
{
Left=70
Top=62
Width=455
Height=25
Text="SELECT * FROM fio WHERE f LIKE'pet%';"
}
Add(DoData,3186870,147,259)
{
link(onEventData,5871420:doWork3,[(305,265)])
link(Data,935612:Text,[])
}
Add(HubEx,5871420,301,154)
{
link(onEvent,5780134:doWork3,[(319,167)])
}
Add(Charset,4239470,245,161)
{
Type=6
link(onCharset,5871420:doWork2,[])
}
END_SDK
Add(ChildPanel,430754,413,336)
{
link(Data1,10169931:Var2,[])
}
BEGIN_SDK
Add(EditMulti,1352360,21,21)
{
WorkCount=1
DataCount=1
Width=370
Height=228
link(doWork1,5067575:doEvent1,[(35,27)])
}
Add(Panel,15980865,35,126)
{
Top=91
Width=567
Height=315
Align=5
}
Add(StringTable,5965887,336,98)
{
Left=5
Top=5
Width=555
Height=310
Columns=#5:F=175|5:I=175|5:O=175|
}
Add(SQLite_Query,3828135,126,126)
{
link(onQuery,5409173:doStr,[])
link(dbHandle,1352360:Data1,[(132,74)(27,74)])
}
Add(MT_String,5409173,182,126)
{
link(onResult,12864531:doCharset,[])
}
Add(Hub,5067575,35,63)
{
link(onEvent1,5965887:doClear,[(156,69)(156,111)])
link(onEvent2,3828135:doQuery,[(97,76)(97,132)])
}
Add(Charset,12864531,259,126)
{
Type=7
link(onCharset,5965887:doAdd,[(313,132)(313,104)])
}
END_SDK
Add(GetDataEx,10169931,406,315)
{
Angle=3
link(Data,15830060:Var2,[(412,324)])
}
Add(HubEx,15899502,651,329)
{
link(onEvent,8822109:doMessage,[])
}
Add(SQLite_Exec,7971196,609,336)
{
SQL="BEGIN TRANSACTION;\n\rCREATE TABLE fio (f VARCHAR(50), i VARCHAR(20), o VARCHAR(30));\n\rINSERT INTO "fio" VALUES('иванов', 'иван', 'иванович');\n\rINSERT INTO "fio" VALUES('петров', 'семен', 'сергеевич');\n\rINSERT INTO "fio" VALUES('сидоров', 'иван', 'сергеевич');\n\rINSERT INTO "fio" VALUES('иванов', 'семен', 'петрович');\n\rINSERT INTO "fio" VALUES('петряев', 'ванес', 'сезганович');\n\rINSERT INTO "fio" VALUES('ivanov', 'jvan', 'ivanovich');\n\rINSERT INTO "fio" VALUES('petrov', 'semen', 'sergeevich');\n\rINSERT INTO "fio" VALUES('sidorov', 'ivan', 'sergeevich');\n\rINSERT INTO "fio" VALUES('ivanov', 'semen', 'petrovich');\n\rINSERT INTO "fio" VALUES('petryaev', 'vanes', 'sezganovich');\n\rCOMMIT;"
link(onError,15899502:doWork2,[])
link(dbHandle,10169931:Var1,[(615,307)(419,307)])
}
Add(SQLite_Exec,2725749,525,399)
{
SQL="PRAGMA encoding;"
link(onError,15899502:doWork3,[(655,405)])
link(dbHandle,12317758:Var2,[])
}
Add(Hub,11929758,469,336)
{
OutCount=3
link(onEvent1,11222037:addFunction,[(513,342)(513,244)])
link(onEvent2,2725749:doExec,[(513,349)(513,405)])
link(onEvent3,14862701:doExec,[(531,356)(531,342)])
}
Add(GetDataEx,12317758,518,315)
{
Angle=3
link(Data,10169931:Var3,[])
}
Add(InlineCode,11222037,525,238)
{
WorkPoints=#11:addFunction|
DataPoints=#8:dbHandle|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|52:uses kol,Share,Debug,Windows,SQLite3Api,hiSQLite_DB;|0:|5:const|67: CP_THREAD_ACP = 3; // current thread's ANSI code page|53: CP_UTF8 = 65001; // UTF-8 translation|53: CP_KOI8 = 20866; // KOI-8 translation|53: CP_DOS = 866; // DOS translation|53: CP_WIN = 1251; // WIN translation|0:|4:type|28: THiAsmClass = class(TDebug)|9: public|22: dbHandle:THI_Event;|52: procedure addFunction(var _Data:TData; idx:word);|5: end;|0:|14:implementation|0:|65:procedure myFunc(ctx:pointer; nArg:integer; args:ppvalue); cdecl;|20:var s,sstr:string;|22: buffer: Pointer;|22: BufLen: integer;|5:begin|32: s:=sqlite3_value_text(args^);|14: sstr := '';|64: BufLen := MultiByteToWideChar(CP_UTF8, 0, @s[1], -1, nil, 0);|27: if BufLen < 1 then exit;|28: GetMem(buffer, 2*BufLen);|62: MultiByteToWideChar(CP_UTF8, 0, @s[1], -1, buffer, BufLen);|30: CharUpperW(PWChar(buffer));|68: BufLen := WideCharToMultiByte(CP_UTF8,0,buffer,-1,nil,0,nil,nil);|27: if BufLen > 1 then begin|31: SetLength(sstr,BufLen-1);|71: WideCharToMultiByte(CP_UTF8,0,buffer,-1,@sstr[1],BufLen,nil,nil);|7: end;|19: FreeMem(buffer);|55: sqlite3_result_text(ctx,PChar(sstr),Length(sstr),0);|4:end;|0:|34:procedure THiAsmClass.addFunction;|13:var dt:TData;|5:begin|37: dt := ReadData(_Data,dbHandle,nil);|41: if _IsObject(dt,SQLite_GUID) then begin|90: sqlite3_create_function(ToObject(dt),PChar('UPPER'),1,SQLITE_ANY,nil,@myFunc,nil,nil);|6: end;|4:end;|0:|4:end.|
link(dbHandle,15830060:Var3,[(531,212)])
}
Add(GetDataEx,15830060,399,203)
{
link(Data,7134383:dbHandle,[])
}

карма: 22

0