ææãã§ã
O/R Mapper ã«ããããã¼ã¸ã£ã¼ã®å®è£ ã«ã¤ã㦠O/R Mapper ã«ããã¦ã¯ãã¼ã¸ã£ã¼ã®å®è£ æ¹æ³ã¯3種é¡ããããããã¾ãã 1. ã¯ã¨ãªãã count(*) æãçºè¡ãã¦ãåæã« Pager ãªãã¸ã§ã¯ããã¤ãã æ¡ç¨ãã¦ããO/R Mapper DBIx::Class å©ç¹ åæã«å¦çãã¦ãããã®ã§æ¥½ã æ¬ ç¹ $rs->pager(); ã®ããã«ãã¯ã¨ãªããã£ã¦ããã£ã½ããªãã®ã«è£ã§ãã£ã¦ãã®ã§ãéãå¦çãªã®ã«ããããã«ã¿ããªãã¦ãããã®ãé¢åããæ°è»½ã«ã¤ããããã¦å±éºã HAVING ãªã©ãã¤ããã¯ã¨ãªã®å ´åããããããã ããå¤ãã¨ãã¦ãªãã®ã«ããªãã¨ãªããããã¦ãã¾ããã¾ã¡ãã£ãå¤ãããã API ãæ¨æºã§ã¤ããã®ã¯ããããªãã®ãã å¾ã« HAVING ãªã©ã®å¦çããã¾ãã§ããªãã®ã¯èªæãªã®ã§ãããããå®è£ ã¯åã¯å¥½ãã§ã¯ãªãã§ãã â Teng ã«ã¯ã¤ãã¦ãªãã 2.
LIMIT 20 OFFSET (:page - 1) * 20 ã¿ãããªã¯ã¨ãªã¯ :page ã«å¤§ããå¤ãå ¥ãããããã«è¨è¨ããã¦ãã¨ã¯ã¨ãªã«æ®ºãããã®ã§ã WHERE key = :offset_for_next_page LIMIT 20 ãªã¯ã¨ãªã«ãªãããè¨è¨ãã¦ã»ããã http://twitter.com/kamipo/status/56304601049210880 俺ããã¹ã«æããã¾ã§ç¥ããªãã£ãã®ã ãã mysql> select id from mentions order by id asc limit 100, 10;ããããã¨ã¯ã ãã¼ã¿ã10åã ãfetchãã ã§ã¯ãªãã 110åãã¼ã¿ãfetchãã¦ãå é ãã100åæ¨ã¦ã ã ãä½ãä»æ´ã£ã¦æãã§ãããã¼ç¥ã£ãã®ã¯10ã¶æã»ã©åã§ããã俺ã®æªçããæãç¥ãã ã§ããã®ããã«limitãä»ãã¦ãã¼ã¿ãåå¾ãã
ä¾ãã° % mysql --pager='less'ãªã©ããã¨ãselectãªã©ã®çµæãlessã§è¦ããã¨ãåºæ¥ãã ãã®æã«ä¸ä¸ã¹ã¯ãã¼ã«ã¯vim風㫠j/k ã§åºæ¥ãããã横ã¹ã¯ãã¼ã«ã¯ååãã¼ã§ãããã¨ã«ãªãã ããã使ãè¾ãã®ã§ãvimã¨åãã h/l ã§æ¨ªã¹ã¯ãã¼ã«ããããã«ããã % cat .lesskey #command h left-scroll l right-scrollã¨ãããã¡ã¤ã«ãä½ã£ã¦ % lesskeyãå®è¡ããã㨠$HOME ã« .less ã¨ãããã¡ã¤ã«ãçæãããã ãã¨ã¯æ®éã«mysqlã¨ãå®è¡ããã°ããã ããã©ã«ãã§ã¯æ¨ªã¹ã¯ãã¼ã«ã®ç§»åå¹ ã¯1æååã§ããã 使ãè¾ãã®ã§ãlessã® -# ãªãã·ã§ã³ã§5æååã«ããã alias mysql="mysql --pager='less -S -# 5'"
é害
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}