ãµã¼ãã¹çµäºã®ãç¥ãã NAVERã¾ã¨ãã¯2020å¹´9æ30æ¥ããã¡ã¾ãã¦ãµã¼ãã¹çµäºãããã¾ããã ç´11å¹´éãNAVERã¾ã¨ãããå©ç¨ã»ãæ顧ããã ãèª ã«ãããã¨ããããã¾ããã
以ä¸ã®ãããªãã¿ã´ã©ã¹ã®å®çã使ã£ãæå®ããçµåº¦ç·¯åº¦ã«æãè¿ããã¼ã¿ãåå¾ããSQLã¯çµæ§ãããã¡ã§ãããCPUè² è·ãé«ãå¹çãæªãã®ã§MySQLã«æ¨æºæè¼ã¨ãªã£ã空éæ å ±(geometry)ã使ã£ã¦ã¿ããã¨ã«ãã¾ãã SELECT * FROM loc ORDER BY power(abs(latitude - 緯度 ), 2) + power(abs(longitude - 緯度 ), 2) LIMIT 1 MySQLã®ç©ºéæ å ±(geometry)æ©è½ã¯PostGIS(Postgresã«ã¹ã¿ãã¤ãº)ã«æ¯ã¹ãã¨è²§å¼±ãªã®ã§ããã®çºã®å·¥å¤«ãè¡ãã¾ããä¾ãã°ããã®ã¨ããã®ã¾ã¾ã ã¨éã«SQLãé ããªãã¾ãã ã¾ãã¯ããã¼ãã«å®ç¾©ãã é常ã®ãã¼ãã« CREATE TABLE IF NOT EXISTS `loc` ( `loc_id` int(11) NOT NULL auto_incremen
æè¿ã®Webãµã¼ãã¹ã§ã¯ãå¤é¨APIãæ´»ç¨ãããã®ãé常ã«å¤ããªã£ã¦ãã¾ããååã¯å¤é¨APIã®ã¢ã¯ã»ã¹æ°å¶éãåé¿ããããã®ãã£ãã·ã¥ãåã³å ·ä½ä¾ã¨ãã¦ä½ç½®æ å ±ãµã¼ãã¹ã®foursquare APIã®çµæããã£ãã·ã¥ããä»çµã¿ãè¨è¨ãã¾ãããä»åã¯ãMySQLã«ä¿åãããä½ç½®æ å ±ãã¼ã¿ã®ãã£ãã·ã¥ãMySQL Spatial Extensionsã使ã£ã¦æ¤ç´¢ããæ¹æ³ã«ã¤ãã¦èª¬æãã¾ãã ã¯ããã« Rettyæ ªå¼ä¼ç¤¾ã®é¹¿å³¶ã§ããååã¯ãæè¿ã®Webãµã¼ãã¹ã§ãã使ããã¦ããå¤é¨ã®APIããã³ãµã¼ãã¹åæ¢ã«è´å½çãªå½±é¿ãä¸ããããªãrate limitã«ã¤ãã¦èª¬æãã¾ãããã¾ãrate limitã®è¶ éãé²ãããã®ããã£ãã·ã¥ãã¨ããæ¹æ³ã«ã¤ãã¦ã説æãã¾ããã å ·ä½ä¾ã¨ãã¦ãä½ç½®æ å ±SNSãµã¼ãã¹ã§ããfoursquareã®APIãåãä¸ãããã®çµæããã£ãã·ã¥ããä»çµã¿ã®åºæ¬çãªè¨è¨ã説æ
PHPã¨MySQLã使ãããåä»æéï½çµäºæéãã®æ¤ç´¢ããã¹ããã¦ãã¾ãã 次ã®æ¥ã«ã¾ããæéï¼10:00ï½ç¿2:00ãªã©ï¼ã®å ´åãã©ã®ããã«DBã«ç»é²ãã¦ã ã©ã®ãããªSQLæãæ¸ãã°ããã®ç¯å²å ã«ããããããã¼ã¿ãæ½åºåºæ¥ããåããã¾ããã æ¥ãã¾ãããªãå ´åã以ä¸ã®ããã«ãã¦ãã¾ããã SELECT * FROM shop start_time<'$date' && last_time>'$date' $date = date("H:i");//ç¾å¨ã®æé start_timeã¨last_timeã®ãã¼ã¿åã¯ãtimeãã§ãã ãããããï¼start_timeã«ã10:00:00ããlast_timeã«ã23:00:00ãã®ã¬ã³ã¼ããããã22æã«SQLãå®è¡ãã ãããããªã:start_timeã«ã10:00:00ããlast_timeã«ã02:00:00ãã®ã¬ã³ã¼ããããã22
ð Awesome, you're subscribed! Thanks for subscribing! Look out for your first newsletter in your inbox soon! Get us in your inbox Sign up to our newsletter for the latest and greatest from your city and beyond
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}