{"id":5110,"date":"2016-11-29T10:00:13","date_gmt":"2016-11-29T01:00:13","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=5110"},"modified":"2016-11-29T07:20:30","modified_gmt":"2016-11-28T22:20:30","slug":"%e6%96%b0%e4%ba%ba%e6%88%90%e9%95%b7%e8%a8%98%e9%8c%b216th","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/5110","title":{"rendered":"\u65b0\u4eba\u6210\u9577\u8a18\u933216th"},"content":{"rendered":"<p><a href=\"\/appnews\/archives\/5079\">\u524d\u56de<\/a>\u306f\u3001DB(DataBase)\u306e\u64cd\u4f5c\u306b\u3064\u3044\u3066\u66f8\u304d\u307e\u3057\u305f<br \/>\n\u4eca\u56de\u306f\u3001DB\u306b\u304a\u3051\u308b\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u3044\u304d\u307e\u3059<\/p>\n<p><!--more--><\/p>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306f\u958b\u59cb\u6642\u306bBEGIN TRANSACTION\u306e\u5ba3\u8a00\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<br \/>\n\u305d\u3057\u3066\u3001\u51e6\u7406\u3092\u78ba\u5b9a\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u3001COMMIT\u3092\u3057\u307e\u3059<br \/>\n\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u958b\u59cb\u524d\u306e\u72b6\u614b\u306b\u623b\u3059\u5834\u5408\u306b\u306f\u3001ROLLBACK\u3092\u3057\u307e\u3059<\/p>\n<pre style=\"border: dashed #000000 2px\"><code>\/\/\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306e\u958b\u59cb\r\n\/\/db.execSQL(\"BEGIN TRANSACTION\")\u3068\u540c\u3058\u610f\u5473\r\ndb.beginTransaction();\r\ntry {\r\n\tif (db.delete(tableName, whereClause, whereArgs) &gt; 0) {\r\n\t\t\/\/\u6210\u529f\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u308b\r\n\t\tdb.setTransactionSuccessful();\r\n\t}\r\n} finally {\r\n\t\/\/\u6210\u529f\u30d5\u30e9\u30b0\u304c\u7acb\u3063\u3066\u3044\u308c\u3070COMMIT\u3001\u306a\u3051\u308c\u3070ROLLBACK\u304c\u5b9f\u884c\u3055\u308c\u308b\r\n\t\/\/db.execSQL(\"COMMIT TRANSACTION\")\u53c8\u306f\u3001db.execSQL(\"ROLLBACK TRANSACTION\")\u3068\u540c\u3058\u610f\u5473\r\n\tdb.endTransaction();\r\n\tdb.close();\r\n}\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306fACID\u7279\u6027\u3068\u547c\u3070\u308c\u308b\u30014\u3064\u306e\u8981\u7d20\u3092\u6301\u3064\u3079\u304d\u3068\u3055\u308c\u3066\u3044\u307e\u3059<br \/>\n1 &#8211; \u539f\u5b50\u6027\uff08Atomicity\uff09<br \/>\n2 &#8211; \u4e00\u8cab\u6027\uff08consistency\uff09<br \/>\n3 &#8211; \u72ec\u7acb\u6027\uff08isolation\uff09<br \/>\n4 &#8211; \u6c38\u7d9a\u6027\uff08durability\uff09<\/p>\n<h3>\u539f\u5b50\u6027<\/h3>\n<p>\u3053\u308c\u4ee5\u4e0a\u306b\u51e6\u7406\u3092\u5206\u5272\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u6700\u5c0f\u306e\u5358\u4f4d\u306e\u3053\u3068<br \/>\n\u51e6\u7406\u306e\u3059\u3079\u3066\u304c\u6210\u529f\u304b\u3001\u5931\u6557\u3092\u3057\u7121\u52b9\u306b\u306a\u308b\u304b\u306e\u3069\u3061\u3089\u304b\u3067\u3042\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059<br \/>\n\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u4e2d\u306e\u51e6\u7406A\u3001B\u3001C\u306eA\u304c\u6210\u529f\u3057\u3001B\u304c\u5931\u6557\u3057\u305f\u6642\u306b\u306f\u3001C\u306e\u51e6\u7406\u3092\u884c\u308f\u305a\u306bA\u3068B\u306e\u51e6\u7406\u3092\u7121\u52b9\u306b\u3057\u3066\u3001DB\u306e\u72b6\u614b\u3092\u51e6\u7406A\u304c\u5b9f\u884c\u3055\u308c\u308b\u524d\u306b\u623b\u3057\u307e\u3059<\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30de\u611f\u899a\u3067\u8a00\u3046\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u304b\u306d<\/p>\n<pre style=\"border: dashed #000000 2px\"><code>if(funcA() &amp;&amp; funcB() &amp;&amp; funcC()){\r\n\t\/\/\u6210\u529f\u6642\u306e\u51e6\u7406\r\n}else{\r\n\t\/\/\u5931\u6557\u6642\u306e\u51e6\u7406\r\n}\r\n<\/code><\/pre>\n<h3>\u4e00\u8cab\u6027<\/h3>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u306e\u524d\u5f8c\u3067\u3001\u6574\u5408\u6027\u306e\u3042\u308b\u30c7\u30fc\u30bf\u3067\u3042\u308b\u3053\u3068<br \/>\nA\u3055\u3093\u306e\u53e3\u5ea7\u304b\u3089B\u3055\u3093\u306e\u53e3\u5ea7\u306b\u632f\u8fbc\u307f\u3092\u3057\u305f\u6642\u306b\u3001A\u3055\u3093\u306e\u53e3\u5ea7\u304b\u3089\u306f\u5f15\u304f\u51e6\u7406\u306f\u6210\u529f\u3057\u3066\u3001B\u3055\u3093\u306e\u53e3\u5ea7\u306b\u8db3\u3059\u51e6\u7406\u304c\u5931\u6557\u3057\u3066\u3068\u3044\u3046\u306e\u306f\u3001A\u3055\u3093\u306e\u53e3\u5ea7\u304b\u3089\u5f15\u304b\u308c\u305f\u304a\u91d1\u304c\u3069\u3053\u304b\u3078\u6d88\u3048\u305f\u3053\u3068\u306b\u306a\u308a\u3001\u4e00\u8cab\u6027\u304c\u4fdd\u3066\u3066\u3044\u307e\u305b\u3093<\/p>\n<h3>\u72ec\u7acb\u6027<\/h3>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u4e2d\u306e\u30c7\u30fc\u30bf\u304c\u4ed6\u306e\u64cd\u4f5c\u304b\u3089\u53c2\u7167\u3055\u308c\u306a\u3044\u3053\u3068<br \/>\n\u4f8b\u3068\u3057\u3066\u3001A\u53e3\u5ea7\u304b\u3089B\u53e3\u5ea7\u306b5\u4e07\u5186\u3092\u632f\u8fbc\u6642\u306e\u51e6\u7406\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u72b6\u614b<\/th>\n<th>A\u53e3\u5ea7<\/th>\n<th>B\u53e3\u5ea7<\/th>\n<\/tr>\n<tr>\n<td>\u9001\u91d1\u524d<\/td>\n<td>100\u4e07\u5186<\/td>\n<td>150\u4e07\u5186<\/td>\n<\/tr>\n<tr>\n<td>\u9001\u91d1\u4e2d<\/td>\n<td>95\u4e07\u5186<\/td>\n<td>150\u4e07\u5186<\/td>\n<\/tr>\n<tr>\n<td>\u9001\u91d1\u5f8c<\/td>\n<td>95\u4e07\u5186<\/td>\n<td>155\u4e07\u5186<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u306e\u6642\u306b\u3001\u9001\u91d1\u524d\u3068\u9001\u91d1\u5f8c\u306e\u30c7\u30fc\u30bf\u306e\u3044\u305a\u308c\u304b\u3057\u304b\u53c2\u7167\u306f\u3067\u304d\u307e\u305b\u3093<br \/>\n\u9001\u91d1\u4e2d\u306e\u30c7\u30fc\u30bf\u304c\u53c2\u7167\u53ef\u80fd\u306e\u5834\u5408\u3001\u6574\u5408\u6027\u3092\u4fdd\u3066\u306a\u304f\u306a\u308b\u5834\u5408\u304c\u3067\u3066\u304d\u307e\u3059<\/p>\n<h3>\u6c38\u7d9a\u6027<\/h3>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5b8c\u4e86\u5f8c\u306e\u30c7\u30fc\u30bf\u306f\u4fdd\u5b58\u3055\u308c\u3001\u5931\u308f\u308c\u306a\u3044\u3068\u3044\u3046\u3053\u3068<br \/>\n\u3053\u306e\u6027\u8cea\u3092\u4fdd\u8a3c\u3059\u308b\u305f\u3081\u306b\u3001\u57fa\u672c\u7684\u306b\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u3092\u8a18\u9332\u3057\u3066\u304a\u304d\u3001\u969c\u5bb3\u767a\u751f\u6642\u306b\u306f\u305d\u306e\u30ed\u30b0\u3092\u4f7f\u7528\u3057\u3066\u3001\u969c\u5bb3\u767a\u751f\u524d\u306e\u72b6\u614b\u3078\u5fa9\u65e7\u4f5c\u696d\u3092\u884c\u3046<\/p>\n<h3>\u7d42\u308f\u308a\u306b<\/h3>\n<p>BEGIN TRANSACTION\u3092\u5ba3\u8a00\u3057\u306a\u3044\u5834\u5408\u306b\u306f\u3001SQL\u6587\u3092\u5b9f\u884c\u3059\u308b\u3054\u3068\u306b\u6697\u9ed9\u7684\u306bCOMMIT\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u672a\u5ba3\u8a00\u6642\u306e\u64cd\u4f5c\u306b\u306f\u3001\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059<br \/>\n\u30df\u30b9\u3092\u3057\u306a\u3044\u305f\u3081\u306b\u3082\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u3092\u3057\u3066\u3001\u5931\u6557\u304c\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u3001COMMIT\u3092\u5b9f\u884c\u3057\u3066\u78ba\u5b9a\u3092\u3059\u308b\u306e\u304c\u5b89\u5168\u3068\u8a00\u3048\u307e\u3059<\/p>\n<p>\u4eca\u307e\u3067\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u305f\u4e2d\u3067\u306f\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3078\u306e\u610f\u8b58\u306f\u306a\u304b\u3063\u305f\u3068\u8a00\u3048\u307e\u3059<br \/>\n\u6b21\u56de\u304b\u3089\u3001\u4f5c\u6210\u3059\u308b\u6642\u306b\u306f\u51e6\u7406\u3092\u8003\u3048\u3001\u9069\u5207\u306a\u5834\u6240\u3067\u5b9f\u88c5\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059<\/p>\n<p>\u706b\u66dc\u65e5\u62c5\u5f53\uff1apoppy<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/5110\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/5110\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"\u65b0\u4eba\u6210\u9577\u8a18\u933216th\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/5110\" data-text=\"\u65b0\u4eba\u6210\u9577\u8a18\u933216th\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/5110\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/5110\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306f\u3001DB(DataBase)\u306e\u64cd\u4f5c\u306b\u3064\u3044\u3066\u66f8\u304d\u307e\u3057\u305f \u4eca\u56de\u306f\u3001DB\u306b\u304a\u3051\u308b\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u3044\u304d\u307e\u3059<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100,12],"tags":[56,79,101],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/5110"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=5110"}],"version-history":[{"count":18,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/5110\/revisions"}],"predecessor-version":[{"id":5128,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/5110\/revisions\/5128"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=5110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=5110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=5110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}