è¡ãšåã®å亀ç¹ã«ã¯ã察å¿ãããã¡ã€ã³ããã®å€ã1ã€ã ãå«ãŸããŸãïŒãã以äžã¯å«ãŸããŸããïŒã
åãå€ã¯ããã®å€ã®æå³ã«å¿ããŠãã¢ãããã¯ãŸãã¯éã¢ãããã¯ã«ãªããŸãã ããšãã°ãå€ã4286ãã¯
- ã¢ããã㯠ããã®æå³ããã¯ã¬ãžããã«ãŒããã³ãã®å ŽåïŒåå²ãŸãã¯äžŠã¹æ¿ãããšãæå³ã倱ãããŸãïŒ
- éã¢ããã㯠ããã®æå³ããæ°åã®ã»ãããã§ããå ŽåïŒããŒãã«åå²ãŸãã¯äžŠã¹æ¿ããå Žåãæå³ã¯å€±ãããŸããïŒ
ãã®èšäºã§ã¯ãæååãæ¥ä»ãåçŽãªã¹ãïŒ$ LB圢åŒïŒããªã¹ãã³ã¬ã¯ã·ã§ã³ãããã³é åã³ã¬ã¯ã·ã§ã³ã®ãã£ãŒã«ãã¿ã€ãã®SQLã¯ãšãªãé«éåããæšæºçãªæ¹æ³ã«ã€ããŠèª¬æããŸãã
ç®æ¬¡ïŒ
- åºåãæåå
- æ©å¯ããŒã¿ã®é èœ
- æ©å¯ããŒã¿ã®é衚瀺ïŒç¶ãïŒ
- æ¥ä»ïŒæå»ãªã©ïŒ
- ç°¡åãªãªã¹ã
- ã³ã¬ã¯ã·ã§ã³ãªã¹ã
- é åã³ã¬ã¯ã·ã§ã³
- çµè«ãšããŠ
ã¯ããã«
æåã«ãé»è©±ã®ãªã¹ãã®äŸã®ã¯ã©ã·ãã¯ããŒãžã§ã³ãæ€èšããŸãã
ãã¹ãããŒã¿ãäœæããŸãã
create table cl_phones(tname varchar2(100), phone varchar2(30)); insert into cl_phones(tname,phone) values ('','867-843-25'); insert into cl_phones(tname,phone) values ('','830-044-35'); insert into cl_phones(tname,phone) values ('','530-055-35'); insert into cl_phones(tname,phone) values ('','530-055-35'); insert into cl_phones(tname,phone) values ('','555-011-35'); insert into cl_phones(tname,phone) values ('','530-055-31'); insert into cl_phones(tname,phone) values ('','531-051-32'); insert into cl_phones(tname,phone) values ('','532-052-33'); insert into cl_phones(tname,phone) values ('','533-053-35');
次ã«ãååããšã«é»è©±ã®ã³ã³ãåºåããªã¹ããå°å·ããŸãã
éžæ
ïŒ exactïŒ tname ïŒ tname ã
LIST ïŒ phone ïŒ phonestr
FROM cl_phones
GROUP BY tname
ãŸãã¯ïŒ
éžæ
ç°ãªã ïŒ exactïŒ tname ïŒ tname ã
LIST ïŒ phone ïŒ foreach ïŒ tname ïŒïŒ phonestr
FROM cl_phones
çµæïŒ
tname | phonestr |
---|---|
ã¢ã³ãã¬ã€ | 867-843-25,830-044-35,530-055-35 |
ãŽã¡ã㣠| 530-055-31,531-051-32,532-052-33,533-053-35 |
ããã·ã | 530-055-35,555-011-35 |
ãããã£ãŠãå€ãã®å€ãäžåºŠã«1ã€ã®ãã£ãŒã«ãã«æ ŒçŽãããšäŸ¿å©ãªå ŽåããããŸã-é»è©±æ©ãŸãã¯ãã®éšåããã¹ã¯ãŒããªã©ã®ãªã¹ãã§ããå ŽåããããŸã-åºåãèšå·ä»ãã®è¡ã®åœ¢åŒã§ãåæã«åã ã®å€ããã°ããæ€çŽ¢ã§ããããã«ãã ãã¡ããããã®ãããªãã£ãŒã«ãã«éåžžã®ã€ã³ããã¯ã¹ãäœæãããã®å€§ããªæååã§éšåæååæ€çŽ¢ãè¡ãããšã¯ã§ããŸããããŸããéåžžã«å€ãã®èŠçŽ ãååšããå¯èœæ§ããããããã€ã³ããã¯ã¹ã®é·ããéèŠã«ãªãã次ã«ããã®ãããªã€ã³ããã¯ã¹ããããŸããæ€çŽ¢é床ãäžããå©ãã«ã¯ãªããŸããã
ããã§ã¯ã©ãããŸããïŒ
ç¹ã«ãã®ãããªå Žåãã³ã¬ã¯ã·ã§ã³ãå«ããã£ãŒã«ãã«ç¹å¥ãªçš®é¡ã®ã€ã³ããã¯ã¹ãå°å ¥ãããŸããã
ã³ã¬ã¯ã·ã§ã³ã¯ããå®ãïŒ <...>ã®çµã¿èŸŒã¿ãªã¹ãããã³<...>ã® é å ïŒãŸãã¯ãä»®æ³ãã®ããããã§ãã
ãã«ãã€ã³ã³ã¬ã¯ã·ã§ã³ã®å Žåãã·ã¹ãã ã¯ãã®ãããªã€ã³ããã¯ã¹ãäœæãã責任ããããããã°ã©ãã¯ãã®ããã»ã¹ãå€æŽã§ããŸãããä»®æ³ã³ã¬ã¯ã·ã§ã³ã®å Žåãã€ã³ããã¯ã¹ãäœæãã責任ã¯ããã°ã©ãã«ãããŸãã
ã»ãã¬ãŒã¿ãæ¥ä»ãåçŽãªãªã¹ããå«ãåçŽãªæåå-ãããã¯ãã®ãããªãä»®æ³ãã³ã¬ã¯ã·ã§ã³ã®äŸã§ãã
ãã®ãããã³ã¬ã¯ã·ã§ã³ã®ã€ã³ããã¯ã¹ã®æ§æã¯æ¬¡ã®ãšããã§ãã
INDEX idx1 ONïŒMyFieldïŒELEMENTSïŒïŒ;ãŸãã¯
INDEX idx1 ONïŒMyFieldïŒKEYSïŒïŒ;
éçºè ãç¬èªã«å®è£ ããå¿ èŠãããpropertyname BuildValueArrayãšããã¡ãœããã¯ããã®ãããªã€ã³ããã¯ã¹ãäœæããããã»ã¹ãæ åœããŸãã
ã¡ãœããã®äžè¬çãªçœ²åã¯æ¬¡ã®ãšããã§ãã
ClassMethod propertynameBuildValueArrayïŒ value ã ByRef valueArray ïŒ AsïŒ ã¹ããŒã¿ã¹
ã©ãã§ïŒ
- value-èŠçŽ ã«åå²ããããã®ãã£ãŒã«ãå€ã
- valueArrayã¯ãåã
ã®èŠçŽ ãå«ãçµæã®é
åã§ãã
é åã¯ã次ã®åœ¢åŒã®ããŒ/å€ã»ããã§ãã
é åïŒkey1ïŒ= value1
é åïŒkey2ïŒ= value2
ãªã©
åè¿°ã®ããã«ããã«ãã€ã³ã³ã¬ã¯ã·ã§ã³ã®å Žåããã®ã¡ãœããã¯ã·ã¹ãã ã«ãã£ãŠèªåçã«çæããã [Final]å±æ§ãæã¡ãŸããããã«ãããéçºè ã¯ãã®ã¡ãœããããªãŒããŒã©ã€ãã§ããŸããã
ãã®ãããªã€ã³ããã¯ã¹ãæ§ç¯ããSQLã¯ãšãªã§ãããã䜿çšããæ¹æ³ãèŠãŠã¿ãŸãããã
泚ïŒåã®äŸããã¢ãŒãã£ãã¡ã¯ããæ®ããªãããã«ãæ°ãããã®ãäœæãããåã«ãã¯ã©ã¹ã®ã°ããŒãã«ãšã¹ãã¬ãŒãžã¹ããŒã ãå®å šã«ã¯ãªã¢ããããšããå§ãããŸãã
åºåãæåå
次ã®ã¯ã©ã¹ãäœæããŸãã
ã¯ã©ã¹demo.test ExtendsïŒ Persistent
{
é»è©±ã§ã®iPhoneã® ã€ã³ããã¯ã¹äœæ ïŒèŠçŽ ïŒ;
ãããã㣠Phones AsïŒ String ;
ClassMethod PhonesBuildValueArrayïŒ
䟡å€
ByRef array ïŒ AsïŒ Status
{
å€ = ""ã® å Žå {
ã»ãã é å ïŒ0ïŒ= å€
} else {
ãªã¹ã = $ ListFromString ïŒ value ã "ã" ïŒã ptr = 0ãèšå®ããŸã
while $ ListNext ïŒ list ã ptr ã item ïŒ {
é åã® èšå® ïŒ ptr ïŒ= ã¢ã€ãã
}
}
$$$ OKãçµäºOK
}
ClassMethod FillïŒïŒ
{
ïŒsqlïŒ truncate table demoãtest ïŒ
ïŒsqlïŒ ãã¢ã« æ¿å ¥ ã ãŸãã ãã¹ã ïŒ é»è©± ïŒ
NULLãŠããªã³ããã¹ãŠ éžæ
'a' union allã éžæããŸã
'bãa' union allã éžæããŸã
ãbãbãã éžæã ã ãã¹ãŠãçµåããŸã
ãaãcãbãã éžæããŸã
ããããã éžæããŸã
ïŒ
ZWrite ^ demo.testD
ZWrite ^ demo.testI
}
}
ã¿ãŒããã«ã§Fill ïŒïŒã¡ãœãããå®è¡ããŸãã
USER>do ##class(demo.test).Fill()
^demo.testD=6
^demo.testD(1)=$lb("","")
^demo.testD(2)=$lb("","a")
^demo.testD(3)=$lb("","b,a")
^demo.testD(4)=$lb("","b,b")
^demo.testD(5)=$lb("","a,c,b")
^demo.testD(6)=$lb("",",,")
^demo.testI("iPhones"," ",1)=""
^demo.testI("iPhones"," ",6)=""
^demo.testI("iPhones"," A",2)=""
^demo.testI("iPhones"," A",3)=""
^demo.testI("iPhones"," A",5)=""
^demo.testI("iPhones"," B",3)=""
^demo.testI("iPhones"," B",4)=""
^demo.testI("iPhones"," B",5)=""
^demo.testI("iPhones"," C",5)=""
ã芧ã®ãšãããè¡ã¯ã€ã³ããã¯ã¹å šäœã§ã¯ãªããåã ã®éšåã«å ¥åãããŠããŸãã ãããã£ãŠã1ã€ã®å€§ããªè¡ããµãã¹ããªã³ã°ã«ã¹ããªã³ã°åããæ¹æ³ã¯ããŠãŒã¶ãŒèªèº«ã決å®ããŸãã åºåãããè¡ã«å ããŠãããã¯xmlãjsonããŸãã¯ãã®ä»ã®ãã®ã§ãã
ããŒãã«ã®å 容ã¯æ¬¡ã®ãšããã§ãã
ID | æºåž¯é»è©± |
---|---|
1 | ïŒnullïŒ |
2 | a |
3 | bãa |
4 | bãb |
5 | aãcãb |
6 | ãã |
ã㢠ãã*ã éžæããŸã ã é»è©± [[ a]ãã ãããã®å Žåã iPhoneã®ã€ã³ããã¯ã¹ã¯äœ¿çšãããŸããã ããã䜿çšããã«ã¯ãç¹å¥ãªè¿°èªã䜿çšããå¿ èŠããããŸã
ã㢠ãã*ã éžæããŸã ã ãïŒ aïŒ ã ãªã© ã® é»è©±ã® å Žæã ãã¹ã ãã
FOR SOME %ELEMENT() (%VALUE = )
äžèšã«åºã¥ããŠããªã¯ãšã¹ãã¯æ¬¡ã®åœ¢åŒã«ãªããŸãã
ã㢠ãã*ã éžæããŸã ã someïŒ èŠçŽ ã®å ŽæïŒ Phones ïŒïŒ ïŒ value = 'a' ïŒã ãã¹ãã ãŸããã®çµæãç¹æ®ãªã€ã³ããã¯ã¹ã䜿çšããããããã®ã¯ãšãªã®é床ã¯ä»¥åã®ãªãã·ã§ã³ã«æ¯ã¹ãŠå€§å¹ ã«é«éã«ãªããŸãã
ãã¡ãããããè€éãªæ¡ä»¶ãåãå ¥ããããŸããäŸãã°ïŒ
ïŒ ïŒ å€ ïŒ STARTSWITH 'a' ïŒ
ïŒ ïŒ å€ [ 'a' ããã³ ïŒ å€ [ 'b' ïŒ
ïŒ ïŒ å€ ïŒïŒ 'c' ã 'd' ïŒïŒ
ïŒ ïŒ å€ ã¯ null ïŒ
ãããŠä»ãå°ãéæ³...
æ©å¯ããŒã¿ã®é èœ
BuildValueArrayã¡ãœããã§ã¯ãéåžžãvalueã®å€ã«åºã¥ããŠé åãèšå®ããŸã ã
ãããããã®èŠåã«åŸããªããšã©ããªããŸããïŒ
ãã®ãããªäŸãè©ŠããŠã¿ãŸãããïŒ
ã¯ã©ã¹demo.test ExtendsïŒ Persistent
{
ãã°ã€ã³æã®iLoginã® ã€ã³ããã¯ã¹ ïŒèŠçŽ ïŒ;
ãããã㣠Login AsïŒ String ;
ClassMethod LoginBuildValueArrayïŒ
䟡å€
ByRef array ïŒ AsïŒ Status
{
å€ = "Bob"ã® å Žå {
Set array ïŒ0ïŒ= "test1"
Set array ïŒ1ïŒ= "test2"
Set array ïŒ2ïŒ= "test3"
} ElseIf å€ = "Petya" {
é åã® èšå® ïŒ "-" ïŒ= "111"
é åã® èšå® ïŒ "5.4" ïŒ= "222"
é åã® èšå® ïŒ "fg" ïŒ= "333"
} else {
Set array ïŒ "key" ïŒ= "value"
}
$$$ OKãçµäºOK
}
ClassMethod FillïŒïŒ
{
ïŒsqlïŒ truncate table demoãtest ïŒ
ïŒsqlïŒ ãã¢ã« æ¿å ¥ ã ãŸã ãtest ïŒ ãã°ã€ã³ ïŒ
'Vasya' union allã éžæããŸã
'Vasya' union allã éžæããŸã
ãPetyaãã éžæããŸã
ãPetyaãã éžæããŸã
ãIvanãã ãã¹ãŠ éžæããŸã
ãIvanãã éžæããŸã
ïŒ
ZWrite ^ demo.testD
ZWrite ^ demo.testI
}
}
èšå ¥åŸãããŒãã«ã®å 容ã¯æ¬¡ã®ããã«ãªããŸãã
ID | ãã°ã€ã³ |
---|---|
1 | ãŽã¡ã·ã£ |
2 | ãŽã¡ã·ã£ |
3 | ããã£ã¢ |
4 | ããã£ã¢ |
5 | ã€ã¯ã³ |
6 | ã€ã¯ã³ |
ã㢠ãã*ã éžæããŸã ã someïŒ èŠçŽ ã® å Žæ ã ãã¹ã ïŒ Login ïŒïŒ ïŒ value = '111' ïŒ
æ»ããŸãïŒ
ID | ãã°ã€ã³ |
---|---|
3 | ããã£ã¢ |
4 | ããã£ã¢ |
ããã¯ã©ãã§äŸ¿å©ã§ããïŒ
ããšãã°ãã€ã³ããã¯ã¹ã§ã¯ãéåžžã®ããã«1ã€ã§ã¯ãªããç¹å®ã®ãŠãŒã¶ãŒã䜿çšã§ãããã¹ã¯ãŒãã®ã»ããå šäœããŸãã¯SQLã䜿çšããŠéãã®ãæãŸãããªããã®ä»ã®æ©å¯æ å ±ãé衚瀺ã«ã§ããŸãã ãã¡ãããããã«ã¯ä»ã®å¯èœæ§ãããšãã°GRANT column-privilegeããããŸãã ãã ãããã®å Žåãã¹ãã¢ãããã·ãŒãžã£ã䜿çšããŠä¿è·ãã£ãŒã«ãã«ã¢ã¯ã»ã¹ããå¿ èŠããããŸãã
æ©å¯ããŒã¿ã®é衚瀺ïŒç¶ãïŒ
ããŒãã«ã®ããŒã¿ãšã€ã³ããã¯ã¹ãä¿åãããŠããã°ããŒãã«ãèŠããšãã5.4ãããfgããªã©ã®ããŒã®å€ã¯è¡šç€ºãããŸããã
^demo.testD=6
^demo.testD(1)=$lb("","")
^demo.testD(2)=$lb("","")
^demo.testD(3)=$lb("","")
^demo.testD(4)=$lb("","")
^demo.testD(5)=$lb("","")
^demo.testD(6)=$lb("","")
^demo.testI("iLogin"," 111",3)=""
^demo.testI("iLogin"," 111",4)=""
^demo.testI("iLogin"," 222",3)=""
^demo.testI("iLogin"," 222",4)=""
^demo.testI("iLogin"," 333",3)=""
^demo.testI("iLogin"," 333",4)=""
^demo.testI("iLogin"," TEST1",1)=""
^demo.testI("iLogin"," TEST1",2)=""
^demo.testI("iLogin"," TEST2",1)=""
^demo.testI("iLogin"," TEST2",2)=""
^demo.testI("iLogin"," TEST3",1)=""
^demo.testI("iLogin"," TEST3",2)=""
^demo.testI("iLogin"," VALUE",5)=""
^demo.testI("iLogin"," VALUE",6)=""
ã§ã¯ããªã圌ãã«å°ããã®ã§ããïŒ
ãã®è³ªåã«çããããã«ãã€ã³ããã¯ã¹ããããã«å€æŽããããŒãã«ã«åå ¥åããŸãã
ã€ã³ããã¯ã¹ iLogin OnïŒãã°ã€ã³ïŒKEYSïŒããã°ã€ã³ïŒELEMENTSïŒïŒ;
ã°ããŒãã«ã¯å¥ã®å€èŠ³ãåããŸãïŒã€ã³ããã¯ã¹ä»ãã®ã°ããŒãã«ã®ã¿ãæäŸããŸãïŒã
^demo.testI("iLogin"," -"," 111",3)=""
^demo.testI("iLogin"," -"," 111",4)=""
^demo.testI("iLogin"," 0"," TEST1",1)=""
^demo.testI("iLogin"," 0"," TEST1",2)=""
^demo.testI("iLogin"," 1"," TEST2",1)=""
^demo.testI("iLogin"," 1"," TEST2",2)=""
^demo.testI("iLogin"," 2"," TEST3",1)=""
^demo.testI("iLogin"," 2"," TEST3",2)=""
^demo.testI("iLogin"," 5.4"," 222",3)=""
^demo.testI("iLogin"," 5.4"," 222",4)=""
^demo.testI("iLogin"," FG"," 333",3)=""
^demo.testI("iLogin"," FG"," 333",4)=""
^demo.testI("iLogin"," KEY"," VALUE",5)=""
^demo.testI("iLogin"," KEY"," VALUE",6)=""
ããŠãããŒå€ãšèŠçŽ å€ã®äž¡æ¹ãä¿åããŸããã ããã¯å°æ¥ã©ã®ããã«åœ¹ç«ã€ã§ããããïŒ
ããšãã°ã以åã«ææ¡ããããã¹ã¯ãŒãä»ãããŒãžã§ã³ã§ã¯ããã¹ã¯ãŒãèªäœã«å ããŠããã®ãã¹ã¯ãŒããæå¹ã«ãªããŸã§ã®æ¥ä»ãªã©ãä¿åã§ããŸãã ãããŠãç§ãã¡ã®ãªã¯ãšã¹ãã§ã¯ããã®äºå®ã次ã®ããã«äœ¿çšã§ããŸãã
ã㢠ãã*ã éžæããŸã ã someïŒ èŠçŽ ïŒ Login ïŒã® ãã¹ã ïŒ ïŒ key = '-' ããã³ ïŒ value = '111' ïŒ
ã©ãã«äœãä¿åãããã¯ããªã次第ã§ããèŠããŠããå¿ èŠãããã®ã¯ãããŒã¯äžæã§ãããå€ã¯äžæã§ã¯ãªããšããããšã§ãã
ããã«ããã³ã¬ã¯ã·ã§ã³ãã€ã³ããã¯ã¹ãšæšæºã€ã³ããã¯ã¹ã«ã¯ãè¿œå ã®ããŒã¿ãä¿åã§ããŸãã
ã€ã³ããã¯ã¹ iLogin OnïŒãã°ã€ã³ïŒKEYSïŒããã°ã€ã³ïŒELEMENTSïŒïŒ[ ããŒã¿ =ïŒ ãã°ã€ã³ ã ãã°ã€ã³ ïŒELEMENTSïŒïŒ];
ãã®ãªãã·ã§ã³ã䜿çšãããšãäžèšã®ãªã¯ãšã¹ãã¯ããŒã¿ã«ã¢ã¯ã»ã¹ã§ããªããªããŸãããã€ã³ããã¯ã¹ãããã¹ãŠãååŸãããããæéãç¯çŽãããŸãã
æ¥ä»ïŒæå»ãªã©ïŒ
æ¥ä»ã¯ã³ã¬ã¯ã·ã§ã³ãšäœã®é¢ä¿ãããã®ã§ããããïŒ ã»ãšãã©ã®å Žåãæ¥ãæããŸãã¯å¹Žã®ã¿ã§æ€çŽ¢ããå¿ èŠãããããã§ãã ããã§ã®éåžžã®ã€ã³ããã¯ã¹ã¯åœ¹ã«ç«ã¡ãŸãããããã³ã¬ã¯ã·ã§ã³ãã€ã³ããã¯ã¹ã¯éåžžã«é©åã§ãã
次ã®äŸãèŠãŠã¿ãŸãããã
ã¯ã©ã¹demo.test ExtendsïŒ Persistent
{
ã€ã³ããã¯ã¹ iBirthDay OnïŒBirthDayïŒKEYSïŒãBirthDayïŒELEMENTSïŒïŒ;
ãããã㣠BirthDay AsïŒ Date ;
ClassMethod BirthDayBuildValueArray ïŒ
䟡å€
ByRef array ïŒ AsïŒ Status
{
å€ = ""ã® å Žå {
ã»ãã é å ïŒ0ïŒ= å€
} else {
d = $ zd ïŒ å€ ã3ïŒãèšå®ããŸã
Set array ïŒ "yy" ïŒ= + $ p ïŒ d ã "-" ã1ïŒ
Set array ïŒ "mm" ïŒ= + $ p ïŒ d ã "-" ã2ïŒ
Set array ïŒ "dd" ïŒ= + $ p ïŒ d ã "-" ã3ïŒ
}
$$$ OKãçµäºOK
}
ClassMethod FillïŒïŒ
{
ïŒsqlïŒ truncate table demoãtest ïŒ
ïŒsqlïŒ ãã¢ã« æ¿å ¥ ã ãŸãã ãã¹ã ïŒ èªçæ¥ ïŒ
{ d '2000-01-01' } union allã éžæããŸã
éžæ { d '2000-01-02' } ãã¹ãŠãçµå
éžæ { d '2000-02-01' } ãã¹ãŠãçµå
éžæ { d '2001-01-01' } ãŠããªã³ãã¹ãŠ
éžæ { d '2001-01-02' } ãã¹ãŠãçµå
{ d '2001-02-01' }ã éžæããŸã
ïŒ
ZWrite ^ demo.testD
ZWrite ^ demo.testI
}
}
èšå ¥åŸã®ããŒãã«ã®å 容ã¯æ¬¡ã®åœ¢åŒã«ãªããŸãã
ID | èªçæ¥ |
---|---|
1 | 2000幎1æ1æ¥ |
2 | 2000幎1æ2æ¥ |
3 | 2000幎2æ1æ¥ |
4 | 2001幎1æ1æ¥ |
5 | 2001幎1æ2æ¥ |
6 | 2001幎2æ1æ¥ |
ã㢠ãã*ã éžæããŸã ã someïŒ èŠçŽ ïŒ BirthDay ïŒã® ãã¹ã ïŒ ïŒ key = 'mm' ããã³ ïŒ value = 2ïŒ
çµæïŒ
ID | èªçæ¥ |
---|---|
3 | 2000幎2æ1æ¥ |
6 | 2001幎2æ1æ¥ |
ç°¡åãªãªã¹ã
CachéDBMSã«ã¯ãåçŽãªãªã¹ãïŒ ïŒ List ïŒçšã®ç¹å¥ãªããŒã¿åããããåºåãæåã®éžæã«åé¡ãããå Žåã¯ãæååã®ä»£ããã«äœ¿çšã§ããŸãã
ãã®ãããªãã£ãŒã«ãã䜿çšããããšã¯ãæååãæäœããããšãšå€§å·®ãããŸããã
å°ããªäŸãèããŠã¿ãŸãããïŒ
ã¯ã©ã¹demo.test ExtendsïŒ Persistent
{
ãªã¹ãäžã®iListã® ã€ã³ããã¯ã¹ ïŒèŠçŽ ïŒ;
ãããã㣠ãªã¹ã AsïŒ ãªã¹ã ;
ClassMethod ListBuildValueArrayïŒ
䟡å€
ByRef array ïŒ AsïŒ Status
{
å€ = ""ã® å Žå {
ã»ãã é å ïŒ0ïŒ= å€
} else {
ptr = 0ã« èšå®
while $ ListNext ïŒ value ã ptr ã item ïŒ {
é åã® èšå® ïŒ ptr ïŒ= ã¢ã€ãã
}
}
$$$ OKãçµäºOK
}
ClassMethod FillïŒïŒ
{
ïŒsqlïŒ truncate table demoãtest ïŒ
ïŒsqlïŒ ãã¢ã« æ¿å ¥ ã ãŸãã ãã¹ã ïŒ ãªã¹ã ïŒ
NULLãŠããªã³ããã¹ãŠ éžæ
$ LISTBUILD ïŒ 'a' ïŒ ãã¹ãŠãçµåãã
$ LISTBUILD ïŒ 'b' ã 'a' ïŒ ãã¹ãŠãçµåãã
$ LISTBUILD ïŒ 'b' ã 'b' ïŒ ãã¹ãŠãçµå
$ LISTBUILD ïŒ 'a' ã 'c' ã 'b' ïŒã éžæããŸãã
select $ LISTBUILD ïŒ 'a ,,' ã null ã null ïŒ
ïŒ
ZWrite ^ demo.testD
ZWrite ^ demo.testI
}
}
ODBC衚瀺ã¢ãŒãã®ããŒãã«ã®å 容ã¯æ¬¡ã®ããã«ãªããŸãã
NoteïŒCachéã«ã¯ã ããŒã¿ã衚瀺ããããã®è«çãODBCãããã³ããŒã¿è¡šç€ºãªãã·ã§ã³ã® 3ã€ã®ã¢ãŒãããããŸã ã
ID | äžèŠ§ |
---|---|
1 | ïŒnullïŒ |
2 | a |
3 | bãa |
4 | bãb |
5 | aãcãb |
6 | ãA ããããã |
ODBCã¢ãŒãã§ã¿ã€ãïŒ Listã®ãã£ãŒã«ããåºåããå Žåã ODBCDELIMITERãã©ã¡ãŒã¿ãŒã¯ã»ãã¬ãŒã¿ãŒãšããŠäœ¿çšãããŸããããã©ã«ãã¯ãããã§ãã
ããšãã°ããã®ãããªãã£ãŒã«ãã§ã¯ãããŒãã«ã¯æ¬¡ã®ããã«ãªããŸãã
ãããã㣠ãªã¹ã AsïŒ ãªã¹ã ïŒ ODBCDELIMITER = "^" ïŒ;
ID | äžèŠ§ |
---|---|
1 | ïŒnullïŒ |
2 | a |
3 | b ^ a |
4 | b ^ b |
5 | a ^ c ^ b |
6 | ãã ^^ |
ã㢠ãã*ã éžæããŸã ã someïŒ èŠçŽ ïŒ List ïŒã® ãã¹ã ïŒ ïŒ value = 'a ,,' ïŒ
ID | äžèŠ§ |
---|---|
6 | ãA ããããã |
ã㢠ãã*ã éžæããŸã ã ãã㧠'a ,,' ïŒ inlist ãªã¹ãã ãã¹ãããŸã
ã³ã¬ã¯ã·ã§ã³ãªã¹ã
äžèšã®äŸãæžãæããŸãããåçŽãªãªã¹ãã䜿çšãã代ããã«ããªã¹ãã³ã¬ã¯ã·ã§ã³ã䜿çšããŸãã
ã¯ã©ã¹demo.test ExtendsïŒ Persistent
{
ã€ã³ããã¯ã¹ iListStr on ListStrïŒELEMENTSïŒ;
Property ListStr As list OfïŒ String ;
ClassMethod FillïŒïŒ
{
ïŒsqlïŒ truncate table demoãtest ïŒ
ïŒsqlïŒ ãã¢ã« æ¿å ¥ ã ãŸã ãtest ïŒ liststr ïŒ
NULLãŠããªã³ããã¹ãŠ éžæ
$ LISTBUILD ïŒ 'a' ïŒ ãã¹ãŠãçµåãã
$ LISTBUILD ïŒ 'b' ã 'a' ïŒ ãã¹ãŠãçµåãã
$ LISTBUILD ïŒ 'b' ã 'b' ïŒ ãã¹ãŠãçµå
$ LISTBUILD ïŒ 'a' ã 'c' ã 'b' ïŒã éžæããŸãã
select $ LISTBUILD ïŒ 'a ,,' ã null ã null ïŒ
ïŒ
ZWrite ^ demo.testD
ZWrite ^ demo.testI
}
}
ãã®äŸã§ã¯ãã»ãšãã©ãã¹ãŠãåãã§ãããå®å šã§ã¯ãããŸããã 次ã®ããšã«ç¹ã«æ³šæããŠãã ããã
- arrayã®ãã£ãŒã«ããããŒãã€ã³ããã¯ã¹èŠçŽ ã®COLLATIONå€ã«ãããã°ããŒãã«ã«ä¿åããåã«å¯Ÿå¿ããå€æãè¡ããŸãã
äž¡æ¹ã®äŸã®ã°ããŒãã«ã€ã³ããã¯ã¹ã®å€ãç¹ã«NULLå€ã®è¡šçŸãæ¯èŒããŠãã ããã - BuildValueArrayã¡ãœãããæ¬ èœããŠãããããããŒã䜿çšã§ãããèŠçŽ ã®å€ã®ã¿ã䜿çšã§ããŸãã
- ãã£ãŒã«ãã¿ã€ãã¯ç¹å¥ãªã³ã¬ã¯ã·ã§ã³ã¯ã©ã¹ïŒ ïŒ ListOfDataTypes ïŒã§ãã
é åã³ã¬ã¯ã·ã§ã³
äžèšã®ããã«ãã³ã¬ã¯ã·ã§ã³ãªã¹ãã§ã¯ããŒã䜿çšã§ããŸããã é åã³ã¬ã¯ã·ã§ã³ã¯ãã®æ¬ é¥ãä¿®æ£ããŸãã
次ã®ã¯ã©ã¹ãäœæããŸãã
ã¯ã©ã¹demo.test ExtendsïŒ Persistent
{
ã€ã³ããã¯ã¹ iArrayStr OnïŒArrayStrïŒKEYSïŒãArrayStrïŒELEMENTSïŒïŒ;
ãããã㣠str AsïŒ String ;
ãããã㣠ArrayStr As Of Of String String ;
ClassMethod FillïŒïŒ
{
ïŒsqlïŒ truncate table demoãtest ïŒ
ïŒsqlïŒ ãã¢ã« æ¿å ¥ ã ãŸããtest ïŒ str ïŒ
NULLãŠããªã³ããã¹ãŠ éžæ
'aaa' union allã éžæããŸã
'bbb' union allã éžæããŸã
'bbb' union allã éžæããŸã
'ccc' union allã éžæããŸã
nullã éžæ
ïŒ
ïŒsqlïŒ ãã¢ã« æ¿å ¥ ã ãŸã ãtest_ArrayStr ïŒ test ã element_key ã arraystr ïŒ
éžæ 1ã '0' ã 'test1' ãã¹ãŠãçµå
éžæ 1ã '1' ã 'test2' ãã¹ãŠãçµå
éžæ 1ã '2' ã 'test3' ãã¹ãŠãçµå
select 2ã '0' ã 'test1' ãã¹ãŠãçµå
éžæ 2ã '1' ã 'test2' ãã¹ãŠãçµå
2ã '2' ã 'test3'ã ãã¹ãŠ éžæããŸãã
3ã ã-ã ã ã111ãã ãã¹ãŠ éžæããŸãã
select 3ã '5.4' ã '222' union all
select 3ã 'fg' ã '333' union all
éžæ 4ã '-' ã '111' ãã¹ãŠãçµå
ã4ã ã ã5.4ã ã ã222ãã ãã¹ãŠ éžæããŸã
4ã ãfgã ã ã333ãã ãã¹ãŠ éžæããŸã
5ã ãããŒã ã ãå€ãã® ãã¹ãŠã éžæããŸã
6ã ãããŒã ã ãå€ãã éžæããŸã
ïŒ
ZWrite ^ demo.testD
ZWrite ^ demo.testI
}
}
ããã§ãããã€ãã®æ確åãè¡ãå¿ èŠããããŸãã
- ããŒã¿ã¯åŒãç¶ã2ã€ã®ã°ããŒãã«ã«ä¿åãããŸãã^ ã¯ã©ã¹ Dã® åå ïŒå®éã®ããŒã¿ïŒãš^ ã¯ã©ã¹ Iã® åå ïŒã€ã³ããã¯ã¹ïŒã
- ãã ããã¯ã©ã¹ã1ã€ããå Žåããã§ã«2ã€ã®ããŒãã«ããããŸããéåžžã©ããã demo.testãš1ã€ã®è£å©demo.test_ArrayStrã§ãã
- demo.test_ArrayStrããŒãã«ã¯ãé
åããŒã¿ãžã®äŸ¿å©ãªSQLã¢ã¯ã»ã¹ãæäŸãã次ã®ãã£ãŒã«ãããããŸãããããã®ååã®ããã€ãã¯äºåå®çŸ©ãããŠããŸãã
- element_key-ããŒå€ïŒãã£ãŒã«ãåã¯äºåå®çŸ©ãããŠããŸãïŒ;
- ArrayStr-èŠçŽ ã®å€ã
- test-芪ããŒãã«demo.testãžã®ãªã³ã¯ã
- ID - test || element_key圢åŒã®ãµãŒãã¹äž»ããŒïŒãã£ãŒã«ãåã¯äºåå®çŸ©ãããŠããŸãïŒ;
- ãã£ãŒã«ãã¿ã€ãã¯ç¹å¥ãªã³ã¬ã¯ã·ã§ã³ã¯ã©ã¹ïŒ ïŒ ArrayOfDataTypes ïŒã§ãã
ãããã£ãŠã Fill ïŒïŒã¡ãœããã®åŸã®ããŒãã«ã®å 容ã¯æ¬¡ã®ããã«ãªããŸãã
ããŒãã«demo.test
ID | str |
---|---|
1 | ïŒnullïŒ |
2 | aaa |
3 | bbb |
4 | bbb |
5 | ccc |
6 | ïŒnullïŒ |
ID | ãã¹ããã | element_key | Arraystr |
---|---|---|---|
1 || 0 | 1 | 0 | test1 |
1 || 1 | 1 | 1 | test2 |
1 || 2 | 1 | 2 | test3 |
2 || 0 | 2 | 0 | test1 |
2 || 1 | 2 | 1 | test2 |
2 || 2 | 2 | 2 | test3 |
3 || 5.4 | 3 | 5.4 | 222 |
3 ||- | 3 | - | 111 |
3 || fg | 3 | fg | 333 |
4 || 5.4 | 4 | 5.4 | 222 |
4 ||- | 4 | - | 111 |
4 || fg | 4 | fg | 333 |
5 ||ã㌠| 5 | éµ | äŸ¡å€ |
6 ||ã㌠| 6 | éµ | äŸ¡å€ |
SQLçšã®CachéDBMSã«ãã£ãŠæäŸããããªããžã§ã¯ãæ¡åŒµãèæ ®ãããšãã-ãããŒãšèŠçŽ ã111ãã®å€ãæã€æååã®demo.testããstrãã£ãŒã«ãã衚瀺ãããã¹ãã¯ãšãªã¯ã次ã®åœ¢åŒãåããŸãã
ãã¹ãIDã éžæã ã ãã¹ã ãã test- > str ã éžæããŸã ã test_ArrayStr ãã㧠element_key = '-' ããã³ arraystr = '111'ãŸãã¯ãã®ãããª
ïŒ ID ã ã㢠ãã strã éžæããŸã ã test_ArrayStr- > element_key = '-' ããã³ test_ArrayStr- > arraystr = '111'ã® ãã¹ã
çµæïŒ
ID | str |
---|---|
3 | bbb |
4 | bbb |
çµè«ãšããŠ
ããã§èª¬æããã€ã³ããã¯ã¹ã¡ã«ããºã ã¯ã ïŒ Stream.GlobalCharacterSearchableãªã©ã®äžéšã®ã·ã¹ãã ã¯ã©ã¹ã§åºã䜿çšãããŠããŸããããã¯ãããã¹ãã¹ããªãŒã ã®ã€ã³ããã¯ã¹ä»ããšSQLã«ããæ€çŽ¢ãæäŸããŸãã ãã®èšäºã§ã¯ãåã蟌ã¿ãä¿åãã¹ããªãŒã ããŠãŒã¶ãŒå®çŸ©ãã³ã¬ã¯ã·ã§ã³ã®ã³ã¬ã¯ã·ã§ã³ã䜿çšãããªã©ãããŸããŸãªèŠ³ç¹ãããã³ã¬ã¯ã·ã§ã³ãã¯ã©ã¹ã«ã€ã³ããã¯ã¹ä»ãããäŸãç¹ã«åãäžããŠããŸããã ããã«ããããã®å€ãã§ã¯ãSQLãä»ããŠäœæ¥ããããšãåžžã«äŸ¿å©ã§å¹ççã§ã¯ãªãããšããããŸãã ãŸããå šææ€çŽ¢ã«ã€ããŠã¯ãããã§ã¯èª¬æããŸãããããã¯ãç¬èªã®ã€ã³ããã¯ã¹ãšãSQLãä»ããäœæ¥ãžã®ã¢ãããŒããããå¥ã®é åã§ããããã§ãã ããã«ã SqlListTypeãSqlListDelimiterãªã©ã®ããããã£ã®äœ¿çšäŸã¯çç¥ãããŸãããã奜å¥å¿reader çãªèªè ã§ããã°ãããããç¬ç«ããŠå®éã«è©Šãããšãã§ããŸãã
䟿å©ãªãªã³ã¯ïŒ