{"id":200473,"date":"2025-05-06T10:02:39","date_gmt":"2025-05-06T02:02:39","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200473\/"},"modified":"2025-05-06T10:02:39","modified_gmt":"2025-05-06T02:02:39","slug":"mysql-%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%a6%82%e4%bd%95%e5%87%86%e7%a1%ae%e6%9f%a5%e8%af%a2%e5%8c%85%e5%90%ab%e6%97%a5%e6%96%87%e5%81%87%e5%90%8d%e7%9a%84%e5%ad%97%e6%ae%b5%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200473\/","title":{"rendered":"MySQL \u6b63\u5219\u8868\u8fbe\u5f0f\u5982\u4f55\u51c6\u786e\u67e5\u8be2\u5305\u542b\u65e5\u6587\u5047\u540d\u7684\u5b57\u6bb5\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>MySQL \u6b63\u5219\u8868\u8fbe\u5f0f\u5982\u4f55\u51c6\u786e\u67e5\u8be2\u5305\u542b\u65e5\u6587\u5047\u540d\u7684\u5b57\u6bb5\uff1f<\/h1>\n<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300aMySQL \u6b63\u5219\u8868\u8fbe\u5f0f\u5982\u4f55\u51c6\u786e\u67e5\u8be2\u5305\u542b\u65e5\u6587\u5047\u540d\u7684\u5b57\u6bb5\uff1f\u300b\uff0c\u8986\u76d6\u4e86\u6570\u636e\u5e93\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241106\/1730852503672ab6975419f.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>mysql \u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u7cca\u67e5\u8be2\u65e5\u6587\u5047\u540d<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong>\u5982\u4f55\u4f7f\u7528 mysql \u6b63\u5219\u8868\u8fbe\u5f0f\u67e5\u8be2\u5305\u542b\u65e5\u6587\u5e73\u5047\u540d\u548c\u7247\u5047\u540d\u7684\u5b57\u6bb5\uff0c\u4f46\u76ee\u524d\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u67e5\u8be2\u7ed3\u679c\u4e0d\u51c6\u786e\uff1f<\/p>\n<p><strong>\u7b54\u6848\uff1a<\/strong><\/p>\n<p>\u539f\u5148\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5b58\u5728\u4e00\u5b9a\u7684\u5c40\u9650\u6027\uff0c\u8fd9\u91cc\u63d0\u4f9b\u4e00\u4e2a\u51fd\u6570\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff1a<\/p>\n<pre>create definer=`wq19bar`@`%` function `jp_char_inside`(s text) returns int(11)\nbegin\n    declare h text;\n    declare p integer;\n    declare l integer;\n    declare head text;\n    declare utf_8 text;\n    set h = hex(s);\n    set p = 1;\n    set l = length(h);\n    while p &lt;= l do\n        set head = substr(h, p, 1);\n        if head &lt; '8' then\n            set p = p + 2;\n        else\n            set utf_8 = substr(h, p, 6);\n            if (utf_8 &gt;= 'e38181' and utf_8 &lt;= 'e3829e') then\n                return 1;\n            end if;\n            if (utf_8 &gt;= 'e382a1' and utf_8 &lt;= 'e383be') then\n                return 1;\n            end if;\n            set p = p + 6;\n        end if;\n    end while;\nreturn 0;\nend<\/pre>\n<p>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<pre>SELECT * FROM table_name WHERE jp_char_inside(title) = 1;<\/pre>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300aMySQL \u6b63\u5219\u8868\u8fbe\u5f0f\u5982\u4f55\u51c6\u786e\u67e5\u8be2\u5305\u542b\u65e5\u6587\u5047\u540d\u7684\u5b57\u6bb5\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u6b63\u5219\u8868\u8fbe\u5f0f\u5982\u4f55\u51c6\u786e\u67e5&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200473","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200473"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200473\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}