LIKE ã®å匷äžã«ãçŽåŸã§ããªãããšãããæ©ãã§ãŸãã
psql ã§ä»¥äžã®ãããªæäœãè¡ããŸããã
æåŸã® DELETE ã³ãã³ãã¯ã
%ããå§ãŸã str ãæã€è¡ãåé€ãããã£ãã®ã§ããã
å
šãŠã®è¡ãåé€ãããŠããŸããŸãã
%ããå§ãŸã str ãæã€è¡ãåé€ããã«ã¯ã
ãã®æ¹æ³ã¯èª€ãã§ããïŒ
ãããšã PostgreSQL ã®ãã°ã§ããïŒ
test=> CREATE TABLE tbl_name ( str CHAR(8) );
CREATE TABLE
test=> INSERT INTO tbl_name VALUES ( 'abc' );
INSERT 17056 1
test=> INSERT INTO tbl_name VALUES ( '%z' );
INSERT 17057 1
test=> INSERT INTO tbl_name VALUES ( 'xyz' );
INSERT 17058 1
test=> SELECT * FROM tbl_name;
str
----------
abc
%z
xyz
(3 rows)
test=> DELETE FROM tbl_name WHERE str LIKE '\%%';
DELETE 3
-- K.Yamamoto
> test=> SELECT * FROM tbl_name;
> str
> ----------
> abc
> %z
> xyz
> (3 rows)
hoge=> select * from tbl_name where str like '\\%%';
str
----------
%z
(1 row)
ããã¯ã¹ã©ãã·ã¥ã¯ 2 ã€èŠãæ§ã§ãã
http://www.postgresql.jp/document/pg734doc/user/functions-matching.html#FUNCTIONS-LIKE
| ãªãã©ã«ã®ã¢ã³ããŒã¹ã³ã¢ãããŒã»ã³ãèšå·ãä»ã®æåã®ãããã³ã°ã«
| 䜿çšããã®ã§ã¯ãªããã®ãã®ããããããããå Žåã«ã¯ãpattern ã®äžã®
| ããããã®ã¢ã³ããŒã¹ã³ã¢ãšããŒã»ã³ãèšå·ã¯ãšã¹ã±ãŒãæåã§ãšã¹ã±ãŒã
| ãããªããã°ãªããŸãããããã©ã«ãã®ãšã¹ã±ãŒãæåã¯éã¹ã©ãã·ã¥ã§ããã
:
| ãªãã©ã«æååã«ãããŠéã¹ã©ãã·ã¥ã«ã¯å§ãããç¹å¥ãªæå³åããããã®ã§
| éã¹ã©ãã·ã¥ãå«ãã ãã¿ãŒã³å®æ°ãèšè¿°ãããšãã¯åãåããã®äžã§ 2 ã€ã®
| éã¹ã©ãã·ã¥ãèšè¿°ããå¿
èŠãããããšã«æ³šæããŠãã ããã ãããã£ãŠã
--
æç° ä¿®åž NETside Technologies Inc.
-- Equal Opportunity for All Good Architectures, NetBSD. --
> ããã¯ã¹ã©ãã·ã¥ã¯ 2 ã€èŠãæ§ã§ãã
>
> http://www.postgresql.jp/document/pg734doc/user/functions-matching.html#FUNCTIONS-LIKE
>
> | ãªãã©ã«ã®ã¢ã³ããŒã¹ã³ã¢ãããŒã»ã³ãèšå·ãä»ã®æåã®ãããã³ã°ã«
> | 䜿çšããã®ã§ã¯ãªããã®ãã®ããããããããå Žåã«ã¯ãpattern ã®äžã®
> | ããããã®ã¢ã³ããŒã¹ã³ã¢ãšããŒã»ã³ãèšå·ã¯ãšã¹ã±ãŒãæåã§ãšã¹ã±ãŒã
> | ãããªããã°ãªããŸãããããã©ã«ãã®ãšã¹ã±ãŒãæåã¯éã¹ã©ãã·ã¥ã§ããã
> :
>
> | ãªãã©ã«æååã«ãããŠéã¹ã©ãã·ã¥ã«ã¯å§ãããç¹å¥ãªæå³åããããã®ã§
> | éã¹ã©ãã·ã¥ãå«ãã ãã¿ãŒã³å®æ°ãèšè¿°ãããšãã¯åãåããã®äžã§ 2 ã€ã®
> | éã¹ã©ãã·ã¥ãèšè¿°ããå¿
èŠãããããšã«æ³šæããŠãã ããã ãããã£ãŠã
ãªãã»ã©ã
news:bkmnkd$m4u$1...@caraway.media.kyoto-u.ac.jp ã«èšããäºäŸã§ã¯ã
\ ãïŒã€èšè¿°ããã°ããŸãè¡ããšèšãäºãåãããŸããã
äžè¿°ãã URI ã®èšäºã®äºäŸã«æ»ããŸããã
LIKE '\%%' ã¯ã
'\%%' ã LIKE ã®åŠçã«ç§»ãåã«ãµãŒããŒèªäœã \ ã解éããŠããŸãã
å®é LIKE ã«ãã¿ãŒã³ãæž¡ããããšãã«ã¯ã
'%%' ãšãªã£ãŠããŸã£ãããå
šãŠã®è¡ãåé€ãããŠããŸã£ãã
ãã®ãããäžè¿°ããURIã®èšäºã«ç€ºãããšããã®åäœãããããå Žåã¯ã
LIKE ã« '\%%' ãããŸãæž¡ãããã«ãæåã® \ ããšã¹ã±ãŒãããå¿
èŠãããã
ãšèšã解éã§ãã£ãŠãŸãããïŒ
-- K.Yamamoto
>> | ãªãã©ã«æååã«ãããŠéã¹ã©ãã·ã¥ã«ã¯å§ãããç¹å¥ãªæå³åããããã®ã§
> LIKE ã« '\%%' ãããŸãæž¡ãããã«ãæåã® \ ããšã¹ã±ãŒãããå¿
èŠãããã
>
> ãšèšã解éã§ãã£ãŠãŸãããïŒ
1.1.2.1 æååå®æ° ã®ãšããã«ããC èšèªåœ¢åŒã®ããã¯ã¹ã©ãã·ã¥ã«ãã
ãšã¹ã±ãŒããæå¹ã.. ãšããéšåãããã\b, \f, \n, \r, \t,
8 é²æ° \xxx ã§æåæå®ãšãã§ãããããªã®ã§ãããã®é¢ä¿ãªã®ã§ã¯ãªãã§
ããããã
news:bko41k$eou$1...@caraway.media.kyoto-u.ac.jp ã«èšããå
容ãš
ã»ãŒåãã§ãããLIKE ã«ã€ããŠãŸãšããŠã¿ãŸããã
LIKE 㧠% ããå§ãŸãæååãå°ãåºãã«ã¯ã
ãLIKE èªèº«ã« '\%%' ãšèªèãããªããŠã¯ãªããªãã
ãã®ãã LIKE '\%%' ãšèšãèšè¿°ã ãšã
\% ããšã¹ã±ãŒããããããã ã® % ããšèªèããŠããŸãã
LIKE ã« '%%' ãšè©äŸ¡ãããŠããŸãã
ãã®ãã LIKE ã« '\%%' ãšèªèãããã«ã¯ã
LIKE '\\%%' ãšèšè¿°ã \ ããšã¹ã±ãŒãããå¿
èŠãããã
( _ ãåæ§)
äžèšã®äºæãèžãŸãã
æå \ ããå§ãŸãæååã LIKE ã«ãã£ãŠå°ãåºãã«ã¯ã
LIKE '\\\\%' ãšæ²æšãªç¶æ³ã«ãªããããããããããªãã
= æŒç®åçãšéã£ãŠãLIKE ãæŒç®åãšèšãå²ã«ã¯ã
ããšã§åã£ãŠä»ãããããªå°è±¡ãæã¡ãŸããã
SQLã®åŠç¿ãé²ããŠããã°ã
ãããã®çç±ãåããããã«ãªããããããªããšä¿¡ãã
ããã°ããããšæããŸãã
ãã©ããŒã¢ããããŠãã ãã£ãæç°ããã«ã¯æè¬ããŠãŸãã
ããããšãããããŸããã
-- K.Yamamoto
> æå \ ããå§ãŸãæååã LIKE ã«ãã£ãŠå°ãåºãã«ã¯ã
> LIKE '\\\\%' ãšæ²æšãªç¶æ³ã«ãªããããããããããªãã
ïŒ ã¹ã¯ãªããå ã§çµã¿ç«ãŠããšããã«åãšãã(ç¬)
ããäžåºŠåŒçšããŸãã
| ãªãã©ã«æååã«ãããŠéã¹ã©ãã·ã¥ã«ã¯å§ãããç¹å¥ãªæå³åããããã®ã§
| éã¹ã©ãã·ã¥ãå«ãã ãã¿ãŒã³å®æ°ãèšè¿°ãããšãã¯åãåããã®äžã§ 2 ã€ã®
æšæž¬ã§ãããããªãã©ã«æååããšããŠäžåºŠè§£éãããããã«ãã®åŸ
ããã¿ãŒã³å®æ°ããšããŠè§£éãããããšããå®è£
ã«ãªã£ãŠãããšæãããŸãã
> = æŒç®åçãšéã£ãŠãLIKE ãæŒç®åãšèšãå²ã«ã¯ã
> ããšã§åã£ãŠä»ãããããªå°è±¡ãæã¡ãŸããã
ãã®ãšããã§ããåã£ãŠä»ããããšããããšããšã
PostgreSQL åºæã®éœåã ãšæããŸãã
fj.comp.databasesã®èšäº<bkoge5$ks4$1...@caraway.media.kyoto-u.ac.jp>ã§
nos...@excite.co.jpããã¯æžããŸããã
> æå \ ããå§ãŸãæååã LIKE ã«ãã£ãŠå°ãåºãã«ã¯ã
> LIKE '\\\\%' ãšæ²æšãªç¶æ³ã«ãªããããããããããªãã
20幎ãããåã®Communications of ACMã«æ²èŒãããŠã
ãThe Telnet SongãšããæãæãåºããŠããŸããŸããã
There is a program called telnet to get to another
CPU...ãšããæè©ã§å§ãŸããã€ã§ããæžããã®ã¯æ¯çã§
åã®ç¥ãããGuy L. Steele Jr.ã
telnetãšããã³ãã³ãã¯åœæãããã£ãã®ã§ããããªã
ãã€ã³ã¿ãŒããããªã©ååšããªãããã®è©±ãªã®ã§ãæ¥ç¶
å
ã«æå®ã§ããã®ã¯é£æ¥ãããã¹ãã ããé ãã®ãã¹ã
ã«ã€ãªãã«ã¯telnetã§ãšãªãã®ãã¹ãã«å
¥ãããããã
ãŸãå¥ã®ãã¹ãã«telnetããããããããã«å¥ã®ãã¹ã
ã«...ãšããå
·åã§ããã
telnetã®ãšã¹ã±ãŒãæåã¯^^(Control-Uparrow)ãæ¥ç¶
çµäºã³ãã³ãã¯qã ã£ãã®ã§ãèªãã¹ãããé£æ¥ãã¹ã
ãžã®telnetã¯^^-qã§çµäºã§ããŸããããé£æ¥ãã¹ããã
ãã®ãšãªããžã®telnetãçµäºããã«ã¯^^-^^-qãããã«
ãã®ãšãªãã®ãšãã¯^^-^^-^^-^^-qãšãã£ãå
·åã«ã¿ã€
ãããå¿
èŠããã£ãããã§ããã
ã§ãThe Telnet Songã¯ã1çªã¯Control-Uparrow Qã§çµ
ãããã©ã2çªã¯Control-Uparrow Control-Uparrow Qã
3çªã¯Control-Uparrow Control-Uparrow Control-
Uparrow Control-Uparrow Qãšãã£ãå
·åã§ãnçªã®æè©
ã¯Control-Uparrowã2^(n-1)åããè¿ããããšã«Qã§çµ
ããããã«ãªã£ãŠããããã§ããæè©ãäœçªãŸã§ãã£ã
ãæ¶ããŠããªãã®ã§ãããå
ã«é²ãã«åŸã£ãŠãšã³ãã£ã³
ã°ãã ãã ã䌞ã³ãŠããŠãç¥ããã«èãã人ã¯ãã®ãã¡
ããããç¬ãåºãããšã«ãªããšãããããã
æ¬é¡ã«æ»ã£ãŠãšã¹ã±ãŒãã®\ãããã€é£ç¶ããŠæžããã§
ãããç§ã¯Cã§æžããMakefileçæããã°ã©ã ã§\ã8å
䞊ã¹ãŠæžããèšæ¶ããããŸãã(^^;
--
倪ç°çŽ(Junn Ohta) (æ ª)ãªã³ãŒ/æ°æšªæµäºæ¥æ
oh...@sdg.mdd.ricoh.co.jp