{"id":2043,"date":"2020-11-18T16:12:28","date_gmt":"2020-11-18T08:12:28","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=2043"},"modified":"2020-11-18T16:14:04","modified_gmt":"2020-11-18T08:14:04","slug":"gbase-8a%e5%9c%a8%e6%89%a7%e8%a1%8c%e5%8a%a8%e6%80%81sql%e6%97%b6%e6%8a%a5%e9%94%99-prepared-statement-needs-to-be-re-prepared","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/2043","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u5728\u6267\u884c\u52a8\u6001SQL Prepare EXECUTE\u65f6\u62a5\u9519 Prepared statement needs to be re-prepared"},"content":{"rendered":"<p>GBase \u5728\u6267\u884c\u5b58\u50a8\u8fc7\u7a0b\u91cc\uff0c\u53ef\u4ee5\u6267\u884c\u52a8\u6001\u547d\u4ee4\uff0c\u5f53Prepare\u65f6\uff0c\u5fc5\u987b\u8981\u7f13\u51b2\u6d89\u53ca\u7684\u6240\u6709\u7684\u8868\u7684frm\u7ed3\u6784\uff0c\u5982\u679c\u8d85\u8fc7\u4e86\u8bbe\u5b9a\u7684\u53c2\u6570table_definition_cache\uff0c\u5219\u4f1a\u62a5\u8fd9\u4e2a\u9519\u8bef\u3002\u89e3\u51b3\u65b9\u6848\u662f\u63d0\u9ad8\u53c2\u6570\u503c\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2b165145bfb\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2b165145bfb\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/2043\/#%E6%8A%A5%E9%94%99%E6%A0%B7%E4%BE%8B\" >\u62a5\u9519\u6837\u4f8b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/2043\/#%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\" >Solution<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/2043\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%8A%A5%E9%94%99%E6%A0%B7%E4%BE%8B\"><\/span>\u62a5\u9519\u6837\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5176\u4e2dexecuteSQL\u662f\u4e00\u4e2a\u81ea\u5df1\u5199\u7684\u901a\u7528\u7684\u6267\u884c\u5b57\u7b26\u4e32\u7684\u5b58\u50a8\u8fc7\u7a0b\uff0c\u8be6\u60c5\u8bf7\u53c2\u8003<\/p>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/en\/226\/\">GBase 8a\u96c6\u7fa4\u5b58\u50a8\u8fc7\u7a0b\u6837\u4f8b\uff0c\u52a8\u6001\u5b58\u50a8\u8fc7\u7a0b<\/a><\/p>\n\n\n\n<p>\u6837\u4f8b\u4e2d\u53c2\u6570\u503c\u4e3a256\uff0c \u800c\u8868\u6570\u91cf\u662f300\u4e2a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> show status like '%table_def%';\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| Open_table_definitions   | 256   |\n| Opened_table_definitions | 1     |\n+--------------------------+-------+\n2 rows in set (Elapsed: 00:00:00.01)\n\n\ngbase> source \/home\/gbase\/ttt.sql\nERROR 1615 (HY000): Prepared statement needs to be re-prepared\n{STATEMENT: call executeSQL('select count(*) from ttt1 union all\nselect count(*) from ttt2 union all\nselect count(*) from ttt3 union all\nselect count(*) from ttt4 union all\nselect count(*) from ttt5 union all\nselect count(*) from ttt6 union all\nselect count(*) from ttt7 union all\nselect count(*) from ttt8 union all\nselect count(*) from ttt9 union all\nselect count(*) from ttt10 union all\nselect count(*) from ttt11 union all\nselect count(*) from ttt12 union all\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\"><\/span>Solution<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u8c03\u9ad8\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> set global table_definition_cache=402;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n\ngbase> source \/home\/gbase\/ttt.sql\n+----------+\n| count(*) |\n+----------+\n|        0 |\n|        0 |\n|        0 |\n|        0 |\n|        0 |\n|        0 |\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/en\/1983\/\">GBase 8a\u8868\u6253\u5f00\u7f13\u51b2\u53c2\u6570table_open_cache\u548c\u8868\u5b9a\u4e49\u7f13\u51b2\u53c2\u6570table_definition_cache<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase \u5728\u6267\u884c\u5b58\u50a8\u8fc7\u7a0b\u91cc\uff0c\u53ef\u4ee5\u6267\u884c\u52a8\u6001\u547d\u4ee4\uff0c\u5f53Prepare\u65f6\uff0c\u5fc5\u987b\u8981\u7f13\u51b2\u6d89\u53ca\u7684\u6240\u6709\u7684\u8868\u7684frm\u7ed3\u6784\uff0c\u5982\u679c\u8d85\u8fc7\u4e86\u8bbe\u5b9a\u7684\u53c2\u6570table_definition_cache\uff0c\u5219\u4f1a\u62a5\u8fd9\u4e2a\u9519\u8bef\u3002\u89e3\u51b3\u65b9\u6848\u662f\u63d0\u9ad8\u53c2\u6570\u503c\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-2043","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=2043"}],"version-history":[{"count":3,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2043\/revisions"}],"predecessor-version":[{"id":2046,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2043\/revisions\/2046"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=2043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=2043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=2043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}