{"id":144,"date":"2006-12-24T17:15:57","date_gmt":"2006-12-24T09:15:57","guid":{"rendered":"http:\/\/twycf.com\/wordpress\/archives\/144"},"modified":"2006-12-24T17:16:40","modified_gmt":"2006-12-24T09:16:40","slug":"%e4%bd%bf%e7%94%a8-transaction-%e7%9a%84%e7%96%91%e5%95%8f","status":"publish","type":"post","link":"https:\/\/twycf.com\/?p=144","title":{"rendered":"\u4f7f\u7528 transaction \u7684\u7591\u554f"},"content":{"rendered":"<p>\u9019\u5e7e\u5929\u525b\u597d\u8981\u5be6\u4f5c\u4e00\u500b\u7a0b\u5f0f\uff0c\u9019\u662f\u4e00\u96bb\u8cc7\u6599\u5eab\u7a0b\u5f0f\uff0c\u800c\u8cc7\u6599\u5eab\u662f\u4f7f\u7528 Mysql\u3002\u7a0b\u5f0f\u672c\u8eab\u6c92\u4ec0\u9ebc\u597d\u8b1b\u7684\uff0c\u4f46\u662f\u537b\u9700\u8981\u4f7f\u7528 Transaction\uff0c\u7a81\u7136\u60f3\u8d77\u5f88\u4e45\u4ee5\u524d\u4f7f\u7528 Mysql + Transaction \u78b0\u5230\u7684\u554f\u984c\uff0c\u9023\u5fd9\u7ffb\u51fa\u820a\u7684\u96fb\u8166\u8a18\u9304\uff0c\u5728\u9019\u88e1\u76f4\u63a5\u8cbc\u4e0a\u4f86\uff1a<!--more--><br \/>\n=====<br \/>\nQ:\u4f7f\u7528 transaction \u7684\u7591\u554f\uff1a<br \/>\n\u4e00\u5b9a\u8981\u7528 InnoDB\u3001BDB \u624d\u80fd\u7528 Trans\uff0c\u4f46 InnoDB \u4e0d\u652f\u63f4 AUTO_INCREMENT \u5728\u591a\u500b Key \u88e1\uff0c<br \/>\n\u6240\u4ee5\u6709 AUTO_INCREMENT multi-key table\u53ea\u80fd\u7528 BDB\uff0c\u4f46 dreamhost \u4e0d\u652f\u63f4 BDB!!!!!!!!!!<br \/>\nA:\u81ea\u5df1\u6293 AUTO_INCREMENT \u503c<br \/>\n=====<br \/>\n\u9019\u500b\u554f\u984c\u662f\u5728 Mysql Server 3.23.49 \u4e0a\u6e2c\u8a66\u7684\uff0c\u800c InnoDB \u5728 Mysql 5.0 \u5df1\u7d93 AUTO_INCREMENT \u6b04\u4f4d\uff0c\u4f46\u662f InnoDB \u7684 AUTO_INCREMENT \u662f\u6bcf\u6b21\u5411\u8cc7\u6599\u5eab\u67e5\u8a62\u800c\u5f97\u4f86\uff0c\u800c\u9019\u500b\u503c\u4e26\u4e0d\u6703\u5beb\u5165\u78c1\u789f\uff0c\u800c\u662f\u5b58\u5728\u8a18\u61b6\u9ad4\u88e1\uff0c\u5f15\u8ff0\u4e00\u6bb5\u5b98\u65b9\u6587\u4ef6\uff1a<br \/>\nIf you specify an AUTO_INCREMENT column for an InnoDB table, the table handle in the InnoDB data dictionary contains a special counter called the auto-increment counter that is used in assigning new values for the column. <strong>This counter is stored only in main memory, not on disk<\/strong>. <\/p>\n<p>InnoDB uses the following algorithm to initialize the auto-increment counter for a table T that contains an AUTO_INCREMENT column named ai_col: After a server startup, for the first insert into a table T, InnoDB executes the equivalent of this statement:<br \/>\n<coolcode linenum=\"off\">SELECT MAX(ai_col) FROM T FOR UPDATE;<\/coolcode><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u5e7e\u5929\u525b\u597d\u8981\u5be6\u4f5c\u4e00\u500b\u7a0b\u5f0f\uff0c\u9019\u662f\u4e00\u96bb\u8cc7\u6599\u5eab\u7a0b\u5f0f\uff0c\u800c\u8cc7\u6599\u5eab\u662f\u4f7f\u7528 Mysql\u3002\u7a0b\u5f0f\u672c\u8eab\u6c92\u4ec0\u9ebc\u597d\u8b1b\u7684\uff0c\u4f46\u662f\u537b\u9700\u8981\u4f7f\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-144","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/posts\/144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=144"}],"version-history":[{"count":0,"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/posts\/144\/revisions"}],"wp:attachment":[{"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}