ããã¯ãããããªããMySQL InnoDBã®è¡ã¬ãã«ããã¯ãèªãã ãã©ãã¤ãã¤ãããããªããã¨ããããã§ã社å ã®åå¼·ä¼ã§ç¥ã£ããã¨ãã¾ã¨ãã¦ã¿ãã FOR UPDATEãLOCK IN SHARE MODEã«ãã£ã¦ããã®ãã©ã³ã¶ã¯ã·ã§ã³ä¸ã«èµ°ãå¥ç»é¢ã§ã®ã¯ã¨ãªã®å¦çã®ã¿ã¤ãã³ã°ãç°ãªãã FOR UPDATEã«ãããã㯠ã¾ãã¯ç»é¢Aã§æ¥ç¶ãè¡ããããã©ã³ã¶ã¯ã·ã§ã³ãéå§ãããSELECTæãçºè¡ãããã¨ããã [ç»é¢A] BEGIN; // ãã©ã³ã¶ã¯ã·ã§ã³Aéå§ SELECT * FROM users WHERE id = 1 FOR UPDATE; COMMIT; // ãã©ã³ã¶ã¯ã·ã§ã³Açµäº ããã¦ãã©ã³ã¶ã¯ã·ã§ã³Aã®éå§å¾ãçµäºåã«ç»é¢BãDãã¯ã¨ãªãçºè¡ããã¨ããã ã¡ãªã¿ã«ãã©ã³ã¶ã¯ã·ã§ã³ãéå§ãã¦ãããªãã¨FOR UPDATEãæ¸ãã¦ãç»é¢Aã§ã®ããã¯ãå§ã¾ããªãã®ã§è¦æ³¨
{{#tags}}- {{label}}
{{/tags}}