{"id":5004,"date":"2019-01-20T10:42:07","date_gmt":"2019-01-20T02:42:07","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=5004"},"modified":"2019-01-20T10:42:08","modified_gmt":"2019-01-20T02:42:08","slug":"%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%bamysql-%e5%a2%9e%e5%8a%a0-html-%e5%8f%8d%e8%bd%ac%e4%b9%89%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=5004","title":{"rendered":"[\u6570\u636e\u5e93]\u4e3aMySQL \u589e\u52a0 HTML \u53cd\u8f6c\u4e49\u51fd\u6570"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>create function htmlDecode (s varchar(65536))\nreturns varchar(65536)\nbegin\ndeclare charIndex int;\ndeclare charEnd int;\ndeclare charCode int;\ndeclare retValue varchar(65536);\ndeclare htmlChar varchar(8);\ndeclare Len int;\nset charIndex=1;\nset Len=char_length(s);\nset retValue='';\nwhile charIndex&lt;=Len do\n\tif substring(s,charIndex,2)='&amp;#' then\n\t\tbegin\n\t\tset charIndex=charIndex+2;\n\t\tset charEnd=charIndex;\n\t\tlabelDecode:while charEnd&lt;Len do\n\t\t\tif substring(s,charEnd,1)=';' then\n\t\t\t\tleave labelDecode;\n\t\t\telse\n\t\t\t\tset charEnd=charEnd+1;\n\t\t\tend if;\n\t\tend while;\n\t\tset htmlChar=substring(s,charIndex,charEnd-charIndex);\n\t\tset charCode=cast(htmlChar as signed);\n\t\tset retValue=concat(retValue,char(charCode using ucs2));\n\t\tset charIndex=charEnd+1;\n\t\tend;\n\telse\n\t\tbegin\n\t\tset retValue=concat(retValue,substring(s,charIndex,1));\n\t\tset charIndex=charIndex+1;\n\t\tend;\n\tend if;\t\nend while;\nreturn retValue;\nend;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8],"tags":[],"class_list":["post-5004","post","type-post","status-publish","format-standard","hentry","category-delphi"],"views":2841,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5004"}],"version-history":[{"count":2,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5004\/revisions"}],"predecessor-version":[{"id":5006,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5004\/revisions\/5006"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}