{"id":2041,"date":"2017-10-13T16:16:24","date_gmt":"2017-10-13T12:18:16","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2041"},"modified":"2017-10-13T16:38:55","modified_gmt":"2017-10-13T08:38:55","slug":"%e9%9d%a0%e6%8e%92%e7%85%a7%e7%89%87%e5%92%8c%e6%8b%8d%e8%a7%86%e9%a2%91%e5%81%9a%e5%88%b0%e6%9c%88%e5%85%a510%e4%b8%87-17","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2041","title":{"rendered":"\u4f7f\u7528MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b9e\u73b0blob\u4e8c\u8fdb\u5236\u5b57\u6bb5\u6570\u636e\u7684\u62fc\u63a5"},"content":{"rendered":"<p>\n\tMySQL \u4e2d\u6709\u4e00\u4e2a\u4e8c\u8fdb\u5236\u7684\u5927\u5b57\u6bb5,\u4f7f\u7528\u7684\u4eba\u4e0d\u662f\u5f88\u591a\u3002\u4eca\u5929\u6211\u4eec\u6765\u5b9e\u73b0\u4e00\u4e2a\u5173\u4e8e MySQL \u4e8c\u8fdb\u5236\u5b57\u6bb5\u7684\u6570\u636e\u62fc\u63a5,\u5e76\u56de\u987e\u4e00\u4e0b\u5b58\u50a8\u8fc7\u7a0b\u3002 &nbsp;\u6700\u8fd1\u7528\u5230\u5b58\u50a8\u8fc7\u7a0b\u4e3b\u8981\u662f\u56e0\u4e3a\u5f53\u524d\u4f7f\u7528\u7684\u51fd\u6570\uff0c\u5728\u5904\u7406\u62fc\u63a5\u7684\u8fc7\u7a0b\u65f6\u7531\u4e8e\u5b57\u6bb5\u8f83\u5927\u4f1a\u51fa\u73b0\u5185\u5b58\u548ccpu\u8d1f\u8f7d\u8fc7\u91cd\u7684\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u51b3\u5b9a\u4f7f\u7528\u5b58\u50a8\u8fc7\u7a0b\u8bd5\u4e00\u8bd5\u3002\n<\/p>\n<p>\n\t\u4e0b\u9762\u662f\u6211\u7684\u62fc\u63a5\u5927\u5b57\u6bb5blob\u7684\u76f8\u5173SQL\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\nDROP PROCEDURE IF EXISTS sq_xttblog; \r\n\r\nDELIMITER \/\/\r\nCREATE PROCEDURE sq_xttblog(in in_date datetime,in in_bri BLOB) \r\nBEGIN\r\n\tdeclare var_count int DEFAULT 0;  \r\n\tdeclare var_desc VARCHAR(255);  \r\n\tSET var_desc = CONCAT(&#039;a&#039;,t.desc);\r\n  SELECT count(1) INTO var_count FROM test date=in_date;\r\n\tif var_count &gt; 0 then  \r\n\t\t\tUPDATE test t SET  t.desc = var_desc WHERE t.date=&#039;2017-09-25 20:47:41&#039;;\r\n\t\t\tCOMMIT;\r\n\telse  \r\n\t\t\tINSERT INTO test(`date`, `time`, `bri`, `desc`) VALUES (in_date, &#039;2017-09-25&#039;, bri, &#039;a&#039;);\r\n\t\t\tCOMMIT;\r\n\tend if; \r\nEND\/\/\r\nDELIMITER ;\r\n\r\nCALL sq_xttblog(&#039;2017-09-25 20:47:41&#039;,&#039;0101001010&#039;); \t<\/pre>\n<p>\n\t\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u6ce8\u610fMysql\u7684\u7248\u672c\uff0c\u4f4e\u7248\u672c\u7684\u53ef\u80fd\u5bf9CONCAT\u51fd\u6570\u4e0d\u652f\u6301\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2041\">\u4f7f\u7528MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b9e\u73b0blob\u4e8c\u8fdb\u5236\u5b57\u6bb5\u6570\u636e\u7684\u62fc\u63a5<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>MySQL \u4e2d\u6709\u4e00\u4e2a\u4e8c\u8fdb\u5236\u7684\u5927\u5b57\u6bb5,\u4f7f\u7528\u7684\u4eba\u4e0d\u662f\u5f88\u591a\u3002\u4eca\u5929\u6211\u4eec\u6765\u5b9e\u73b0\u4e00\u4e2a\u5173\u4e8e MySQL \u4e8c\u8fdb\u5236\u5b57\u6bb5\u7684\u6570\u636e\u62fc\u63a5 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[1202,1535,83,1536],"class_list":["post-2041","post","type-post","status-publish","format-standard","hentry","category-sql","tag-blob","tag-concat","tag-mysql","tag-1536"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2041"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2041\/revisions"}],"predecessor-version":[{"id":2157,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2041\/revisions\/2157"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}