Page Not Found | Quickstart
-
+
diff --git a/assets/js/11e11f3b.958ffa2a.js b/assets/js/11e11f3b.958ffa2a.js
deleted file mode 100644
index b834fcc610..0000000000
--- a/assets/js/11e11f3b.958ffa2a.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8625],{3463:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>d,default:()=>g,frontMatter:()=>a,metadata:()=>u,toc:()=>m});var r=s(5893),t=s(1151),o=s(4866),c=s(5162),l=s(6393),i=s(4379);const a={sidebar_position:1,tags:["createConnection","URI","SHA1","RDS","SSL","Socks"]},d="createConnection",u={id:"examples/connections/create-connection",title:"createConnection",description:"For queries please see the Simple Queries and Prepared Statements examples.",source:"@site/docs/examples/connections/create-connection.mdx",sourceDirName:"examples/connections",slug:"/examples/connections/create-connection",permalink:"/node-mysql2/docs/examples/connections/create-connection",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/connections/create-connection.mdx",tags:[{label:"createConnection",permalink:"/node-mysql2/docs/tags/create-connection"},{label:"URI",permalink:"/node-mysql2/docs/tags/uri"},{label:"SHA1",permalink:"/node-mysql2/docs/tags/sha-1"},{label:"RDS",permalink:"/node-mysql2/docs/tags/rds"},{label:"SSL",permalink:"/node-mysql2/docs/tags/ssl"},{label:"Socks",permalink:"/node-mysql2/docs/tags/socks"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,tags:["createConnection","URI","SHA1","RDS","SSL","Socks"]},sidebar:"examples",previous:{title:"Introduction",permalink:"/node-mysql2/docs/examples"},next:{title:"createPool",permalink:"/node-mysql2/docs/examples/connections/create-pool"}},h={},m=[{value:"createConnection(connectionUri)",id:"createconnectionconnectionuri",level:2},{value:"createConnection(config)",id:"createconnectionconfig",level:2},{value:"createConnection(config) \u2014 SHA1",id:"createconnectionconfig--sha1",level:2},{value:"createConnection(config) \u2014 SSL",id:"createconnectionconfig--ssl",level:2},{value:"createConnection(config) \u2014 RDS SSL",id:"createconnectionconfig--rds-ssl",level:2},{value:"Related Links",id:"related-links",level:3},{value:"createConnection(config) \u2014 Socks",id:"createconnectionconfig--socks",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ConnectionOptions",id:"connectionoptions",level:3}];function p(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"createconnection",children:"createConnection"}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["For queries please see the ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,r.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,r.jsx)(n.strong,{children:"Prepared Statements"})})," examples."]})}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconnectionuri",children:"createConnection(connectionUri)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"createConnection(connectionUri: string)"})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection(\n 'mysql://root:password@localhost:3306/test'\n );\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection(\n 'mysql://root:password@localhost:3306/test'\n);\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig",children:"createConnection(config)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--sha1",children:"createConnection(config) \u2014 SHA1"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n // ...\n passwordSha1: Buffer.from(\n '8bb6118f8fd6935ad0876a3be34a717d32708ffd',\n 'hex'\n ),\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n // ...\n passwordSha1: Buffer.from('8bb6118f8fd6935ad0876a3be34a717d32708ffd', 'hex'),\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--ssl",children:"createConnection(config) \u2014 SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})}),(0,r.jsxs)(c.Z,{value:"certs/ca-cert.pem",children:[(0,r.jsx)(i.I,{language:"plan",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/test/fixtures/ssl/certs/ca.pem"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["See ",(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/test/fixtures/ssl/certs",children:"ssl/certs"}),"."]}),"\n"]})]})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--rds-ssl",children:"createConnection(config) \u2014 RDS SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["You can use ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," string as value to ssl property to connect to ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," MySQL over SSL."]}),"\n",(0,r.jsxs)(n.p,{children:["In that case ",(0,r.jsx)(n.a,{href:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem",children:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem"})," CA cert is used:"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsxs)(c.Z,{value:"promise.js",default:!0,children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const [res] = await connection.query('SHOW `status` LIKE \"Ssl_cipher\"');\n await connection.end();\n\n console.log(res);\n} catch (err) {\n console.log(err);\n}\n"})})})]}),(0,r.jsxs)(c.Z,{value:"callback.js",children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"connectionquery('SHOW `status` LIKE \"Ssl_cipher\"', function (err, res) {\n connection.end();\n\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(res);\n});\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"related-links",children:"Related Links"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Issues"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues/2130",children:"#2130 \u2014 Update TLS certs for Amazon RDS instances"})}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Pull Requests"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2119",children:"#2119 \u2014 fix: make startTls code compatible with Bun"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2131",children:"#2131 \u2014 Update Amazon RDS SSL CA cert"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--socks",children:"createConnection(config) \u2014 Socks"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"A.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\nconst socksProxy = new SocksConnection({ port: 3306 });\n// highlight-start\nconst connection = mysql.createConnection({\n stream: socksProxy,\n});\n// highlight-end\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})}),(0,r.jsx)(c.Z,{value:"B.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\n// highlight-start\nconst connection = mysql.createConnection({\n debug: 1,\n stream: function () {\n return new SocksConnection({ port: 3306 });\n },\n});\n// highlight-end\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"connection.execute('SELECT SLEEP(1.1) AS `www`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\nconnection.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\nconnection.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n"})})}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,r.jsx)(n.h3,{id:"connectionoptions",children:"ConnectionOptions"}),"\n",(0,r.jsx)(l.Z,{title:"ConnectionOptions Specification",children:(0,r.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Connection.d.ts",extractMethod:"ConnectionOptions",methodType:"interface"})})]})}function g(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>c});s(7294);var r=s(512);const t={tabItem:"tabItem_Ymn6"};var o=s(5893);function c(e){let{children:n,hidden:s,className:c}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.Z)(t.tabItem,c),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>S});var r=s(7294),t=s(512),o=s(2466),c=s(6550),l=s(469),i=s(1980),a=s(7392),d=s(12);function u(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:s,attributes:r,default:t}}=e;return{value:n,label:s,attributes:r,default:t}}))}(s);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function m(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function p(e){let{queryString:n=!1,groupId:s}=e;const t=(0,c.k6)(),o=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(o),(0,r.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(t.location.search);n.set(o,e),t.replace({...t.location,search:n.toString()})}),[o,t])]}function g(e){const{defaultValue:n,queryString:s=!1,groupId:t}=e,o=h(e),[c,i]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=s.find((e=>e.default))??s[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[a,u]=p({queryString:s,groupId:t}),[g,x]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[t,o]=(0,d.Nk)(s);return[t,(0,r.useCallback)((e=>{s&&o.set(e)}),[s,o])]}({groupId:t}),j=(()=>{const e=a??g;return m({value:e,tabValues:o})?e:null})();(0,l.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:c,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),x(e)}),[u,x,o]),tabValues:o}}var x=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function y(e){let{className:n,block:s,selectedValue:r,selectValue:c,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:a}=(0,o.o5)(),d=e=>{const n=e.currentTarget,s=i.indexOf(n),t=l[s].value;t!==r&&(a(n),c(t))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.Z)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:o}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>i.push(e),onKeyDown:u,onClick:d,...o,className:(0,t.Z)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":r===n}),children:s??n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:t}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===t));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==t})))})}function q(e){const n=g(e);return(0,f.jsxs)("div",{className:(0,t.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(y,{...e,...n}),(0,f.jsx)(b,{...e,...n})]})}function S(e){const n=(0,x.Z)();return(0,f.jsx)(q,{...e,children:u(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>i});var r=s(7294),t=s(2263),o=s(9286),c=s(5893);const l=()=>(0,c.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:s,extractMethod:i,methodType:a}=e;const[d,u]=(0,r.useState)(""),[h,m]=(0,r.useState)(!0),[p,g]=(0,r.useState)(!0),{siteConfig:x}=(0,t.Z)(),j=x.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,r.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&a?((e,n,s)=>{const r=e.split("\n"),t=`${s} ${n}`;let o=!1,c=0,l="";for(const i of r)if(i.includes(t)&&(o=!0),o&&(i.includes("{")&&c++,l+=i+"\n",i.includes("}")&&(c--,0===c)))break;return l.trim()||e})(e,i,a):e;u(n||e),m(!1),g(!1)})).catch((()=>{g(!0),m(!1)})),()=>{e.abort()}}),[f,i,a]),(0,c.jsx)(c.Fragment,{children:h?(0,c.jsx)(l,{}):(0,c.jsx)(c.Fragment,{children:p?(0,c.jsxs)("div",{children:["Unable to access the requested link: ",(0,c.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,c.jsx)(o.Z,{className:`language-${s}`,children:d})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>o});var r=s(4673),t=s(5893);const o=e=>{let{children:n,open:s,title:o}=e;return(0,t.jsx)(r.Z,{open:s,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:o})}),children:(0,t.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/11e11f3b.bcef533c.js b/assets/js/11e11f3b.bcef533c.js
new file mode 100644
index 0000000000..f6e211883e
--- /dev/null
+++ b/assets/js/11e11f3b.bcef533c.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8625],{3463:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>d,default:()=>g,frontMatter:()=>a,metadata:()=>u,toc:()=>m});var r=s(5893),t=s(1151),o=s(4866),c=s(5162),l=s(6393),i=s(4379);const a={sidebar_position:1,tags:["createConnection","URI","SHA1","RDS","SSL","Socks"]},d="createConnection",u={id:"examples/connections/create-connection",title:"createConnection",description:"For queries please see the Simple Queries and Prepared Statements examples.",source:"@site/docs/examples/connections/create-connection.mdx",sourceDirName:"examples/connections",slug:"/examples/connections/create-connection",permalink:"/node-mysql2/docs/examples/connections/create-connection",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/connections/create-connection.mdx",tags:[{label:"createConnection",permalink:"/node-mysql2/docs/tags/create-connection"},{label:"URI",permalink:"/node-mysql2/docs/tags/uri"},{label:"SHA1",permalink:"/node-mysql2/docs/tags/sha-1"},{label:"RDS",permalink:"/node-mysql2/docs/tags/rds"},{label:"SSL",permalink:"/node-mysql2/docs/tags/ssl"},{label:"Socks",permalink:"/node-mysql2/docs/tags/socks"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,tags:["createConnection","URI","SHA1","RDS","SSL","Socks"]},sidebar:"examples",previous:{title:"Introduction",permalink:"/node-mysql2/docs/examples"},next:{title:"createPool",permalink:"/node-mysql2/docs/examples/connections/create-pool"}},h={},m=[{value:"createConnection(connectionUri)",id:"createconnectionconnectionuri",level:2},{value:"createConnection(config)",id:"createconnectionconfig",level:2},{value:"createConnection(config) \u2014 SHA1",id:"createconnectionconfig--sha1",level:2},{value:"createConnection(config) \u2014 SSL",id:"createconnectionconfig--ssl",level:2},{value:"createConnection(config) \u2014 RDS SSL",id:"createconnectionconfig--rds-ssl",level:2},{value:"Related Links",id:"related-links",level:3},{value:"createConnection(config) \u2014 Socks",id:"createconnectionconfig--socks",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ConnectionOptions",id:"connectionoptions",level:3}];function p(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"createconnection",children:"createConnection"}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["For queries please see the ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,r.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,r.jsx)(n.strong,{children:"Prepared Statements"})})," examples."]})}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconnectionuri",children:"createConnection(connectionUri)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"createConnection(connectionUri: string)"})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection(\n 'mysql://root:password@localhost:3306/test'\n );\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection(\n 'mysql://root:password@localhost:3306/test'\n);\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig",children:"createConnection(config)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--sha1",children:"createConnection(config) \u2014 SHA1"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n // ...\n passwordSha1: Buffer.from(\n '8bb6118f8fd6935ad0876a3be34a717d32708ffd',\n 'hex'\n ),\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n // ...\n passwordSha1: Buffer.from('8bb6118f8fd6935ad0876a3be34a717d32708ffd', 'hex'),\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--ssl",children:"createConnection(config) \u2014 SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(c.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})}),(0,r.jsxs)(c.Z,{value:"certs/ca-cert.pem",children:[(0,r.jsx)(i.I,{language:"plan",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/test/fixtures/ssl/certs/ca.pem"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["See ",(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/test/fixtures/ssl/certs",children:"ssl/certs"}),"."]}),"\n"]})]})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--rds-ssl",children:"createConnection(config) \u2014 RDS SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["You can use ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," string as value to ssl property to connect to ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," MySQL over SSL."]}),"\n",(0,r.jsxs)(n.p,{children:["In that case ",(0,r.jsx)(n.a,{href:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem",children:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem"})," CA cert is used:"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsxs)(c.Z,{value:"promise.js",default:!0,children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const connection = await mysql.createConnection({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n });\n // highlight-end\n} catch (err) {\n console.log(err);\n}\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const [res] = await connection.query('SHOW `status` LIKE \"Ssl_cipher\"');\n await connection.end();\n\n console.log(res);\n} catch (err) {\n console.log(err);\n}\n"})})})]}),(0,r.jsxs)(c.Z,{value:"callback.js",children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst connection = mysql.createConnection({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n});\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"connectionquery('SHOW `status` LIKE \"Ssl_cipher\"', function (err, res) {\n connection.end();\n\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(res);\n});\n"})})})]})]}),"\n",(0,r.jsx)(n.h3,{id:"related-links",children:"Related Links"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Issues"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues/2130",children:"#2130 \u2014 Update TLS certs for Amazon RDS instances"})}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Pull Requests"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2119",children:"#2119 \u2014 fix: make startTls code compatible with Bun"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2131",children:"#2131 \u2014 Update Amazon RDS SSL CA cert"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"createconnectionconfig--socks",children:"createConnection(config) \u2014 Socks"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["createConnection(config: ",(0,r.jsx)(n.a,{href:"#connectionoptions",children:"ConnectionOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(c.Z,{value:"A.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\nconst socksProxy = new SocksConnection({ port: 3306 });\n// highlight-start\nconst connection = mysql.createConnection({\n stream: socksProxy,\n});\n// highlight-end\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})}),(0,r.jsx)(c.Z,{value:"B.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\n// highlight-start\nconst connection = mysql.createConnection({\n debug: 1,\n stream: function () {\n return new SocksConnection({ port: 3306 });\n },\n});\n// highlight-end\n\nconnection.addListener('error', (err) => {\n console.log(err);\n});\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"connection.execute('SELECT SLEEP(1.1) AS `www`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\nconnection.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\nconnection.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n"})})}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,r.jsx)(n.h3,{id:"connectionoptions",children:"ConnectionOptions"}),"\n",(0,r.jsx)(l.Z,{title:"ConnectionOptions Specification",children:(0,r.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Connection.d.ts",extractMethod:"ConnectionOptions",methodType:"interface"})})]})}function g(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>c});s(7294);var r=s(512);const t={tabItem:"tabItem_Ymn6"};var o=s(5893);function c(e){let{children:n,hidden:s,className:c}=e;return(0,o.jsx)("div",{role:"tabpanel",className:(0,r.Z)(t.tabItem,c),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>S});var r=s(7294),t=s(512),o=s(2466),c=s(6550),l=s(469),i=s(1980),a=s(7392),d=s(12);function u(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:s,attributes:r,default:t}}=e;return{value:n,label:s,attributes:r,default:t}}))}(s);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function m(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function p(e){let{queryString:n=!1,groupId:s}=e;const t=(0,c.k6)(),o=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(o),(0,r.useCallback)((e=>{if(!o)return;const n=new URLSearchParams(t.location.search);n.set(o,e),t.replace({...t.location,search:n.toString()})}),[o,t])]}function g(e){const{defaultValue:n,queryString:s=!1,groupId:t}=e,o=h(e),[c,i]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=s.find((e=>e.default))??s[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:o}))),[a,u]=p({queryString:s,groupId:t}),[g,x]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[t,o]=(0,d.Nk)(s);return[t,(0,r.useCallback)((e=>{s&&o.set(e)}),[s,o])]}({groupId:t}),j=(()=>{const e=a??g;return m({value:e,tabValues:o})?e:null})();(0,l.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:c,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),x(e)}),[u,x,o]),tabValues:o}}var x=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function y(e){let{className:n,block:s,selectedValue:r,selectValue:c,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:a}=(0,o.o5)(),d=e=>{const n=e.currentTarget,s=i.indexOf(n),t=l[s].value;t!==r&&(a(n),c(t))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.Z)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:o}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>i.push(e),onKeyDown:u,onClick:d,...o,className:(0,t.Z)("tabs__item",j.tabItem,o?.className,{"tabs__item--active":r===n}),children:s??n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:t}=e;const o=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=o.find((e=>e.props.value===t));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:o.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==t})))})}function q(e){const n=g(e);return(0,f.jsxs)("div",{className:(0,t.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(y,{...e,...n}),(0,f.jsx)(b,{...e,...n})]})}function S(e){const n=(0,x.Z)();return(0,f.jsx)(q,{...e,children:u(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>i});var r=s(7294),t=s(2263),o=s(9286),c=s(5893);const l=()=>(0,c.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:s,extractMethod:i,methodType:a}=e;const[d,u]=(0,r.useState)(""),[h,m]=(0,r.useState)(!0),[p,g]=(0,r.useState)(!0),{siteConfig:x}=(0,t.Z)(),j=x.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,r.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&a?((e,n,s)=>{const r=e.split("\n"),t=`${s} ${n}`;let o=!1,c=0,l="";for(const i of r)if(i.includes(t)&&(o=!0),o&&(i.includes("{")&&c++,l+=i+"\n",i.includes("}")&&(c--,0===c)))break;return l.trim()||e})(e,i,a):e;u(n||e),m(!1),g(!1)})).catch((()=>{g(!0),m(!1)})),()=>{e.abort()}}),[f,i,a]),(0,c.jsx)(c.Fragment,{children:h?(0,c.jsx)(l,{}):(0,c.jsx)(c.Fragment,{children:p?(0,c.jsxs)("div",{children:["Unable to access the requested link: ",(0,c.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,c.jsx)(o.Z,{className:`language-${s}`,children:d})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>o});var r=s(4673),t=s(5893);const o=e=>{let{children:n,open:s,title:o}=e;return(0,t.jsx)(r.Z,{open:s,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:o})}),children:(0,t.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/1568425c.6348d27b.js b/assets/js/1568425c.6348d27b.js
deleted file mode 100644
index d85cd86da6..0000000000
--- a/assets/js/1568425c.6348d27b.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9458],{904:(e,s,i)=>{i.r(s),i.d(s,{assets:()=>c,contentTitle:()=>l,default:()=>p,frontMatter:()=>n,metadata:()=>a,toc:()=>o});var r=i(5893),t=i(1151);const n={},l="Simple Queries",a={id:"examples/queries/simple-queries/index",title:"Simple Queries",description:"For Prepared Statements or Placeholders / Parameters examples, please see here.",source:"@site/docs/examples/queries/simple-queries/index.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/",permalink:"/node-mysql2/docs/examples/queries/simple-queries/",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/index.mdx",tags:[],version:"current",frontMatter:{},sidebar:"examples",previous:{title:"createPoolCluster",permalink:"/node-mysql2/docs/examples/connections/createPoolCluster"},next:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/simple-queries/insert"}},c={},o=[];function d(e){const s={a:"a",admonition:"admonition",h1:"h1",hr:"hr",input:"input",li:"li",p:"p",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.h1,{id:"simple-queries",children:"Simple Queries"}),"\n",(0,r.jsx)(s.admonition,{type:"info",children:(0,r.jsxs)(s.p,{children:["For ",(0,r.jsx)(s.strong,{children:"Prepared Statements"})," or ",(0,r.jsx)(s.strong,{children:"Placeholders"})," / ",(0,r.jsx)(s.strong,{children:"Parameters"})," examples, please see ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements",children:"here"}),"."]})}),"\n",(0,r.jsx)(s.hr,{}),"\n",(0,r.jsx)(s.p,{children:"Usage examples:"}),"\n",(0,r.jsxs)(s.ul,{className:"contains-task-list",children:["\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/insert",children:(0,r.jsx)(s.strong,{children:"INSERT"})})]}),"\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/select",children:(0,r.jsx)(s.strong,{children:"SELECT"})})]}),"\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/update",children:(0,r.jsx)(s.strong,{children:"UPDATE"})})]}),"\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/delete",children:(0,r.jsx)(s.strong,{children:"DELETE"})})]}),"\n"]})]})}function p(e={}){const{wrapper:s}={...(0,t.a)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},1151:(e,s,i)=>{i.d(s,{Z:()=>a,a:()=>l});var r=i(7294);const t={},n=r.createContext(t);function l(e){const s=r.useContext(n);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:l(e.components),r.createElement(n.Provider,{value:s},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/1568425c.9968efa5.js b/assets/js/1568425c.9968efa5.js
new file mode 100644
index 0000000000..b1918a85c8
--- /dev/null
+++ b/assets/js/1568425c.9968efa5.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9458],{904:(e,s,i)=>{i.r(s),i.d(s,{assets:()=>c,contentTitle:()=>l,default:()=>p,frontMatter:()=>n,metadata:()=>a,toc:()=>o});var r=i(5893),t=i(1151);const n={},l="Simple Queries",a={id:"examples/queries/simple-queries/index",title:"Simple Queries",description:"For Prepared Statements or Placeholders / Parameters examples, please see here.",source:"@site/docs/examples/queries/simple-queries/index.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/",permalink:"/node-mysql2/docs/examples/queries/simple-queries/",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/index.mdx",tags:[],version:"current",frontMatter:{},sidebar:"examples",previous:{title:"createPoolCluster",permalink:"/node-mysql2/docs/examples/connections/createPoolCluster"},next:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/simple-queries/insert"}},c={},o=[];function d(e){const s={a:"a",admonition:"admonition",h1:"h1",input:"input",li:"li",p:"p",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.h1,{id:"simple-queries",children:"Simple Queries"}),"\n",(0,r.jsx)(s.admonition,{type:"info",children:(0,r.jsxs)(s.p,{children:["For ",(0,r.jsx)(s.strong,{children:"Prepared Statements"})," or ",(0,r.jsx)(s.strong,{children:"Placeholders"})," / ",(0,r.jsx)(s.strong,{children:"Parameters"})," examples, please see ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements",children:"here"}),"."]})}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(s.p,{children:"Usage examples:"}),"\n",(0,r.jsxs)(s.ul,{className:"contains-task-list",children:["\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/insert",children:(0,r.jsx)(s.strong,{children:"INSERT"})})]}),"\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/select",children:(0,r.jsx)(s.strong,{children:"SELECT"})})]}),"\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/update",children:(0,r.jsx)(s.strong,{children:"UPDATE"})})]}),"\n",(0,r.jsxs)(s.li,{className:"task-list-item",children:[(0,r.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,r.jsx)(s.a,{href:"/docs/examples/queries/simple-queries/delete",children:(0,r.jsx)(s.strong,{children:"DELETE"})})]}),"\n"]})]})}function p(e={}){const{wrapper:s}={...(0,t.a)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},1151:(e,s,i)=>{i.d(s,{Z:()=>a,a:()=>l});var r=i(7294);const t={},n=r.createContext(t);function l(e){const s=r.useContext(n);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:l(e.components),r.createElement(n.Provider,{value:s},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/1df93b7f.7c544ac9.js b/assets/js/1df93b7f.7c544ac9.js
new file mode 100644
index 0000000000..33182a81c7
--- /dev/null
+++ b/assets/js/1df93b7f.7c544ac9.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3237],{9754:(e,s,n)=>{n.r(s),n.d(s,{default:()=>i});var t=n(6550),c=n(2263),u=n(5893);const i=function(){const{i18n:e,siteConfig:s}=(0,c.Z)(),{baseUrl:n}=s,i=e.currentLocale,o="en"===i||n.includes(i)?`${n}docs`:`${n}${i}/docs`;return(0,u.jsx)(t.l_,{to:o})}}}]);
\ No newline at end of file
diff --git a/assets/js/1df93b7f.8f7e93f0.js b/assets/js/1df93b7f.8f7e93f0.js
deleted file mode 100644
index 6dfb81a400..0000000000
--- a/assets/js/1df93b7f.8f7e93f0.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3237],{9754:(e,s,t)=>{t.r(s),t.d(s,{default:()=>r});var n=t(6550),c=t(2263),o=t(5893);const r=function(){const{i18n:e,siteConfig:s}=(0,c.Z)(),{baseUrl:t}=s,r=e.currentLocale,u="en"===r?`${t}docs`:`${t}${r}/docs`;return(0,o.jsx)(n.l_,{to:u})}}}]);
\ No newline at end of file
diff --git a/assets/js/2bc14e22.4e0be83f.js b/assets/js/2bc14e22.4e0be83f.js
new file mode 100644
index 0000000000..fc2c3ac353
--- /dev/null
+++ b/assets/js/2bc14e22.4e0be83f.js
@@ -0,0 +1,2 @@
+/*! For license information please see 2bc14e22.4e0be83f.js.LICENSE.txt */
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2839],{4760:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>x,frontMatter:()=>a,metadata:()=>i,toc:()=>h});var t=s(5893),r=s(1151),l=s(8609),c=s(3901);const a={},o="Using MySQL2 with TypeScript",i={id:"documentation/typescript-examples",title:"Using MySQL2 with TypeScript",description:"Installation",source:"@site/docs/documentation/typescript-examples.mdx",sourceDirName:"documentation",slug:"/documentation/typescript-examples",permalink:"/node-mysql2/docs/documentation/typescript-examples",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/documentation/typescript-examples.mdx",tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"Promise Wrappers",permalink:"/node-mysql2/docs/documentation/promise-wrapper"},next:{title:"API and Configuration",permalink:"/node-mysql2/docs/api-and-configurations"}},d={},h=[{value:"Installation",id:"installation",level:2},{value:"Usage",id:"usage",level:2},{value:"Connection",id:"connection",level:3},{value:"Pool Connection",id:"pool-connection",level:3},{value:"Query and Execute",id:"query-and-execute",level:3},{value:"A simple query",id:"a-simple-query",level:4},{value:"Type Specification",id:"type-specification",level:2},{value:"RowDataPacket[]",id:"rowdatapacket",level:3},{value:"RowDataPacket[][]",id:"rowdatapacket-1",level:3},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"ResultSetHeader[]",id:"resultsetheader-1",level:3},{value:"ProcedureCallPacket",id:"procedurecallpacket",level:3},{value:"OkPacket",id:"okpacket",level:3},{value:"Examples",id:"examples",level:2}];function u(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",br:"br",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"using-mysql2-with-typescript",children:"Using MySQL2 with TypeScript"}),"\n",(0,t.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm install --save mysql2\nnpm install --save-dev @types/node\n"})}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"@types/node"})," ensure the proper interaction between ",(0,t.jsx)(n.strong,{children:"TypeScript"})," and the ",(0,t.jsx)(n.strong,{children:"Node.js"})," modules used by ",(0,t.jsx)(n.strong,{children:"MySQL2"})," (",(0,t.jsx)(n.em,{children:"net"}),", ",(0,t.jsx)(n.em,{children:"events"}),", ",(0,t.jsx)(n.em,{children:"stream"}),", ",(0,t.jsx)(n.em,{children:"tls"}),", etc.)."]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["Requires ",(0,t.jsx)(n.strong,{children:"TypeScript"})," ",(0,t.jsx)(n.code,{children:">=4.5.2"}),"."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,t.jsxs)(n.p,{children:["You can import ",(0,t.jsx)(n.strong,{children:"MySQL2"})," in two ways:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["By setting the ",(0,t.jsx)(n.code,{children:"esModuleInterop"})," option to ",(0,t.jsx)(n.code,{children:"true"})," in ",(0,t.jsx)(n.code,{children:"tsconfig.json"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql from 'mysql2';\nimport mysql from 'mysql2/promise';\n"})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["By setting the ",(0,t.jsx)(n.code,{children:"esModuleInterop"})," option to ",(0,t.jsx)(n.code,{children:"false"})," in ",(0,t.jsx)(n.code,{children:"tsconfig.json"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import * as mysql from 'mysql2';\nimport * as mysql from 'mysql2/promise';\n"})}),"\n",(0,t.jsx)(n.h3,{id:"connection",children:"Connection"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ConnectionOptions } from 'mysql2';\n\nconst access: ConnectionOptions = {\n user: 'test',\n database: 'test',\n};\n\nconst conn = mysql.createConnection(access);\n"})}),"\n",(0,t.jsx)(n.h3,{id:"pool-connection",children:"Pool Connection"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { PoolOptions } from 'mysql2';\n\nconst access: PoolOptions = {\n user: 'test',\n database: 'test',\n};\n\nconst conn = mysql.createPool(access);\n"})}),"\n",(0,t.jsx)(n.h3,{id:"query-and-execute",children:"Query and Execute"}),"\n",(0,t.jsx)(n.h4,{id:"a-simple-query",children:"A simple query"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"conn.query('SELECT 1 + 1 AS `test`;', (_err, rows) => {\n /**\n * @rows: [ { test: 2 } ]\n */\n});\n\nconn.execute('SELECT 1 + 1 AS `test`;', (_err, rows) => {\n /**\n * @rows: [ { test: 2 } ]\n */\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"rows"})," output will be these possible types:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"RowDataPacket[]"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"RowDataPacket[][]"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"ResultSetHeader"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"ResultSetHeader[]"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"In this example, you need to manually check the output types"}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"type-specification",children:"Type Specification"}),"\n",(0,t.jsx)(n.h3,{id:"rowdatapacket",children:"RowDataPacket[]"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(n.p,{children:"An array with the returned rows, for example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { RowDataPacket } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n});\n\n// SELECT\nconn.query('SELECT 1 + 1 AS `test`;', (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ { test: 2 } ]\n */\n});\n\n// SHOW\nconn.query('SHOW TABLES FROM `test`;', (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ { Tables_in_test: 'test' } ]\n */\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Using ",(0,t.jsx)(n.code,{children:"rowsAsArray"})," option as ",(0,t.jsx)(n.code,{children:"true"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { RowDataPacket } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n rowsAsArray: true,\n});\n\n// SELECT\nconn.query(\n 'SELECT 1 + 1 AS test, 2 + 2 AS test;',\n (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ [ 2, 4 ] ]\n */\n }\n);\n\n// SHOW\nconn.query('SHOW TABLES FROM `test`;', (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ [ 'test' ] ]\n */\n});\n"})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"rowdatapacket-1",children:"RowDataPacket[][]"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsxs)(n.p,{children:["Using ",(0,t.jsx)(n.code,{children:"multipleStatements"})," option as ",(0,t.jsx)(n.code,{children:"true"})," with multiple queries:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { RowDataPacket } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n multipleStatements: true,\n});\n\nconst sql = `\n SELECT 1 + 1 AS test;\n SELECT 2 + 2 AS test;\n`;\n\nconn.query(sql, (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ [ { test: 2 } ], [ { test: 4 } ] ]\n */\n});\n"})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(l.A,{records:[{version:"3.5.1",changes:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.strong,{children:"OkPacket"})," is deprecated and might be removed in the future major release.",(0,t.jsx)(n.br,{}),"Please use ",(0,t.jsx)(n.strong,{children:"ResultSetHeader"})," instead."]}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.strong,{children:"changedRows"})," option is deprecated and might be removed in the future major release.",(0,t.jsx)(n.br,{}),"Please use ",(0,t.jsx)(n.strong,{children:"affectedRows"})," instead."]})]}]}),"\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.code,{children:"INSERT"}),", ",(0,t.jsx)(n.code,{children:"UPDATE"}),", ",(0,t.jsx)(n.code,{children:"DELETE"}),", ",(0,t.jsx)(n.code,{children:"TRUNCATE"}),", etc.:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ResultSetHeader } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n});\n\nconst sql = `\n SET @1 = 1;\n`;\n\nconn.query(sql, (_err, result) => {\n console.log(result);\n /**\n * @result: ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 2,\n warningStatus: 0,\n changedRows: 0\n }\n */\n});\n"})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader-1",children:"ResultSetHeader[]"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(l.A,{records:[{version:"3.5.1",changes:[(0,t.jsxs)(t.Fragment,{children:["Introduce ",(0,t.jsx)(n.strong,{children:"ResultSetHeader[]"})]})]}]}),"\n",(0,t.jsxs)(n.p,{children:["For multiples ",(0,t.jsx)(n.code,{children:"INSERT"}),", ",(0,t.jsx)(n.code,{children:"UPDATE"}),", ",(0,t.jsx)(n.code,{children:"DELETE"}),", ",(0,t.jsx)(n.code,{children:"TRUNCATE"}),", etc. when using ",(0,t.jsx)(n.code,{children:"multipleStatements"})," as ",(0,t.jsx)(n.code,{children:"true"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ResultSetHeader } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n multipleStatements: true,\n});\n\nconst sql = `\n SET @1 = 1;\n SET @2 = 2;\n`;\n\nconn.query(sql, (_err, results) => {\n console.log(results);\n /**\n * @results: [\n ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 10,\n warningStatus: 0,\n changedRows: 0\n },\n ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 2,\n warningStatus: 0,\n changedRows: 0\n }\n ]\n */\n});\n"})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"procedurecallpacket",children:"ProcedureCallPacket"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(l.A,{records:[{version:"3.5.1",changes:[(0,t.jsxs)(t.Fragment,{children:["Introduce ",(0,t.jsx)(n.strong,{children:"ProcedureCallPacket"})]})]}]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["By performing a ",(0,t.jsx)(n.strong,{children:"Call Procedure"})," using ",(0,t.jsx)(n.code,{children:"INSERT"}),", ",(0,t.jsx)(n.code,{children:"UPDATE"}),", etc., the return will be a ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})," (even if you perform multiples queries and set ",(0,t.jsx)(n.code,{children:"multipleStatements"})," to ",(0,t.jsx)(n.code,{children:"true"}),"):"]})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ProcedureCallPacket, ResultSetHeader } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n});\n\n/** ResultSetHeader */\nconn.query('DROP PROCEDURE IF EXISTS myProcedure');\n\n/** ResultSetHeader */\nconn.query(`\n CREATE PROCEDURE myProcedure()\n BEGIN\n SET @1 = 1;\n SET @2 = 2;\n END\n `);\n\n/** ProcedureCallPacket */\nconst sql = 'CALL myProcedure()';\n\nconn.query>(sql, (_err, result) => {\n console.log(result);\n /**\n * @result: ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 2,\n warningStatus: 0,\n changedRows: 0\n }\n */\n});\n"})}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.code,{children:"CREATE PROCEDURE"})," and ",(0,t.jsx)(n.code,{children:"DROP PROCEDURE"}),", these returns will be the ",(0,t.jsx)(n.em,{children:"default"})," ",(0,t.jsx)(n.code,{children:"ResultSetHeader"}),"."]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["By using ",(0,t.jsx)(n.code,{children:"SELECT"})," and ",(0,t.jsx)(n.code,{children:"SHOW"})," queries in a ",(0,t.jsx)(n.strong,{children:"Procedure Call"}),", it groups the results as:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"/** ProcedureCallPacket */\n[RowDataPacket[], ResultSetHeader]\n"})}),"\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"}),", please see the following examples."]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"okpacket",children:"OkPacket"}),"\n",(0,t.jsx)(c.X,{level:0,message:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.strong,{children:"OkPacket"})," is deprecated and might be removed in the future major release.",(0,t.jsx)(n.br,{}),"Please use ",(0,t.jsx)(n.strong,{children:"ResultSetHeader"})," instead."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,t.jsxs)(n.p,{children:["You can also check some code examples using ",(0,t.jsx)(n.strong,{children:"MySQL2"})," and ",(0,t.jsx)(n.strong,{children:"TypeScript"})," to understand advanced concepts:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/index",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/row-as-array",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," and ",(0,t.jsx)(n.code,{children:"rowAsArray"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/multi-statements",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," and ",(0,t.jsx)(n.code,{children:"multipleStatements"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/row-as-array-multi-statements",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"}),", ",(0,t.jsx)(n.code,{children:"rowAsArray"})," and ",(0,t.jsx)(n.code,{children:"multipleStatements"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/procedure-call/index",children:["Checking for ",(0,t.jsx)(n.code,{children:"ResultSetHeader"}),", extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," from ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/procedure-call/row-as-array",children:["Checking for ",(0,t.jsx)(n.code,{children:"ResultSetHeader"}),", extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," and ",(0,t.jsx)(n.code,{children:"rowAsArray"})," from ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/basic-custom-class",children:["Creating a basic custom ",(0,t.jsx)(n.strong,{children:"MySQL2"})," ",(0,t.jsx)(n.strong,{children:"Class"})]})}),"\n"]})]})}function x(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},4673:(e,n,s)=>{s.d(n,{Z:()=>p});var t=s(7294),r=s(512),l=s(2389),c=s(6043);const a={details:"details_lb9f",isBrowser:"isBrowser_bmU9",collapsibleContent:"collapsibleContent_i85q"};var o=s(5893);function i(e){return!!e&&("SUMMARY"===e.tagName||i(e.parentElement))}function d(e,n){return!!e&&(e===n||d(e.parentElement,n))}function h(e){let{summary:n,children:s,...h}=e;const u=(0,l.Z)(),x=(0,t.useRef)(null),{collapsed:p,setCollapsed:j}=(0,c.u)({initialState:!h.open}),[m,y]=(0,t.useState)(h.open),g=t.isValidElement(n)?n:(0,o.jsx)("summary",{children:n??"Details"});return(0,o.jsxs)("details",{...h,ref:x,open:m,"data-collapsed":p,className:(0,r.Z)(a.details,u&&a.isBrowser,h.className),onMouseDown:e=>{i(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const n=e.target;i(n)&&d(n,x.current)&&(e.preventDefault(),p?(j(!1),y(!0)):j(!0))},children:[g,(0,o.jsx)(c.z,{lazy:!1,collapsed:p,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{j(e),y(!e)},children:(0,o.jsx)("div",{className:a.collapsibleContent,children:s})})]})}const u={details:"details_b_Ee"},x="alert alert--info";function p(e){let{...n}=e;return(0,o.jsx)(h,{...n,className:(0,r.Z)(x,u.details,n.className)})}},8609:(e,n,s)=>{s.d(n,{A:()=>c});var t=s(4673);const r=(0,s(4297).Z)("FileClock",[["path",{d:"M16 22h2c.5 0 1-.2 1.4-.6.4-.4.6-.9.6-1.4V7.5L14.5 2H6c-.5 0-1 .2-1.4.6C4.2 3 4 3.5 4 4v3",key:"9lo3o3"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);var l=s(5893);const c=e=>{let{records:n,open:s}=e;return(0,l.jsx)(t.Z,{open:s,summary:(0,l.jsxs)("summary",{children:[(0,l.jsx)(r,{})," History"]}),className:"history",children:(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:"Version"}),(0,l.jsx)("th",{children:"Changes"})]})}),(0,l.jsx)("tbody",{children:n.map(((e,n)=>(0,l.jsxs)("tr",{children:[(0,l.jsx)("td",{children:(0,l.jsxs)("strong",{children:["v",e.version.replace(/[^0-9.]/g,"")]})}),(0,l.jsx)("td",{children:(0,l.jsx)("div",{className:"changes",children:e.changes.map(((e,n)=>(0,l.jsx)("section",{children:e},`change:${n}`)))})})]},`record:${n}`)))})]})})}},3901:(e,n,s)=>{s.d(n,{X:()=>u});var t=s(3692),r=s(4297);const l=(0,r.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),c=(0,r.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),a=(0,r.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),o=(0,r.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),i=(0,r.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),d=(0,r.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var h=s(5893);const u=e=>{let{level:n,message:s}=e;const r={0:{title:"Deprecated",icon:(0,h.jsx)(l,{})},1:{title:"Experimental",icon:(0,h.jsx)(c,{})},1.1:{title:"Early Development",icon:(0,h.jsx)(a,{})},1.2:{title:"Release Candidate",icon:(0,h.jsx)(o,{})},2:{title:"Stable",icon:(0,h.jsx)(i,{})},3:{title:"Legacy",icon:(0,h.jsx)(d,{})}};return(0,h.jsxs)("section",{className:"stability","data-level":n,children:[(0,h.jsx)(t.Z,{to:"/docs/stability-badges",children:(0,h.jsxs)("header",{children:[(0,h.jsx)("strong",{children:n}),(0,h.jsx)("span",{children:r[n].title}),r[n].icon]})}),s?(0,h.jsx)("p",{children:s}):null]})}},4297:(e,n,s)=>{s.d(n,{Z:()=>l});var t=s(7294),r={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const l=(e,n)=>{const s=(0,t.forwardRef)((({color:s="currentColor",size:l=24,strokeWidth:c=2,absoluteStrokeWidth:a,className:o="",children:i,...d},h)=>{return(0,t.createElement)("svg",{ref:h,...r,width:l,height:l,stroke:s,strokeWidth:a?24*Number(c)/Number(l):c,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,o].join(" "),...d},[...n.map((([e,n])=>(0,t.createElement)(e,n))),...Array.isArray(i)?i:[i]]);var u}));return s.displayName=`${e}`,s}},1151:(e,n,s)=>{s.d(n,{Z:()=>a,a:()=>c});var t=s(7294);const r={},l=t.createContext(r);function c(e){const n=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),t.createElement(l.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/2bc14e22.684b748e.js.LICENSE.txt b/assets/js/2bc14e22.4e0be83f.js.LICENSE.txt
similarity index 100%
rename from assets/js/2bc14e22.684b748e.js.LICENSE.txt
rename to assets/js/2bc14e22.4e0be83f.js.LICENSE.txt
diff --git a/assets/js/2bc14e22.684b748e.js b/assets/js/2bc14e22.684b748e.js
deleted file mode 100644
index b82d00d6db..0000000000
--- a/assets/js/2bc14e22.684b748e.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! For license information please see 2bc14e22.684b748e.js.LICENSE.txt */
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2839],{4760:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>x,frontMatter:()=>a,metadata:()=>i,toc:()=>h});var t=s(5893),r=s(1151),l=s(8609),c=s(3901);const a={},o="Using MySQL2 with TypeScript",i={id:"documentation/typescript-examples",title:"Using MySQL2 with TypeScript",description:"Installation",source:"@site/docs/documentation/typescript-examples.mdx",sourceDirName:"documentation",slug:"/documentation/typescript-examples",permalink:"/node-mysql2/docs/documentation/typescript-examples",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/documentation/typescript-examples.mdx",tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"Promise Wrappers",permalink:"/node-mysql2/docs/documentation/promise-wrapper"},next:{title:"API and Configuration",permalink:"/node-mysql2/docs/api-and-configurations"}},d={},h=[{value:"Installation",id:"installation",level:2},{value:"Usage",id:"usage",level:2},{value:"Connection",id:"connection",level:3},{value:"Pool Connection",id:"pool-connection",level:3},{value:"Query and Execute",id:"query-and-execute",level:3},{value:"A simple query",id:"a-simple-query",level:4},{value:"Type Specification",id:"type-specification",level:2},{value:"RowDataPacket[]",id:"rowdatapacket",level:3},{value:"RowDataPacket[][]",id:"rowdatapacket-1",level:3},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"ResultSetHeader[]",id:"resultsetheader-1",level:3},{value:"ProcedureCallPacket",id:"procedurecallpacket",level:3},{value:"OkPacket",id:"okpacket",level:3},{value:"Examples",id:"examples",level:2}];function u(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",br:"br",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"using-mysql2-with-typescript",children:"Using MySQL2 with TypeScript"}),"\n",(0,t.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm install --save mysql2\nnpm install --save-dev @types/node\n"})}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"@types/node"})," ensure the proper interaction between ",(0,t.jsx)(n.strong,{children:"TypeScript"})," and the ",(0,t.jsx)(n.strong,{children:"Node.js"})," modules used by ",(0,t.jsx)(n.strong,{children:"MySQL2"})," (",(0,t.jsx)(n.em,{children:"net"}),", ",(0,t.jsx)(n.em,{children:"events"}),", ",(0,t.jsx)(n.em,{children:"stream"}),", ",(0,t.jsx)(n.em,{children:"tls"}),", etc.)."]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["Requires ",(0,t.jsx)(n.strong,{children:"TypeScript"})," ",(0,t.jsx)(n.code,{children:">=4.5.2"}),"."]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,t.jsxs)(n.p,{children:["You can import ",(0,t.jsx)(n.strong,{children:"MySQL2"})," in two ways:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["By setting the ",(0,t.jsx)(n.code,{children:"esModuleInterop"})," option to ",(0,t.jsx)(n.code,{children:"true"})," in ",(0,t.jsx)(n.code,{children:"tsconfig.json"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql from 'mysql2';\nimport mysql from 'mysql2/promise';\n"})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["By setting the ",(0,t.jsx)(n.code,{children:"esModuleInterop"})," option to ",(0,t.jsx)(n.code,{children:"false"})," in ",(0,t.jsx)(n.code,{children:"tsconfig.json"})]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import * as mysql from 'mysql2';\nimport * as mysql from 'mysql2/promise';\n"})}),"\n",(0,t.jsx)(n.h3,{id:"connection",children:"Connection"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ConnectionOptions } from 'mysql2';\n\nconst access: ConnectionOptions = {\n user: 'test',\n database: 'test',\n};\n\nconst conn = mysql.createConnection(access);\n"})}),"\n",(0,t.jsx)(n.h3,{id:"pool-connection",children:"Pool Connection"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { PoolOptions } from 'mysql2';\n\nconst access: PoolOptions = {\n user: 'test',\n database: 'test',\n};\n\nconst conn = mysql.createPool(access);\n"})}),"\n",(0,t.jsx)(n.h3,{id:"query-and-execute",children:"Query and Execute"}),"\n",(0,t.jsx)(n.h4,{id:"a-simple-query",children:"A simple query"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"conn.query('SELECT 1 + 1 AS `test`;', (_err, rows) => {\n /**\n * @rows: [ { test: 2 } ]\n */\n});\n\nconn.execute('SELECT 1 + 1 AS `test`;', (_err, rows) => {\n /**\n * @rows: [ { test: 2 } ]\n */\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"rows"})," output will be these possible types:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"RowDataPacket[]"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"RowDataPacket[][]"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"ResultSetHeader"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"ResultSetHeader[]"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"In this example, you need to manually check the output types"}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"type-specification",children:"Type Specification"}),"\n",(0,t.jsx)(n.h3,{id:"rowdatapacket",children:"RowDataPacket[]"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(n.p,{children:"An array with the returned rows, for example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { RowDataPacket } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n});\n\n// SELECT\nconn.query('SELECT 1 + 1 AS `test`;', (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ { test: 2 } ]\n */\n});\n\n// SHOW\nconn.query('SHOW TABLES FROM `test`;', (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ { Tables_in_test: 'test' } ]\n */\n});\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Using ",(0,t.jsx)(n.code,{children:"rowsAsArray"})," option as ",(0,t.jsx)(n.code,{children:"true"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { RowDataPacket } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n rowsAsArray: true,\n});\n\n// SELECT\nconn.query(\n 'SELECT 1 + 1 AS test, 2 + 2 AS test;',\n (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ [ 2, 4 ] ]\n */\n }\n);\n\n// SHOW\nconn.query('SHOW TABLES FROM `test`;', (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ [ 'test' ] ]\n */\n});\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"rowdatapacket-1",children:"RowDataPacket[][]"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsxs)(n.p,{children:["Using ",(0,t.jsx)(n.code,{children:"multipleStatements"})," option as ",(0,t.jsx)(n.code,{children:"true"})," with multiple queries:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { RowDataPacket } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n multipleStatements: true,\n});\n\nconst sql = `\n SELECT 1 + 1 AS test;\n SELECT 2 + 2 AS test;\n`;\n\nconn.query(sql, (_err, rows) => {\n console.log(rows);\n /**\n * @rows: [ [ { test: 2 } ], [ { test: 4 } ] ]\n */\n});\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(l.A,{records:[{version:"3.5.1",changes:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.strong,{children:"OkPacket"})," is deprecated and might be removed in the future major release.",(0,t.jsx)(n.br,{}),"Please use ",(0,t.jsx)(n.strong,{children:"ResultSetHeader"})," instead."]}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.strong,{children:"changedRows"})," option is deprecated and might be removed in the future major release.",(0,t.jsx)(n.br,{}),"Please use ",(0,t.jsx)(n.strong,{children:"affectedRows"})," instead."]})]}]}),"\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.code,{children:"INSERT"}),", ",(0,t.jsx)(n.code,{children:"UPDATE"}),", ",(0,t.jsx)(n.code,{children:"DELETE"}),", ",(0,t.jsx)(n.code,{children:"TRUNCATE"}),", etc.:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ResultSetHeader } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n});\n\nconst sql = `\n SET @1 = 1;\n`;\n\nconn.query(sql, (_err, result) => {\n console.log(result);\n /**\n * @result: ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 2,\n warningStatus: 0,\n changedRows: 0\n }\n */\n});\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader-1",children:"ResultSetHeader[]"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(l.A,{records:[{version:"3.5.1",changes:[(0,t.jsxs)(t.Fragment,{children:["Introduce ",(0,t.jsx)(n.strong,{children:"ResultSetHeader[]"})]})]}]}),"\n",(0,t.jsxs)(n.p,{children:["For multiples ",(0,t.jsx)(n.code,{children:"INSERT"}),", ",(0,t.jsx)(n.code,{children:"UPDATE"}),", ",(0,t.jsx)(n.code,{children:"DELETE"}),", ",(0,t.jsx)(n.code,{children:"TRUNCATE"}),", etc. when using ",(0,t.jsx)(n.code,{children:"multipleStatements"})," as ",(0,t.jsx)(n.code,{children:"true"}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ResultSetHeader } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n multipleStatements: true,\n});\n\nconst sql = `\n SET @1 = 1;\n SET @2 = 2;\n`;\n\nconn.query(sql, (_err, results) => {\n console.log(results);\n /**\n * @results: [\n ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 10,\n warningStatus: 0,\n changedRows: 0\n },\n ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 2,\n warningStatus: 0,\n changedRows: 0\n }\n ]\n */\n});\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"procedurecallpacket",children:"ProcedureCallPacket"}),"\n",(0,t.jsx)(c.X,{level:2}),"\n",(0,t.jsx)(l.A,{records:[{version:"3.5.1",changes:[(0,t.jsxs)(t.Fragment,{children:["Introduce ",(0,t.jsx)(n.strong,{children:"ProcedureCallPacket"})]})]}]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["By performing a ",(0,t.jsx)(n.strong,{children:"Call Procedure"})," using ",(0,t.jsx)(n.code,{children:"INSERT"}),", ",(0,t.jsx)(n.code,{children:"UPDATE"}),", etc., the return will be a ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})," (even if you perform multiples queries and set ",(0,t.jsx)(n.code,{children:"multipleStatements"})," to ",(0,t.jsx)(n.code,{children:"true"}),"):"]})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"import mysql, { ProcedureCallPacket, ResultSetHeader } from 'mysql2';\n\nconst conn = mysql.createConnection({\n user: 'test',\n database: 'test',\n});\n\n/** ResultSetHeader */\nconn.query('DROP PROCEDURE IF EXISTS myProcedure');\n\n/** ResultSetHeader */\nconn.query(`\n CREATE PROCEDURE myProcedure()\n BEGIN\n SET @1 = 1;\n SET @2 = 2;\n END\n `);\n\n/** ProcedureCallPacket */\nconst sql = 'CALL myProcedure()';\n\nconn.query>(sql, (_err, result) => {\n console.log(result);\n /**\n * @result: ResultSetHeader {\n fieldCount: 0,\n affectedRows: 0,\n insertId: 0,\n info: '',\n serverStatus: 2,\n warningStatus: 0,\n changedRows: 0\n }\n */\n});\n"})}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.code,{children:"CREATE PROCEDURE"})," and ",(0,t.jsx)(n.code,{children:"DROP PROCEDURE"}),", these returns will be the ",(0,t.jsx)(n.em,{children:"default"})," ",(0,t.jsx)(n.code,{children:"ResultSetHeader"}),"."]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["By using ",(0,t.jsx)(n.code,{children:"SELECT"})," and ",(0,t.jsx)(n.code,{children:"SHOW"})," queries in a ",(0,t.jsx)(n.strong,{children:"Procedure Call"}),", it groups the results as:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"/** ProcedureCallPacket */\n[RowDataPacket[], ResultSetHeader]\n"})}),"\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"}),", please see the following examples."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"okpacket",children:"OkPacket"}),"\n",(0,t.jsx)(c.X,{level:0,message:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.strong,{children:"OkPacket"})," is deprecated and might be removed in the future major release.",(0,t.jsx)(n.br,{}),"Please use ",(0,t.jsx)(n.strong,{children:"ResultSetHeader"})," instead."]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,t.jsxs)(n.p,{children:["You can also check some code examples using ",(0,t.jsx)(n.strong,{children:"MySQL2"})," and ",(0,t.jsx)(n.strong,{children:"TypeScript"})," to understand advanced concepts:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/index",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/row-as-array",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," and ",(0,t.jsx)(n.code,{children:"rowAsArray"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/multi-statements",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," and ",(0,t.jsx)(n.code,{children:"multipleStatements"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/row-data/row-as-array-multi-statements",children:["Extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"}),", ",(0,t.jsx)(n.code,{children:"rowAsArray"})," and ",(0,t.jsx)(n.code,{children:"multipleStatements"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/procedure-call/index",children:["Checking for ",(0,t.jsx)(n.code,{children:"ResultSetHeader"}),", extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," from ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/procedure-call/row-as-array",children:["Checking for ",(0,t.jsx)(n.code,{children:"ResultSetHeader"}),", extending and using ",(0,t.jsx)(n.strong,{children:"Interfaces"})," with ",(0,t.jsx)(n.code,{children:"RowDataPacket"})," and ",(0,t.jsx)(n.code,{children:"rowAsArray"})," from ",(0,t.jsx)(n.code,{children:"ProcedureCallPacket"})]})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsxs)(n.a,{href:"/docs/examples/typescript/basic-custom-class",children:["Creating a basic custom ",(0,t.jsx)(n.strong,{children:"MySQL2"})," ",(0,t.jsx)(n.strong,{children:"Class"})]})}),"\n"]})]})}function x(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},4673:(e,n,s)=>{s.d(n,{Z:()=>p});var t=s(7294),r=s(512),l=s(2389),c=s(6043);const a={details:"details_lb9f",isBrowser:"isBrowser_bmU9",collapsibleContent:"collapsibleContent_i85q"};var o=s(5893);function i(e){return!!e&&("SUMMARY"===e.tagName||i(e.parentElement))}function d(e,n){return!!e&&(e===n||d(e.parentElement,n))}function h(e){let{summary:n,children:s,...h}=e;const u=(0,l.Z)(),x=(0,t.useRef)(null),{collapsed:p,setCollapsed:j}=(0,c.u)({initialState:!h.open}),[m,y]=(0,t.useState)(h.open),g=t.isValidElement(n)?n:(0,o.jsx)("summary",{children:n??"Details"});return(0,o.jsxs)("details",{...h,ref:x,open:m,"data-collapsed":p,className:(0,r.Z)(a.details,u&&a.isBrowser,h.className),onMouseDown:e=>{i(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const n=e.target;i(n)&&d(n,x.current)&&(e.preventDefault(),p?(j(!1),y(!0)):j(!0))},children:[g,(0,o.jsx)(c.z,{lazy:!1,collapsed:p,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{j(e),y(!e)},children:(0,o.jsx)("div",{className:a.collapsibleContent,children:s})})]})}const u={details:"details_b_Ee"},x="alert alert--info";function p(e){let{...n}=e;return(0,o.jsx)(h,{...n,className:(0,r.Z)(x,u.details,n.className)})}},8609:(e,n,s)=>{s.d(n,{A:()=>c});var t=s(4673);const r=(0,s(4297).Z)("FileClock",[["path",{d:"M16 22h2c.5 0 1-.2 1.4-.6.4-.4.6-.9.6-1.4V7.5L14.5 2H6c-.5 0-1 .2-1.4.6C4.2 3 4 3.5 4 4v3",key:"9lo3o3"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);var l=s(5893);const c=e=>{let{records:n,open:s}=e;return(0,l.jsx)(t.Z,{open:s,summary:(0,l.jsxs)("summary",{children:[(0,l.jsx)(r,{})," History"]}),className:"history",children:(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:"Version"}),(0,l.jsx)("th",{children:"Changes"})]})}),(0,l.jsx)("tbody",{children:n.map(((e,n)=>(0,l.jsxs)("tr",{children:[(0,l.jsx)("td",{children:(0,l.jsxs)("strong",{children:["v",e.version.replace(/[^0-9.]/g,"")]})}),(0,l.jsx)("td",{children:(0,l.jsx)("div",{className:"changes",children:e.changes.map(((e,n)=>(0,l.jsx)("section",{children:e},`change:${n}`)))})})]},`record:${n}`)))})]})})}},3901:(e,n,s)=>{s.d(n,{X:()=>u});var t=s(3692),r=s(4297);const l=(0,r.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),c=(0,r.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),a=(0,r.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),o=(0,r.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),i=(0,r.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),d=(0,r.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var h=s(5893);const u=e=>{let{level:n,message:s}=e;const r={0:{title:"Deprecated",icon:(0,h.jsx)(l,{})},1:{title:"Experimental",icon:(0,h.jsx)(c,{})},1.1:{title:"Early Development",icon:(0,h.jsx)(a,{})},1.2:{title:"Release Candidate",icon:(0,h.jsx)(o,{})},2:{title:"Stable",icon:(0,h.jsx)(i,{})},3:{title:"Legacy",icon:(0,h.jsx)(d,{})}};return(0,h.jsxs)("section",{className:"stability","data-level":n,children:[(0,h.jsx)(t.Z,{to:"/docs/stability-badges",children:(0,h.jsxs)("header",{children:[(0,h.jsx)("strong",{children:n}),(0,h.jsx)("span",{children:r[n].title}),r[n].icon]})}),s?(0,h.jsx)("p",{children:s}):null]})}},4297:(e,n,s)=>{s.d(n,{Z:()=>l});var t=s(7294),r={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const l=(e,n)=>{const s=(0,t.forwardRef)((({color:s="currentColor",size:l=24,strokeWidth:c=2,absoluteStrokeWidth:a,className:o="",children:i,...d},h)=>{return(0,t.createElement)("svg",{ref:h,...r,width:l,height:l,stroke:s,strokeWidth:a?24*Number(c)/Number(l):c,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,o].join(" "),...d},[...n.map((([e,n])=>(0,t.createElement)(e,n))),...Array.isArray(i)?i:[i]]);var u}));return s.displayName=`${e}`,s}},1151:(e,n,s)=>{s.d(n,{Z:()=>a,a:()=>c});var t=s(7294);const r={},l=t.createContext(r);function c(e){const n=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),t.createElement(l.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/4edc808e.1929d38c.js b/assets/js/4edc808e.1929d38c.js
deleted file mode 100644
index 41a64b873a..0000000000
--- a/assets/js/4edc808e.1929d38c.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4173],{7559:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>u,toc:()=>h});var t=s(5893),o=s(1151),r=s(4866),a=s(5162),l=s(4442);const i={slug:"/",position:1,title:"Quickstart",description:"MySQL client for Node.js with focus on performance"},c="MySQL2",u={id:"index",title:"Quickstart",description:"MySQL client for Node.js with focus on performance",source:"@site/docs/index.mdx",sourceDirName:".",slug:"/",permalink:"/node-mysql2/docs/",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/index.mdx",tags:[],version:"current",frontMatter:{slug:"/",position:1,title:"Quickstart",description:"MySQL client for Node.js with focus on performance"},sidebar:"docs",next:{title:"History and Why MySQL2",permalink:"/node-mysql2/docs/history-and-why-mysq2"}},d={},h=[{value:"Installation",id:"installation",level:2},{value:"First Query",id:"first-query",level:3},{value:"Using Prepared Statements",id:"using-prepared-statements",level:3},{value:"Using Connection Pools",id:"using-connection-pools",level:3},{value:"Using Promise Wrapper",id:"using-promise-wrapper",level:3},{value:"Array Results",id:"array-results",level:3},{value:"Connection Level",id:"connection-level",level:4},{value:"Query Level",id:"query-level",level:4}];function m(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.V,{title:"MySQL2 | Quickstart"}),"\n",(0,t.jsx)(n.h1,{id:"mysql2",children:"MySQL2"}),"\n","\n",(0,t.jsx)(n.p,{children:"MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl much more."}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://npmjs.org/package/mysql2",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/npm/v/mysql2.svg",alt:"NPM Version"})}),"\n",(0,t.jsx)(n.a,{href:"https://npmjs.org/package/mysql2",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/npm/dm/mysql2.svg",alt:"NPM Downloads"})}),"\n",(0,t.jsx)(n.a,{href:"https://nodejs.org/download/",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/node/v/mysql2.svg",alt:"Node.js Version"})}),"\n",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/blob/master/License",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/npm/l/mysql2.svg?maxAge=2592000",alt:"License"})})]}),"\n",(0,t.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,t.jsx)(n.p,{children:"MySQL2 is free from native bindings and can be installed on Linux, Mac OS or Windows without any issues."}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"JavaScript",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm install --save mysql2\n"})})}),(0,t.jsxs)(a.Z,{value:"TypeScript",children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm install --save mysql2\nnpm install --save-dev @types/node\n"})}),(0,t.jsxs)(n.p,{children:["For TypeScript documentation and examples, see ",(0,t.jsx)(n.a,{href:"/docs/documentation/typescript-examples",children:"here"}),"."]})]})]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"first-query",children:"First Query"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["To explore more queries examples, please visit the example sections ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,t.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,t.jsx)(n.strong,{children:"Prepared Statements"})}),"."]}),"\n"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// Get the client\nimport mysql from 'mysql2/promise';\n\n// Create the connection to database\nconst connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\n// A simple SELECT query\ntry {\n const [results, fields] = await connection.query(\n 'SELECT * FROM `table` WHERE `name` = \"Page\" AND `age` > 45'\n );\n\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n} catch (err) {\n console.log(err);\n}\n\n// Using placeholders\ntry {\n const [results] = await connection.query(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Page', 45]\n );\n\n console.log(results);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// Get the client\nconst mysql = require('mysql2');\n\n// Create the connection to database\nconst connection = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\n// A simple SELECT query\nconnection.query(\n 'SELECT * FROM `table` WHERE `name` = \"Page\" AND `age` > 45',\n function (err, results, fields) {\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n }\n);\n\n// Using placeholders\nconnection.query(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Page', 45],\n function (err, results) {\n console.log(results);\n }\n);\n"})})})]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"using-prepared-statements",children:"Using Prepared Statements"}),"\n",(0,t.jsx)(n.p,{children:"With MySQL2 you also get the prepared statements. With prepared statements MySQL doesn't have to prepare plan for same query every time, this results in better performance. If you don't know why they are important, please check these discussions:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://stackoverflow.com/questions/8263371/how-can-prepared-statements-protect-from-sql-injection-attacks",children:"How prepared statements can protect from SQL Injection attacks"})}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 provides ",(0,t.jsx)(n.code,{children:"execute"})," helper which will prepare and query the statement. You can also manually prepare / unprepare statement with ",(0,t.jsx)(n.code,{children:"prepare"})," / ",(0,t.jsx)(n.code,{children:"unprepare"})," methods."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["To explore more Prepared Statements and Placeholders examples, please visit the example section ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,t.jsx)(n.strong,{children:"Prepared Statements"})}),"."]}),"\n"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // create the connection to database\n const connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n });\n\n // execute will internally call prepare and query\n const [results, fields] = await connection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Rick C-137', 53]\n );\n\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\n// create the connection to database\nconst connection = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\n// execute will internally call prepare and query\nconnection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Rick C-137', 53],\n function (err, results, fields) {\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n }\n);\n"})})})]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsx)(n.p,{children:"If you execute same statement again, it will be picked from a LRU cache which will save query preparation time and give better performance."})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"using-connection-pools",children:"Using Connection Pools"}),"\n",(0,t.jsx)(n.p,{children:"Connection pools help reduce the time spent connecting to the MySQL server by reusing a previous connection, leaving them open instead of closing when you are done with them."}),"\n",(0,t.jsx)(n.p,{children:"This improves the latency of queries as you avoid all of the overhead that comes with establishing a new connection."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["To explore more Connection Pools examples, please visit the example section ",(0,t.jsx)(n.a,{href:"/docs/examples/connections/create-pool",children:(0,t.jsx)(n.strong,{children:"createPool"})}),"."]}),"\n"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\n// Create the connection pool. The pool-specific settings are the defaults\nconst pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n waitForConnections: true,\n connectionLimit: 10,\n maxIdle: 10, // max idle connections, the default value is the same as `connectionLimit`\n idleTimeout: 60000, // idle connections timeout, in milliseconds, the default value 60000\n queueLimit: 0,\n enableKeepAlive: true,\n keepAliveInitialDelay: 0,\n});\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\n// Create the connection pool. The pool-specific settings are the defaults\nconst pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n waitForConnections: true,\n connectionLimit: 10,\n maxIdle: 10, // max idle connections, the default value is the same as `connectionLimit`\n idleTimeout: 60000, // idle connections timeout, in milliseconds, the default value 60000\n queueLimit: 0,\n enableKeepAlive: true,\n keepAliveInitialDelay: 0,\n});\n"})})})]}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsx)(n.p,{children:"The pool does not create all connections upfront but creates them on demand until the connection limit is reached."})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsxs)(n.p,{children:["You can use the pool in the same way as connections (using ",(0,t.jsx)(n.code,{children:"pool.query()"})," and ",(0,t.jsx)(n.code,{children:"pool.execute()"}),"):"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n // For pool initialization, see above\n const [rows, fields] = await pool.query('SELECT `field` FROM `table`');\n // Connection is automatically released when query resolves\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// For pool initialization, see above\npool.query('SELECT `field` FROM `table`', function (err, rows, fields) {\n // Connection is automatically released when query resolves\n});\n"})})})]}),"\n",(0,t.jsx)(n.p,{children:"Alternatively, there is also the possibility of manually acquiring a connection from the pool and returning it later:"}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// For pool initialization, see above\nconst conn = await pool.getConnection();\n\n// Do something with the connection\nawait conn.query(/* ... */);\n\n// Don't forget to release the connection when finished!\npool.releaseConnection(conn);\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// For pool initialization, see above\npool.getConnection(function (err, conn) {\n // Do something with the connection\n conn.query(/* ... */);\n\n // Don't forget to release the connection when finished!\n pool.releaseConnection(conn);\n});\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Additionally, directly release the connection using the ",(0,t.jsx)(n.code,{children:"connection"})," object:"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"conn.release();\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"using-promise-wrapper",children:"Using Promise Wrapper"}),"\n",(0,t.jsx)(n.p,{children:"MySQL2 also support Promise API. Which works very well with ES7 async await."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\nasync function main() {\n // create the connection\n const connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n });\n\n // query database\n const [rows, fields] = await connection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Morty', 14]\n );\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 use default ",(0,t.jsx)(n.code,{children:"Promise"})," object available in scope. But you can choose which ",(0,t.jsx)(n.code,{children:"Promise"})," implementation you want to use."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// get the client\nimport mysql from 'mysql2/promise';\n\n// get the promise implementation, we will use bluebird\nimport bluebird from 'bluebird';\n\n// create the connection, specify bluebird as Promise\nconst connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n Promise: bluebird,\n});\n\n// query database\nconst [rows, fields] = await connection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Morty', 14]\n);\n"})}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 also exposes a ",(0,t.jsx)(n.code,{children:".promise()"})," function on Pools, so you can create a promise/non-promise connections from the same pool."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2';\n\nasync function main() {\n // create the pool\n const pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n });\n\n // now get a Promise wrapped instance of that pool\n const promisePool = pool.promise();\n\n // query database using promises\n const [rows, fields] = await promisePool.query('SELECT 1');\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 exposes a ",(0,t.jsx)(n.code,{children:".promise()"}),' function on Connections, to "upgrade" an existing non-promise connection to use promise.']}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{11}",children:"const mysql = require('mysql2');\n\n// create the connection\nconst conn = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\nconn\n .promise()\n .query('SELECT 1')\n .then(([rows, fields]) => {\n console.log(rows);\n })\n .catch(console.log)\n .then(() => conn.end());\n"})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"array-results",children:"Array Results"}),"\n",(0,t.jsxs)(n.p,{children:["If you have two columns with the same name, you might want to get results as an array rather than an object to prevent them from clashing. This is a deviation from the ",(0,t.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"})," library."]}),"\n",(0,t.jsxs)(n.p,{children:["For example: ",(0,t.jsx)(n.code,{children:"SELECT 1 AS `foo`, 2 AS `foo`"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"You can enable this setting at either the connection level (applies to all queries), or at the query level (applies only to that specific query)."}),"\n",(0,t.jsx)(n.h4,{id:"connection-level",children:"Connection Level"}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{5}",children:"const conn = await mysql.createConnection({\n host: 'localhost',\n database: 'test',\n user: 'root',\n rowsAsArray: true,\n});\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{5}",children:"const conn = mysql.createConnection({\n host: 'localhost',\n database: 'test',\n user: 'root',\n rowsAsArray: true,\n});\n"})})})]}),"\n",(0,t.jsx)(n.h4,{id:"query-level",children:"Query Level"}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{4}",children:"try {\n const [results, fields] = await conn.query({\n sql: 'SELECT 1 AS `foo`, 2 AS `foo`',\n rowsAsArray: true,\n });\n\n console.log(results); // in this query, results will be an array of arrays rather than an array of objects\n console.log(fields); // fields are unchanged\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{4}",children:"conn.query(\n {\n sql: 'SELECT 1 AS `foo`, 2 AS `foo`',\n rowsAsArray: true,\n },\n function (err, results, fields) {\n console.log(results); // in this query, results will be an array of arrays rather than an array of objects\n console.log(fields); // fields are unchanged\n }\n);\n"})})})]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.admonition,{title:"Getting Help",type:"tip",children:(0,t.jsxs)(n.p,{children:["Need help? Ask your question on ",(0,t.jsx)(n.a,{href:"https://stackoverflow.com/questions/tagged/mysql2",children:"Stack Overflow"})," or ",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/discussions",children:"GitHub"}),".\nIf you've encountered an issue, please ",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues",children:"file it on GitHub"}),"."]})})]})}function p(e={}){const{wrapper:n}={...(0,o.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(m,{...e})}):m(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>a});s(7294);var t=s(512);const o={tabItem:"tabItem_Ymn6"};var r=s(5893);function a(e){let{children:n,hidden:s,className:a}=e;return(0,r.jsx)("div",{role:"tabpanel",className:(0,t.Z)(o.tabItem,a),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>q});var t=s(7294),o=s(512),r=s(2466),a=s(6550),l=s(469),i=s(1980),c=s(7392),u=s(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:o}}=e;return{value:n,label:s,attributes:t,default:o}}))}(s);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function m(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function p(e){let{queryString:n=!1,groupId:s}=e;const o=(0,a.k6)(),r=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(r),(0,t.useCallback)((e=>{if(!r)return;const n=new URLSearchParams(o.location.search);n.set(r,e),o.replace({...o.location,search:n.toString()})}),[r,o])]}function x(e){const{defaultValue:n,queryString:s=!1,groupId:o}=e,r=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:r}))),[c,d]=p({queryString:s,groupId:o}),[x,y]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[o,r]=(0,u.Nk)(s);return[o,(0,t.useCallback)((e=>{s&&r.set(e)}),[s,r])]}({groupId:o}),f=(()=>{const e=c??x;return m({value:e,tabValues:r})?e:null})();(0,l.Z)((()=>{f&&i(f)}),[f]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!m({value:e,tabValues:r}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),y(e)}),[d,y,r]),tabValues:r}}var y=s(2389);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=s(5893);function g(e){let{className:n,block:s,selectedValue:t,selectValue:a,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,r.o5)(),u=e=>{const n=e.currentTarget,s=i.indexOf(n),o=l[s].value;o!==t&&(c(n),a(o))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:r}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...r,className:(0,o.Z)("tabs__item",f.tabItem,r?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:o}=e;const r=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=r.find((e=>e.props.value===o));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:r.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function v(e){const n=x(e);return(0,j.jsxs)("div",{className:(0,o.Z)("tabs-container",f.tabList),children:[(0,j.jsx)(g,{...e,...n}),(0,j.jsx)(b,{...e,...n})]})}function q(e){const n=(0,y.Z)();return(0,j.jsx)(v,{...e,children:d(e.children)},String(n))}},4442:(e,n,s)=>{s.d(n,{V:()=>r});var t=s(5742),o=s(5893);const r=e=>{let{title:n}=e;return(0,o.jsx)(t.Z,{children:(0,o.jsx)("title",{children:n})})}},1151:(e,n,s)=>{s.d(n,{Z:()=>l,a:()=>a});var t=s(7294);const o={},r=t.createContext(o);function a(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/4edc808e.7f854e52.js b/assets/js/4edc808e.7f854e52.js
new file mode 100644
index 0000000000..cf99d9616a
--- /dev/null
+++ b/assets/js/4edc808e.7f854e52.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4173],{7559:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>u,toc:()=>h});var t=s(5893),o=s(1151),r=s(4866),a=s(5162),l=s(4442);const i={slug:"/",position:1,title:"Quickstart",description:"MySQL client for Node.js with focus on performance"},c="MySQL2",u={id:"index",title:"Quickstart",description:"MySQL client for Node.js with focus on performance",source:"@site/docs/index.mdx",sourceDirName:".",slug:"/",permalink:"/node-mysql2/docs/",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/index.mdx",tags:[],version:"current",frontMatter:{slug:"/",position:1,title:"Quickstart",description:"MySQL client for Node.js with focus on performance"},sidebar:"docs",next:{title:"History and Why MySQL2",permalink:"/node-mysql2/docs/history-and-why-mysq2"}},d={},h=[{value:"Installation",id:"installation",level:2},{value:"First Query",id:"first-query",level:3},{value:"Using Prepared Statements",id:"using-prepared-statements",level:3},{value:"Using Connection Pools",id:"using-connection-pools",level:3},{value:"Using Promise Wrapper",id:"using-promise-wrapper",level:3},{value:"Array Results",id:"array-results",level:3},{value:"Connection Level",id:"connection-level",level:4},{value:"Query Level",id:"query-level",level:4}];function m(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.V,{title:"MySQL2 | Quickstart"}),"\n",(0,t.jsx)(n.h1,{id:"mysql2",children:"MySQL2"}),"\n","\n",(0,t.jsx)(n.p,{children:"MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl much more."}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://npmjs.org/package/mysql2",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/npm/v/mysql2.svg",alt:"NPM Version"})}),"\n",(0,t.jsx)(n.a,{href:"https://npmjs.org/package/mysql2",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/npm/dm/mysql2.svg",alt:"NPM Downloads"})}),"\n",(0,t.jsx)(n.a,{href:"https://nodejs.org/download/",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/node/v/mysql2.svg",alt:"Node.js Version"})}),"\n",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/blob/master/License",children:(0,t.jsx)(n.img,{src:"https://img.shields.io/npm/l/mysql2.svg?maxAge=2592000",alt:"License"})})]}),"\n",(0,t.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,t.jsx)(n.p,{children:"MySQL2 is free from native bindings and can be installed on Linux, Mac OS or Windows without any issues."}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"JavaScript",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm install --save mysql2\n"})})}),(0,t.jsxs)(a.Z,{value:"TypeScript",children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm install --save mysql2\nnpm install --save-dev @types/node\n"})}),(0,t.jsxs)(n.p,{children:["For TypeScript documentation and examples, see ",(0,t.jsx)(n.a,{href:"/docs/documentation/typescript-examples",children:"here"}),"."]})]})]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"first-query",children:"First Query"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["To explore more queries examples, please visit the example sections ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,t.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,t.jsx)(n.strong,{children:"Prepared Statements"})}),"."]}),"\n"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// Get the client\nimport mysql from 'mysql2/promise';\n\n// Create the connection to database\nconst connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\n// A simple SELECT query\ntry {\n const [results, fields] = await connection.query(\n 'SELECT * FROM `table` WHERE `name` = \"Page\" AND `age` > 45'\n );\n\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n} catch (err) {\n console.log(err);\n}\n\n// Using placeholders\ntry {\n const [results] = await connection.query(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Page', 45]\n );\n\n console.log(results);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// Get the client\nconst mysql = require('mysql2');\n\n// Create the connection to database\nconst connection = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\n// A simple SELECT query\nconnection.query(\n 'SELECT * FROM `table` WHERE `name` = \"Page\" AND `age` > 45',\n function (err, results, fields) {\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n }\n);\n\n// Using placeholders\nconnection.query(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Page', 45],\n function (err, results) {\n console.log(results);\n }\n);\n"})})})]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"using-prepared-statements",children:"Using Prepared Statements"}),"\n",(0,t.jsx)(n.p,{children:"With MySQL2 you also get the prepared statements. With prepared statements MySQL doesn't have to prepare plan for same query every time, this results in better performance. If you don't know why they are important, please check these discussions:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://stackoverflow.com/questions/8263371/how-can-prepared-statements-protect-from-sql-injection-attacks",children:"How prepared statements can protect from SQL Injection attacks"})}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 provides ",(0,t.jsx)(n.code,{children:"execute"})," helper which will prepare and query the statement. You can also manually prepare / unprepare statement with ",(0,t.jsx)(n.code,{children:"prepare"})," / ",(0,t.jsx)(n.code,{children:"unprepare"})," methods."]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["To explore more Prepared Statements and Placeholders examples, please visit the example section ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,t.jsx)(n.strong,{children:"Prepared Statements"})}),"."]}),"\n"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // create the connection to database\n const connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n });\n\n // execute will internally call prepare and query\n const [results, fields] = await connection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Rick C-137', 53]\n );\n\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\n// create the connection to database\nconst connection = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\n// execute will internally call prepare and query\nconnection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Rick C-137', 53],\n function (err, results, fields) {\n console.log(results); // results contains rows returned by server\n console.log(fields); // fields contains extra meta data about results, if available\n }\n);\n"})})})]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsx)(n.p,{children:"If you execute same statement again, it will be picked from a LRU cache which will save query preparation time and give better performance."})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"using-connection-pools",children:"Using Connection Pools"}),"\n",(0,t.jsx)(n.p,{children:"Connection pools help reduce the time spent connecting to the MySQL server by reusing a previous connection, leaving them open instead of closing when you are done with them."}),"\n",(0,t.jsx)(n.p,{children:"This improves the latency of queries as you avoid all of the overhead that comes with establishing a new connection."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["To explore more Connection Pools examples, please visit the example section ",(0,t.jsx)(n.a,{href:"/docs/examples/connections/create-pool",children:(0,t.jsx)(n.strong,{children:"createPool"})}),"."]}),"\n"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\n// Create the connection pool. The pool-specific settings are the defaults\nconst pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n waitForConnections: true,\n connectionLimit: 10,\n maxIdle: 10, // max idle connections, the default value is the same as `connectionLimit`\n idleTimeout: 60000, // idle connections timeout, in milliseconds, the default value 60000\n queueLimit: 0,\n enableKeepAlive: true,\n keepAliveInitialDelay: 0,\n});\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\n// Create the connection pool. The pool-specific settings are the defaults\nconst pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n waitForConnections: true,\n connectionLimit: 10,\n maxIdle: 10, // max idle connections, the default value is the same as `connectionLimit`\n idleTimeout: 60000, // idle connections timeout, in milliseconds, the default value 60000\n queueLimit: 0,\n enableKeepAlive: true,\n keepAliveInitialDelay: 0,\n});\n"})})})]}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsx)(n.p,{children:"The pool does not create all connections upfront but creates them on demand until the connection limit is reached."})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsxs)(n.p,{children:["You can use the pool in the same way as connections (using ",(0,t.jsx)(n.code,{children:"pool.query()"})," and ",(0,t.jsx)(n.code,{children:"pool.execute()"}),"):"]}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n // For pool initialization, see above\n const [rows, fields] = await pool.query('SELECT `field` FROM `table`');\n // Connection is automatically released when query resolves\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// For pool initialization, see above\npool.query('SELECT `field` FROM `table`', function (err, rows, fields) {\n // Connection is automatically released when query resolves\n});\n"})})})]}),"\n",(0,t.jsx)(n.p,{children:"Alternatively, there is also the possibility of manually acquiring a connection from the pool and returning it later:"}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// For pool initialization, see above\nconst conn = await pool.getConnection();\n\n// Do something with the connection\nawait conn.query(/* ... */);\n\n// Don't forget to release the connection when finished!\npool.releaseConnection(conn);\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// For pool initialization, see above\npool.getConnection(function (err, conn) {\n // Do something with the connection\n conn.query(/* ... */);\n\n // Don't forget to release the connection when finished!\n pool.releaseConnection(conn);\n});\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Additionally, directly release the connection using the ",(0,t.jsx)(n.code,{children:"connection"})," object:"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"conn.release();\n"})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"using-promise-wrapper",children:"Using Promise Wrapper"}),"\n",(0,t.jsx)(n.p,{children:"MySQL2 also support Promise API. Which works very well with ES7 async await."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\nasync function main() {\n // create the connection\n const connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n });\n\n // query database\n const [rows, fields] = await connection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Morty', 14]\n );\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 use default ",(0,t.jsx)(n.code,{children:"Promise"})," object available in scope. But you can choose which ",(0,t.jsx)(n.code,{children:"Promise"})," implementation you want to use."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"// get the client\nimport mysql from 'mysql2/promise';\n\n// get the promise implementation, we will use bluebird\nimport bluebird from 'bluebird';\n\n// create the connection, specify bluebird as Promise\nconst connection = await mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n Promise: bluebird,\n});\n\n// query database\nconst [rows, fields] = await connection.execute(\n 'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',\n ['Morty', 14]\n);\n"})}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 also exposes a ",(0,t.jsx)(n.code,{children:".promise()"})," function on Pools, so you can create a promise/non-promise connections from the same pool."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2';\n\nasync function main() {\n // create the pool\n const pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n });\n\n // now get a Promise wrapped instance of that pool\n const promisePool = pool.promise();\n\n // query database using promises\n const [rows, fields] = await promisePool.query('SELECT 1');\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["MySQL2 exposes a ",(0,t.jsx)(n.code,{children:".promise()"}),' function on Connections, to "upgrade" an existing non-promise connection to use promise.']}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{11}",children:"const mysql = require('mysql2');\n\n// create the connection\nconst conn = mysql.createConnection({\n host: 'localhost',\n user: 'root',\n database: 'test',\n});\n\nconn\n .promise()\n .query('SELECT 1')\n .then(([rows, fields]) => {\n console.log(rows);\n })\n .catch(console.log)\n .then(() => conn.end());\n"})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"array-results",children:"Array Results"}),"\n",(0,t.jsxs)(n.p,{children:["If you have two columns with the same name, you might want to get results as an array rather than an object to prevent them from clashing. This is a deviation from the ",(0,t.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"})," library."]}),"\n",(0,t.jsxs)(n.p,{children:["For example: ",(0,t.jsx)(n.code,{children:"SELECT 1 AS `foo`, 2 AS `foo`"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"You can enable this setting at either the connection level (applies to all queries), or at the query level (applies only to that specific query)."}),"\n",(0,t.jsx)(n.h4,{id:"connection-level",children:"Connection Level"}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{5}",children:"const conn = await mysql.createConnection({\n host: 'localhost',\n database: 'test',\n user: 'root',\n rowsAsArray: true,\n});\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{5}",children:"const conn = mysql.createConnection({\n host: 'localhost',\n database: 'test',\n user: 'root',\n rowsAsArray: true,\n});\n"})})})]}),"\n",(0,t.jsx)(n.h4,{id:"query-level",children:"Query Level"}),"\n",(0,t.jsxs)(r.Z,{children:[(0,t.jsx)(a.Z,{value:"Promise",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{4}",children:"try {\n const [results, fields] = await conn.query({\n sql: 'SELECT 1 AS `foo`, 2 AS `foo`',\n rowsAsArray: true,\n });\n\n console.log(results); // in this query, results will be an array of arrays rather than an array of objects\n console.log(fields); // fields are unchanged\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"Callback",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",metastring:"{4}",children:"conn.query(\n {\n sql: 'SELECT 1 AS `foo`, 2 AS `foo`',\n rowsAsArray: true,\n },\n function (err, results, fields) {\n console.log(results); // in this query, results will be an array of arrays rather than an array of objects\n console.log(fields); // fields are unchanged\n }\n);\n"})})})]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.admonition,{title:"Getting Help",type:"tip",children:(0,t.jsxs)(n.p,{children:["Need help? Ask your question on ",(0,t.jsx)(n.a,{href:"https://stackoverflow.com/questions/tagged/mysql2",children:"Stack Overflow"})," or ",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/discussions",children:"GitHub"}),".\nIf you've encountered an issue, please ",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues",children:"file it on GitHub"}),"."]})})]})}function p(e={}){const{wrapper:n}={...(0,o.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(m,{...e})}):m(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>a});s(7294);var t=s(512);const o={tabItem:"tabItem_Ymn6"};var r=s(5893);function a(e){let{children:n,hidden:s,className:a}=e;return(0,r.jsx)("div",{role:"tabpanel",className:(0,t.Z)(o.tabItem,a),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>q});var t=s(7294),o=s(512),r=s(2466),a=s(6550),l=s(469),i=s(1980),c=s(7392),u=s(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:o}}=e;return{value:n,label:s,attributes:t,default:o}}))}(s);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function m(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function p(e){let{queryString:n=!1,groupId:s}=e;const o=(0,a.k6)(),r=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(r),(0,t.useCallback)((e=>{if(!r)return;const n=new URLSearchParams(o.location.search);n.set(r,e),o.replace({...o.location,search:n.toString()})}),[r,o])]}function x(e){const{defaultValue:n,queryString:s=!1,groupId:o}=e,r=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!m({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:r}))),[c,d]=p({queryString:s,groupId:o}),[x,y]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[o,r]=(0,u.Nk)(s);return[o,(0,t.useCallback)((e=>{s&&r.set(e)}),[s,r])]}({groupId:o}),f=(()=>{const e=c??x;return m({value:e,tabValues:r})?e:null})();(0,l.Z)((()=>{f&&i(f)}),[f]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!m({value:e,tabValues:r}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),y(e)}),[d,y,r]),tabValues:r}}var y=s(2389);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var j=s(5893);function g(e){let{className:n,block:s,selectedValue:t,selectValue:a,tabValues:l}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,r.o5)(),u=e=>{const n=e.currentTarget,s=i.indexOf(n),o=l[s].value;o!==t&&(c(n),a(o))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,j.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:r}=e;return(0,j.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...r,className:(0,o.Z)("tabs__item",f.tabItem,r?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:o}=e;const r=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=r.find((e=>e.props.value===o));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,j.jsx)("div",{className:"margin-top--md",children:r.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function v(e){const n=x(e);return(0,j.jsxs)("div",{className:(0,o.Z)("tabs-container",f.tabList),children:[(0,j.jsx)(g,{...e,...n}),(0,j.jsx)(b,{...e,...n})]})}function q(e){const n=(0,y.Z)();return(0,j.jsx)(v,{...e,children:d(e.children)},String(n))}},4442:(e,n,s)=>{s.d(n,{V:()=>r});var t=s(5742),o=s(5893);const r=e=>{let{title:n}=e;return(0,o.jsx)(t.Z,{children:(0,o.jsx)("title",{children:n})})}},1151:(e,n,s)=>{s.d(n,{Z:()=>l,a:()=>a});var t=s(7294);const o={},r=t.createContext(o);function a(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/54768732.2ebf0dd6.js b/assets/js/54768732.2ebf0dd6.js
new file mode 100644
index 0000000000..8220e1eb31
--- /dev/null
+++ b/assets/js/54768732.2ebf0dd6.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[576],{3990:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>h,contentTitle:()=>c,default:()=>x,frontMatter:()=>u,metadata:()=>d,toc:()=>p});var t=r(5893),s=r(1151),l=r(4866),a=r(5162),o=r(6393),i=r(4379);const u={sidebar_position:2,tags:["query"]},c="UPDATE",d={id:"examples/queries/simple-queries/update",title:"UPDATE",description:"The examples below also work for the execute method.",source:"@site/docs/examples/queries/simple-queries/update.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/update",permalink:"/node-mysql2/docs/examples/queries/simple-queries/update",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/update.mdx",tags:[{label:"query",permalink:"/node-mysql2/docs/tags/query"}],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,tags:["query"]},sidebar:"examples",previous:{title:"SELECT",permalink:"/node-mysql2/docs/examples/queries/simple-queries/select"},next:{title:"DELETE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/delete"}},h={},p=[{value:"query(sql)",id:"querysql",level:2},{value:"query(options)",id:"queryoptions",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions-1",level:3}];function m(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"update",children:"UPDATE"}),"\n",(0,t.jsxs)(n.p,{children:["The examples below also work for the ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements/update",children:(0,t.jsx)(n.code,{children:"execute"})})," method."]}),"\n",(0,t.jsx)(n.h2,{id:"querysql",children:"query(sql)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"query(sql: string)"})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\n // highlight-next-line\n const [result, fields] = await connection.query(sql);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\nconnection.query(sql, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"queryoptions",children:"query(options)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["query(options: ",(0,t.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\n // highlight-start\n const [result, fields] = await connection.query({\n sql,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\nconnection.query(\n {\n sql,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,t.jsx)(n.h3,{id:"queryoptions-1",children:"QueryOptions"}),"\n",(0,t.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function x(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(m,{...e})}):m(e)}},5162:(e,n,r)=>{r.d(n,{Z:()=>a});r(7294);var t=r(512);const s={tabItem:"tabItem_Ymn6"};var l=r(5893);function a(e){let{children:n,hidden:r,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,t.Z)(s.tabItem,a),hidden:r,children:n})}},4866:(e,n,r)=>{r.d(n,{Z:()=>v});var t=r(7294),s=r(512),l=r(2466),a=r(6550),o=r(469),i=r(1980),u=r(7392),c=r(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:r}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:r,attributes:t,default:s}}=e;return{value:n,label:r,attributes:t,default:s}}))}(r);return function(e){const n=(0,u.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,r])}function p(e){let{value:n,tabValues:r}=e;return r.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:r}=e;const s=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:r}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:n,groupId:r});return[(0,i._X)(l),(0,t.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(s.location.search);n.set(l,e),s.replace({...s.location,search:n.toString()})}),[l,s])]}function x(e){const{defaultValue:n,queryString:r=!1,groupId:s}=e,l=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:r}=e;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:r}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${r.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=r.find((e=>e.default))??r[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:l}))),[u,d]=m({queryString:r,groupId:s}),[x,f]=function(e){let{groupId:n}=e;const r=function(e){return e?`docusaurus.tab.${e}`:null}(n),[s,l]=(0,c.Nk)(r);return[s,(0,t.useCallback)((e=>{r&&l.set(e)}),[r,l])]}({groupId:s}),b=(()=>{const e=u??x;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{b&&i(b)}),[b]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),f(e)}),[d,f,l]),tabValues:l}}var f=r(2389);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=r(5893);function j(e){let{className:n,block:r,selectedValue:t,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,l.o5)(),c=e=>{const n=e.currentTarget,r=i.indexOf(n),s=o[r].value;s!==t&&(u(n),a(s))},d=e=>{let n=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const r=i.indexOf(e.currentTarget)+1;n=i[r]??i[0];break}case"ArrowLeft":{const r=i.indexOf(e.currentTarget)-1;n=i[r]??i[i.length-1];break}}n?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":r},n),children:o.map((e=>{let{value:n,label:r,attributes:l}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>i.push(e),onKeyDown:d,onClick:c,...l,className:(0,s.Z)("tabs__item",b.tabItem,l?.className,{"tabs__item--active":t===n}),children:r??n},n)}))})}function q(e){let{lazy:n,children:r,selectedValue:s}=e;const l=(Array.isArray(r)?r:[r]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===s));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==s})))})}function y(e){const n=x(e);return(0,g.jsxs)("div",{className:(0,s.Z)("tabs-container",b.tabList),children:[(0,g.jsx)(j,{...e,...n}),(0,g.jsx)(q,{...e,...n})]})}function v(e){const n=(0,f.Z)();return(0,g.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,r)=>{r.d(n,{I:()=>i});var t=r(7294),s=r(2263),l=r(9286),a=r(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:r,extractMethod:i,methodType:u}=e;const[c,d]=(0,t.useState)(""),[h,p]=(0,t.useState)(!0),[m,x]=(0,t.useState)(!0),{siteConfig:f}=(0,s.Z)(),b=f.baseUrl.replace(/\/$/,""),g=/^\//.test(n)?`${b}${n}`:n;return(0,t.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(g,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&u?((e,n,r)=>{const t=e.split("\n"),s=`${r} ${n}`;let l=!1,a=0,o="";for(const i of t)if(i.includes(s)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,u):e;d(n||e),p(!1),x(!1)})).catch((()=>{x(!0),p(!1)})),()=>{e.abort()}}),[g,i,u]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:m?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:g}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${r}`,children:c})})})}},6393:(e,n,r)=>{r.d(n,{Z:()=>l});var t=r(4673),s=r(5893);const l=e=>{let{children:n,open:r,title:l}=e;return(0,s.jsx)(t.Z,{open:r,className:"faq",summary:(0,s.jsx)("summary",{children:(0,s.jsx)("strong",{children:l})}),children:(0,s.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/54768732.7adc3ec4.js b/assets/js/54768732.7adc3ec4.js
deleted file mode 100644
index 2238e60c91..0000000000
--- a/assets/js/54768732.7adc3ec4.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[576],{3990:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>h,contentTitle:()=>c,default:()=>x,frontMatter:()=>u,metadata:()=>d,toc:()=>p});var t=n(5893),s=n(1151),l=n(4866),a=n(5162),o=n(6393),i=n(4379);const u={sidebar_position:2,tags:["query"]},c="UPDATE",d={id:"examples/queries/simple-queries/update",title:"UPDATE",description:"The examples below also work for the execute method.",source:"@site/docs/examples/queries/simple-queries/update.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/update",permalink:"/node-mysql2/docs/examples/queries/simple-queries/update",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/update.mdx",tags:[{label:"query",permalink:"/node-mysql2/docs/tags/query"}],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,tags:["query"]},sidebar:"examples",previous:{title:"SELECT",permalink:"/node-mysql2/docs/examples/queries/simple-queries/select"},next:{title:"DELETE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/delete"}},h={},p=[{value:"query(sql)",id:"querysql",level:2},{value:"query(options)",id:"queryoptions",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions-1",level:3}];function m(e){const r={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h1,{id:"update",children:"UPDATE"}),"\n",(0,t.jsxs)(r.p,{children:["The examples below also work for the ",(0,t.jsx)(r.a,{href:"/docs/examples/queries/prepared-statements/update",children:(0,t.jsx)(r.code,{children:"execute"})})," method."]}),"\n",(0,t.jsx)(r.h2,{id:"querysql",children:"query(sql)"}),"\n",(0,t.jsxs)(r.blockquote,{children:["\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"query(sql: string)"})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\n // highlight-next-line\n const [result, fields] = await connection.query(sql);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\nconnection.query(sql, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"result"}),": contains a ",(0,t.jsx)(r.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(r.admonition,{type:"info",children:(0,t.jsxs)(r.p,{children:["The connection used for the query (",(0,t.jsx)(r.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(r.code,{children:"createConnection"}),", ",(0,t.jsx)(r.code,{children:"createPool"})," or ",(0,t.jsx)(r.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h2,{id:"queryoptions",children:"query(options)"}),"\n",(0,t.jsxs)(r.blockquote,{children:["\n",(0,t.jsx)(r.p,{children:(0,t.jsxs)(r.strong,{children:["query(options: ",(0,t.jsx)(r.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\n // highlight-start\n const [result, fields] = await connection.query({\n sql,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = 20 WHERE `name` = \"Josh\" LIMIT 1';\n\nconnection.query(\n {\n sql,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"result"}),": contains a ",(0,t.jsx)(r.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(r.admonition,{type:"info",children:(0,t.jsxs)(r.p,{children:["The connection used for the query (",(0,t.jsx)(r.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(r.code,{children:"createConnection"}),", ",(0,t.jsx)(r.code,{children:"createPool"})," or ",(0,t.jsx)(r.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h2,{id:"glossary",children:"Glossary"}),"\n",(0,t.jsx)(r.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,t.jsx)(r.h3,{id:"queryoptions-1",children:"QueryOptions"}),"\n",(0,t.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function x(e={}){const{wrapper:r}={...(0,s.a)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(m,{...e})}):m(e)}},5162:(e,r,n)=>{n.d(r,{Z:()=>a});n(7294);var t=n(512);const s={tabItem:"tabItem_Ymn6"};var l=n(5893);function a(e){let{children:r,hidden:n,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,t.Z)(s.tabItem,a),hidden:n,children:r})}},4866:(e,r,n)=>{n.d(r,{Z:()=>v});var t=n(7294),s=n(512),l=n(2466),a=n(6550),o=n(469),i=n(1980),u=n(7392),c=n(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:r}=e;return!!r&&"object"==typeof r&&"value"in r}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:r,children:n}=e;return(0,t.useMemo)((()=>{const e=r??function(e){return d(e).map((e=>{let{props:{value:r,label:n,attributes:t,default:s}}=e;return{value:r,label:n,attributes:t,default:s}}))}(n);return function(e){const r=(0,u.l)(e,((e,r)=>e.value===r.value));if(r.length>0)throw new Error(`Docusaurus error: Duplicate values "${r.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[r,n])}function p(e){let{value:r,tabValues:n}=e;return n.some((e=>e.value===r))}function m(e){let{queryString:r=!1,groupId:n}=e;const s=(0,a.k6)(),l=function(e){let{queryString:r=!1,groupId:n}=e;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:r,groupId:n});return[(0,i._X)(l),(0,t.useCallback)((e=>{if(!l)return;const r=new URLSearchParams(s.location.search);r.set(l,e),s.replace({...s.location,search:r.toString()})}),[l,s])]}function x(e){const{defaultValue:r,queryString:n=!1,groupId:s}=e,l=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:r,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!p({value:r,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${r}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return r}const t=n.find((e=>e.default))??n[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:r,tabValues:l}))),[u,d]=m({queryString:n,groupId:s}),[x,f]=function(e){let{groupId:r}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(r),[s,l]=(0,c.Nk)(n);return[s,(0,t.useCallback)((e=>{n&&l.set(e)}),[n,l])]}({groupId:s}),b=(()=>{const e=u??x;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{b&&i(b)}),[b]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),f(e)}),[d,f,l]),tabValues:l}}var f=n(2389);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=n(5893);function j(e){let{className:r,block:n,selectedValue:t,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:u}=(0,l.o5)(),c=e=>{const r=e.currentTarget,n=i.indexOf(r),s=o[n].value;s!==t&&(u(r),a(s))},d=e=>{let r=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;r=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;r=i[n]??i[i.length-1];break}}r?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},r),children:o.map((e=>{let{value:r,label:n,attributes:l}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:t===r?0:-1,"aria-selected":t===r,ref:e=>i.push(e),onKeyDown:d,onClick:c,...l,className:(0,s.Z)("tabs__item",b.tabItem,l?.className,{"tabs__item--active":t===r}),children:n??r},r)}))})}function q(e){let{lazy:r,children:n,selectedValue:s}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(r){const e=l.find((e=>e.props.value===s));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:l.map(((e,r)=>(0,t.cloneElement)(e,{key:r,hidden:e.props.value!==s})))})}function y(e){const r=x(e);return(0,g.jsxs)("div",{className:(0,s.Z)("tabs-container",b.tabList),children:[(0,g.jsx)(j,{...e,...r}),(0,g.jsx)(q,{...e,...r})]})}function v(e){const r=(0,f.Z)();return(0,g.jsx)(y,{...e,children:d(e.children)},String(r))}},4379:(e,r,n)=>{n.d(r,{I:()=>i});var t=n(7294),s=n(2263),l=n(9286),a=n(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:r,language:n,extractMethod:i,methodType:u}=e;const[c,d]=(0,t.useState)(""),[h,p]=(0,t.useState)(!0),[m,x]=(0,t.useState)(!0),{siteConfig:f}=(0,s.Z)(),b=f.baseUrl.replace(/\/$/,""),g=/^\//.test(r)?`${b}${r}`:r;return(0,t.useEffect)((()=>{const e=new AbortController,r=e.signal;return fetch(g,{signal:r}).then((e=>e.text())).then((e=>{const r=i&&u?((e,r,n)=>{const t=e.split("\n"),s=`${n} ${r}`;let l=!1,a=0,o="";for(const i of t)if(i.includes(s)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,u):e;d(r||e),p(!1),x(!1)})).catch((()=>{x(!0),p(!1)})),()=>{e.abort()}}),[g,i,u]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:m?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:g}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${n}`,children:c})})})}},6393:(e,r,n)=>{n.d(r,{Z:()=>l});var t=n(4673),s=n(5893);const l=e=>{let{children:r,open:n,title:l}=e;return(0,s.jsx)(t.Z,{open:n,className:"faq",summary:(0,s.jsx)("summary",{children:(0,s.jsx)("strong",{children:l})}),children:(0,s.jsx)("section",{children:r})})}}}]);
\ No newline at end of file
diff --git a/assets/js/54eaaaae.09adf8e5.js b/assets/js/54eaaaae.09adf8e5.js
new file mode 100644
index 0000000000..b64ed775f3
--- /dev/null
+++ b/assets/js/54eaaaae.09adf8e5.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1420],{1:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>u,contentTitle:()=>d,default:()=>g,frontMatter:()=>a,metadata:()=>h,toc:()=>p});var s=o(5893),r=o(1151),l=o(4866),t=o(5162),c=o(6393),i=o(4379);const a={sidebar_position:2,tags:["createPool","URI","SHA1","RDS","SSL","Socks"]},d="createPool",h={id:"examples/connections/create-pool",title:"createPool",description:"For queries please see the Simple Queries and Prepared Statements examples.",source:"@site/docs/examples/connections/create-pool.mdx",sourceDirName:"examples/connections",slug:"/examples/connections/create-pool",permalink:"/node-mysql2/docs/examples/connections/create-pool",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/connections/create-pool.mdx",tags:[{label:"createPool",permalink:"/node-mysql2/docs/tags/create-pool"},{label:"URI",permalink:"/node-mysql2/docs/tags/uri"},{label:"SHA1",permalink:"/node-mysql2/docs/tags/sha-1"},{label:"RDS",permalink:"/node-mysql2/docs/tags/rds"},{label:"SSL",permalink:"/node-mysql2/docs/tags/ssl"},{label:"Socks",permalink:"/node-mysql2/docs/tags/socks"}],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,tags:["createPool","URI","SHA1","RDS","SSL","Socks"]},sidebar:"examples",previous:{title:"createConnection",permalink:"/node-mysql2/docs/examples/connections/create-connection"},next:{title:"createPoolCluster",permalink:"/node-mysql2/docs/examples/connections/createPoolCluster"}},u={},p=[{value:"createPool(connectionUri)",id:"createpoolconnectionuri",level:2},{value:"createPool(config)",id:"createpoolconfig",level:2},{value:"createPool(config) \u2014 SHA1",id:"createpoolconfig--sha1",level:2},{value:"createPool(config) \u2014 SSL",id:"createpoolconfig--ssl",level:2},{value:"createPool(config) \u2014 RDS SSL",id:"createpoolconfig--rds-ssl",level:2},{value:"Related Links",id:"related-links",level:3},{value:"createPool(config) \u2014 Socks",id:"createpoolconfig--socks",level:2},{value:"Glossary",id:"glossary",level:2},{value:"PoolOptions",id:"pooloptions",level:3}];function m(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"createpool",children:"createPool"}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["For queries please see the ",(0,s.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,s.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,s.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,s.jsx)(n.strong,{children:"Prepared Statements"})})," examples."]})}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconnectionuri",children:"createPool(connectionUri)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"createPool(connectionUri: string)"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool('mysql://root:password@localhost:3306/test');\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool('mysql://root:password@localhost:3306/test');\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig",children:"createPool(config)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--sha1",children:"createPool(config) \u2014 SHA1"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n // ...\n passwordSha1: Buffer.from(\n '8bb6118f8fd6935ad0876a3be34a717d32708ffd',\n 'hex'\n ),\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n // ...\n passwordSha1: Buffer.from('8bb6118f8fd6935ad0876a3be34a717d32708ffd', 'hex'),\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--ssl",children:"createPool(config) \u2014 SSL"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})}),(0,s.jsxs)(t.Z,{value:"certs/ca-cert.pem",children:[(0,s.jsx)(i.I,{language:"plan",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/test/fixtures/ssl/certs/ca.pem"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["See ",(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/test/fixtures/ssl/certs",children:"ssl/certs"}),"."]}),"\n"]})]})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--rds-ssl",children:"createPool(config) \u2014 RDS SSL"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["You can use ",(0,s.jsx)(n.strong,{children:"Amazon RDS"})," string as value to ssl property to connect to ",(0,s.jsx)(n.strong,{children:"Amazon RDS"})," MySQL over SSL."]}),"\n",(0,s.jsxs)(n.p,{children:["In that case ",(0,s.jsx)(n.a,{href:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem",children:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem"})," CA cert is used:"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(t.Z,{value:"promise.js",default:!0,children:[(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})}),(0,s.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const [res] = await connection.query('SHOW `status` LIKE \"Ssl_cipher\"');\n await pool.end();\n\n console.log(res);\n} catch (err) {\n console.log(err);\n}\n"})})})]}),(0,s.jsxs)(t.Z,{value:"callback.js",children:[(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})}),(0,s.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"connectionquery('SHOW `status` LIKE \"Ssl_cipher\"', function (err, res) {\n pool.end();\n\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(res);\n});\n"})})})]})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)(n.h3,{id:"related-links",children:"Related Links"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Issues"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues/2130",children:"#2130 \u2014 Update TLS certs for Amazon RDS instances"})}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Pull Requests"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2119",children:"#2119 \u2014 fix: make startTls code compatible with Bun"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2131",children:"#2131 \u2014 Update Amazon RDS SSL CA cert"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--socks",children:"createPool(config) \u2014 Socks"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"A.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\nconst socksProxy = new SocksConnection({ port: 3306 });\n// highlight-start\nconst pool = mysql.createPool({\n stream: socksProxy,\n});\n// highlight-end\n"})})}),(0,s.jsx)(t.Z,{value:"B.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\n// highlight-start\nconst pool = mysql.createPool({\n debug: 1,\n stream: function () {\n return new SocksConnection({ port: 3306 });\n },\n});\n// highlight-end\n"})})})]}),"\n",(0,s.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"pool.execute('SELECT SLEEP(1.1) AS `www`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npool.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npool.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n"})})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"pooloptions",children:"PoolOptions"}),"\n",(0,s.jsxs)("blockquote",{children:[(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"PoolOptions"})," extends all options from ",(0,s.jsx)(n.strong,{children:"ConnectionOptions"}),":"]}),(0,s.jsx)(c.Z,{title:"ConnectionOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Connection.d.ts",extractMethod:"ConnectionOptions",methodType:"interface"})})]}),"\n",(0,s.jsx)(c.Z,{title:"PoolOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Pool.d.ts",extractMethod:"PoolOptions",methodType:"interface"})})]})}function g(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(m,{...e})}):m(e)}},5162:(e,n,o)=>{o.d(n,{Z:()=>t});o(7294);var s=o(512);const r={tabItem:"tabItem_Ymn6"};var l=o(5893);function t(e){let{children:n,hidden:o,className:t}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(r.tabItem,t),hidden:o,children:n})}},4866:(e,n,o)=>{o.d(n,{Z:()=>S});var s=o(7294),r=o(512),l=o(2466),t=o(6550),c=o(469),i=o(1980),a=o(7392),d=o(12);function h(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function u(e){const{values:n,children:o}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return h(e).map((e=>{let{props:{value:n,label:o,attributes:s,default:r}}=e;return{value:n,label:o,attributes:s,default:r}}))}(o);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,o])}function p(e){let{value:n,tabValues:o}=e;return o.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:o}=e;const r=(0,t.k6)(),l=function(e){let{queryString:n=!1,groupId:o}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!o)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return o??null}({queryString:n,groupId:o});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function g(e){const{defaultValue:n,queryString:o=!1,groupId:r}=e,l=u(e),[t,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:o}=e;if(0===o.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:o}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${o.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=o.find((e=>e.default))??o[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[a,h]=m({queryString:o,groupId:r}),[g,x]=function(e){let{groupId:n}=e;const o=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,d.Nk)(o);return[r,(0,s.useCallback)((e=>{o&&l.set(e)}),[o,l])]}({groupId:r}),j=(()=>{const e=a??g;return p({value:e,tabValues:l})?e:null})();(0,c.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:t,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),h(e),x(e)}),[h,x,l]),tabValues:l}}var x=o(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=o(5893);function y(e){let{className:n,block:o,selectedValue:s,selectValue:t,tabValues:c}=e;const i=[],{blockElementScrollPositionUntilNextRender:a}=(0,l.o5)(),d=e=>{const n=e.currentTarget,o=i.indexOf(n),r=c[o].value;r!==s&&(a(n),t(r))},h=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const o=i.indexOf(e.currentTarget)+1;n=i[o]??i[0];break}case"ArrowLeft":{const o=i.indexOf(e.currentTarget)-1;n=i[o]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":o},n),children:c.map((e=>{let{value:n,label:o,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:h,onClick:d,...l,className:(0,r.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":s===n}),children:o??n},n)}))})}function b(e){let{lazy:n,children:o,selectedValue:r}=e;const l=(Array.isArray(o)?o:[o]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function q(e){const n=g(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(y,{...e,...n}),(0,f.jsx)(b,{...e,...n})]})}function S(e){const n=(0,x.Z)();return(0,f.jsx)(q,{...e,children:h(e.children)},String(n))}},4379:(e,n,o)=>{o.d(n,{I:()=>i});var s=o(7294),r=o(2263),l=o(9286),t=o(5893);const c=()=>(0,t.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:o,extractMethod:i,methodType:a}=e;const[d,h]=(0,s.useState)(""),[u,p]=(0,s.useState)(!0),[m,g]=(0,s.useState)(!0),{siteConfig:x}=(0,r.Z)(),j=x.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&a?((e,n,o)=>{const s=e.split("\n"),r=`${o} ${n}`;let l=!1,t=0,c="";for(const i of s)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&t++,c+=i+"\n",i.includes("}")&&(t--,0===t)))break;return c.trim()||e})(e,i,a):e;h(n||e),p(!1),g(!1)})).catch((()=>{g(!0),p(!1)})),()=>{e.abort()}}),[f,i,a]),(0,t.jsx)(t.Fragment,{children:u?(0,t.jsx)(c,{}):(0,t.jsx)(t.Fragment,{children:m?(0,t.jsxs)("div",{children:["Unable to access the requested link: ",(0,t.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,t.jsx)(l.Z,{className:`language-${o}`,children:d})})})}},6393:(e,n,o)=>{o.d(n,{Z:()=>l});var s=o(4673),r=o(5893);const l=e=>{let{children:n,open:o,title:l}=e;return(0,r.jsx)(s.Z,{open:o,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/54eaaaae.22d6bdf5.js b/assets/js/54eaaaae.22d6bdf5.js
deleted file mode 100644
index 6798dab7c5..0000000000
--- a/assets/js/54eaaaae.22d6bdf5.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1420],{1:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>u,contentTitle:()=>d,default:()=>g,frontMatter:()=>a,metadata:()=>h,toc:()=>p});var s=o(5893),r=o(1151),l=o(4866),t=o(5162),c=o(6393),i=o(4379);const a={sidebar_position:2,tags:["createPool","URI","SHA1","RDS","SSL","Socks"]},d="createPool",h={id:"examples/connections/create-pool",title:"createPool",description:"For queries please see the Simple Queries and Prepared Statements examples.",source:"@site/docs/examples/connections/create-pool.mdx",sourceDirName:"examples/connections",slug:"/examples/connections/create-pool",permalink:"/node-mysql2/docs/examples/connections/create-pool",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/connections/create-pool.mdx",tags:[{label:"createPool",permalink:"/node-mysql2/docs/tags/create-pool"},{label:"URI",permalink:"/node-mysql2/docs/tags/uri"},{label:"SHA1",permalink:"/node-mysql2/docs/tags/sha-1"},{label:"RDS",permalink:"/node-mysql2/docs/tags/rds"},{label:"SSL",permalink:"/node-mysql2/docs/tags/ssl"},{label:"Socks",permalink:"/node-mysql2/docs/tags/socks"}],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,tags:["createPool","URI","SHA1","RDS","SSL","Socks"]},sidebar:"examples",previous:{title:"createConnection",permalink:"/node-mysql2/docs/examples/connections/create-connection"},next:{title:"createPoolCluster",permalink:"/node-mysql2/docs/examples/connections/createPoolCluster"}},u={},p=[{value:"createPool(connectionUri)",id:"createpoolconnectionuri",level:2},{value:"createPool(config)",id:"createpoolconfig",level:2},{value:"createPool(config) \u2014 SHA1",id:"createpoolconfig--sha1",level:2},{value:"createPool(config) \u2014 SSL",id:"createpoolconfig--ssl",level:2},{value:"createPool(config) \u2014 RDS SSL",id:"createpoolconfig--rds-ssl",level:2},{value:"Related Links",id:"related-links",level:3},{value:"createPool(config) \u2014 Socks",id:"createpoolconfig--socks",level:2},{value:"Glossary",id:"glossary",level:2},{value:"PoolOptions",id:"pooloptions",level:3}];function m(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"createpool",children:"createPool"}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["For queries please see the ",(0,s.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,s.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,s.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,s.jsx)(n.strong,{children:"Prepared Statements"})})," examples."]})}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconnectionuri",children:"createPool(connectionUri)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"createPool(connectionUri: string)"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool('mysql://root:password@localhost:3306/test');\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool('mysql://root:password@localhost:3306/test');\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig",children:"createPool(config)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--sha1",children:"createPool(config) \u2014 SHA1"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n // ...\n passwordSha1: Buffer.from(\n '8bb6118f8fd6935ad0876a3be34a717d32708ffd',\n 'hex'\n ),\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n // ...\n passwordSha1: Buffer.from('8bb6118f8fd6935ad0876a3be34a717d32708ffd', 'hex'),\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--ssl",children:"createPool(config) \u2014 SSL"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(t.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})}),(0,s.jsxs)(t.Z,{value:"certs/ca-cert.pem",children:[(0,s.jsx)(i.I,{language:"plan",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/test/fixtures/ssl/certs/ca.pem"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["See ",(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/test/fixtures/ssl/certs",children:"ssl/certs"}),"."]}),"\n"]})]})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--rds-ssl",children:"createPool(config) \u2014 RDS SSL"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["You can use ",(0,s.jsx)(n.strong,{children:"Amazon RDS"})," string as value to ssl property to connect to ",(0,s.jsx)(n.strong,{children:"Amazon RDS"})," MySQL over SSL."]}),"\n",(0,s.jsxs)(n.p,{children:["In that case ",(0,s.jsx)(n.a,{href:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem",children:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem"})," CA cert is used:"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(t.Z,{value:"promise.js",default:!0,children:[(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const pool = mysql.createPool({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n });\n const connection = await pool.getConnection();\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})}),(0,s.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const [res] = await connection.query('SHOW `status` LIKE \"Ssl_cipher\"');\n await pool.end();\n\n console.log(res);\n} catch (err) {\n console.log(err);\n}\n"})})})]}),(0,s.jsxs)(t.Z,{value:"callback.js",children:[(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n});\n\npool.getConnection(function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})}),(0,s.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"connectionquery('SHOW `status` LIKE \"Ssl_cipher\"', function (err, res) {\n pool.end();\n\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(res);\n});\n"})})})]})]}),"\n",(0,s.jsxs)(n.admonition,{type:"warning",children:[(0,s.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"pool.releaseConnection(connection)"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,s.jsx)(n.h3,{id:"related-links",children:"Related Links"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Issues"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues/2130",children:"#2130 \u2014 Update TLS certs for Amazon RDS instances"})}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Pull Requests"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2119",children:"#2119 \u2014 fix: make startTls code compatible with Bun"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2131",children:"#2131 \u2014 Update Amazon RDS SSL CA cert"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"createpoolconfig--socks",children:"createPool(config) \u2014 Socks"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["createPool(config: ",(0,s.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(t.Z,{value:"A.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\nconst socksProxy = new SocksConnection({ port: 3306 });\n// highlight-start\nconst pool = mysql.createPool({\n stream: socksProxy,\n});\n// highlight-end\n"})})}),(0,s.jsx)(t.Z,{value:"B.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\n// highlight-start\nconst pool = mysql.createPool({\n debug: 1,\n stream: function () {\n return new SocksConnection({ port: 3306 });\n },\n});\n// highlight-end\n"})})})]}),"\n",(0,s.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"pool.execute('SELECT SLEEP(1.1) AS `www`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npool.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npool.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n"})})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"pooloptions",children:"PoolOptions"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"PoolOptions"})," extends all options from ",(0,s.jsx)(n.strong,{children:"ConnectionOptions"}),":"]}),"\n",(0,s.jsx)(c.Z,{title:"ConnectionOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Connection.d.ts",extractMethod:"ConnectionOptions",methodType:"interface"})}),"\n"]}),"\n",(0,s.jsx)(c.Z,{title:"PoolOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Pool.d.ts",extractMethod:"PoolOptions",methodType:"interface"})})]})}function g(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(m,{...e})}):m(e)}},5162:(e,n,o)=>{o.d(n,{Z:()=>t});o(7294);var s=o(512);const r={tabItem:"tabItem_Ymn6"};var l=o(5893);function t(e){let{children:n,hidden:o,className:t}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(r.tabItem,t),hidden:o,children:n})}},4866:(e,n,o)=>{o.d(n,{Z:()=>S});var s=o(7294),r=o(512),l=o(2466),t=o(6550),c=o(469),i=o(1980),a=o(7392),d=o(12);function h(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function u(e){const{values:n,children:o}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return h(e).map((e=>{let{props:{value:n,label:o,attributes:s,default:r}}=e;return{value:n,label:o,attributes:s,default:r}}))}(o);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,o])}function p(e){let{value:n,tabValues:o}=e;return o.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:o}=e;const r=(0,t.k6)(),l=function(e){let{queryString:n=!1,groupId:o}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!o)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return o??null}({queryString:n,groupId:o});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function g(e){const{defaultValue:n,queryString:o=!1,groupId:r}=e,l=u(e),[t,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:o}=e;if(0===o.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:o}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${o.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=o.find((e=>e.default))??o[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[a,h]=m({queryString:o,groupId:r}),[g,x]=function(e){let{groupId:n}=e;const o=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,d.Nk)(o);return[r,(0,s.useCallback)((e=>{o&&l.set(e)}),[o,l])]}({groupId:r}),j=(()=>{const e=a??g;return p({value:e,tabValues:l})?e:null})();(0,c.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:t,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),h(e),x(e)}),[h,x,l]),tabValues:l}}var x=o(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=o(5893);function y(e){let{className:n,block:o,selectedValue:s,selectValue:t,tabValues:c}=e;const i=[],{blockElementScrollPositionUntilNextRender:a}=(0,l.o5)(),d=e=>{const n=e.currentTarget,o=i.indexOf(n),r=c[o].value;r!==s&&(a(n),t(r))},h=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const o=i.indexOf(e.currentTarget)+1;n=i[o]??i[0];break}case"ArrowLeft":{const o=i.indexOf(e.currentTarget)-1;n=i[o]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":o},n),children:c.map((e=>{let{value:n,label:o,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:h,onClick:d,...l,className:(0,r.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":s===n}),children:o??n},n)}))})}function b(e){let{lazy:n,children:o,selectedValue:r}=e;const l=(Array.isArray(o)?o:[o]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function q(e){const n=g(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(y,{...e,...n}),(0,f.jsx)(b,{...e,...n})]})}function S(e){const n=(0,x.Z)();return(0,f.jsx)(q,{...e,children:h(e.children)},String(n))}},4379:(e,n,o)=>{o.d(n,{I:()=>i});var s=o(7294),r=o(2263),l=o(9286),t=o(5893);const c=()=>(0,t.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:o,extractMethod:i,methodType:a}=e;const[d,h]=(0,s.useState)(""),[u,p]=(0,s.useState)(!0),[m,g]=(0,s.useState)(!0),{siteConfig:x}=(0,r.Z)(),j=x.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&a?((e,n,o)=>{const s=e.split("\n"),r=`${o} ${n}`;let l=!1,t=0,c="";for(const i of s)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&t++,c+=i+"\n",i.includes("}")&&(t--,0===t)))break;return c.trim()||e})(e,i,a):e;h(n||e),p(!1),g(!1)})).catch((()=>{g(!0),p(!1)})),()=>{e.abort()}}),[f,i,a]),(0,t.jsx)(t.Fragment,{children:u?(0,t.jsx)(c,{}):(0,t.jsx)(t.Fragment,{children:m?(0,t.jsxs)("div",{children:["Unable to access the requested link: ",(0,t.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,t.jsx)(l.Z,{className:`language-${o}`,children:d})})})}},6393:(e,n,o)=>{o.d(n,{Z:()=>l});var s=o(4673),r=o(5893);const l=e=>{let{children:n,open:o,title:l}=e;return(0,r.jsx)(s.Z,{open:o,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/57495183.a3a923b6.js b/assets/js/57495183.a3a923b6.js
new file mode 100644
index 0000000000..d6ae0272f6
--- /dev/null
+++ b/assets/js/57495183.a3a923b6.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5003],{4304:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>t,metadata:()=>c,toc:()=>o});var r=s(5893),i=s(1151);const t={},l="MySQL Server API",c={id:"documentation/mysql-server",title:"MySQL Server API",description:"Server",source:"@site/docs/documentation/mysql-server.mdx",sourceDirName:"documentation",slug:"/documentation/mysql-server",permalink:"/node-mysql2/docs/documentation/mysql-server",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/documentation/mysql-server.mdx",tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"Extra Features",permalink:"/node-mysql2/docs/documentation/extras"},next:{title:"Prepared Statements",permalink:"/node-mysql2/docs/documentation/prepared-statements"}},d={},o=[{value:"Server",id:"server",level:2},{value:"Events",id:"events",level:3},{value:"Connection",id:"connection",level:2},{value:"Events",id:"events-1",level:3}];function a(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"mysql-server-api",children:"MySQL Server API"}),"\n",(0,r.jsx)(n.h2,{id:"server",children:"Server"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"createServer()"})," - creates server instance"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Server.listen"})," - listen port / unix socket (same arguments as ",(0,r.jsx)(n.a,{href:"https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback",children:"net.Server.listen"}),")"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"events",children:"Events"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"connect"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"new incoming connection."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"connection",children:"Connection"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"serverHandshake({ serverVersion, protocolVersion, connectionId, statusFlags, characterSet, capabilityFlags })"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"send server handshake initialisation packet, wait handshake response and start listening for commands"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeOk({ affectedRows: num, insertId: num })"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["send ",(0,r.jsx)(n.a,{href:"https://dev.mysql.com/doc/internals/en/overview.html#packet-OK_Packet",children:"OK packet"})," to client"]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeEof(warnings, statusFlags)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"send EOF packet"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeTextResult(rows, fields)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["write query result to client. Rows and fields are in the same format as in ",(0,r.jsx)(n.code,{children:"connection.query"})," callback."]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeColumns(fields)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"write fields + EOF packets."}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeTextRow(row)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"write array (not hash!) of values as result row"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"TODO:"})," binary protocol"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"events-1",children:"Events"}),"\n",(0,r.jsxs)(n.p,{children:["Every command packet received by the server will be emitted as a ",(0,r.jsx)(n.strong,{children:"packet"})," event with the parameters:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"packet:"})," Packet","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"The packet itself"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"knownCommand:"})," boolean","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"is this command known to the server"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"*commandCode:"})," number","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"the parsed command code (first byte)"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["In addition special events are emitted for ",(0,r.jsx)(n.a,{href:"https://dev.mysql.com/doc/internals/en/text-protocol.html",children:"commands"})," received from the client. If no listener is present a fallback behavior will be invoked."]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"quit()"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Default: close the connection"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"init_db(schemaName: string)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Default: return OK"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"query(sql: string)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Please attach a listener to this. Default: return HA_ERR_INTERNAL_ERROR"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"field_list(table: string, fields: string)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Default: return ER_WARN_DEPRECATED_SYNTAX"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"ping()"})," - Default: return OK"]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},1151:(e,n,s)=>{s.d(n,{Z:()=>c,a:()=>l});var r=s(7294);const i={},t=r.createContext(i);function l(e){const n=r.useContext(t);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),r.createElement(t.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/57495183.d7fc7e0f.js b/assets/js/57495183.d7fc7e0f.js
deleted file mode 100644
index 711601395d..0000000000
--- a/assets/js/57495183.d7fc7e0f.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5003],{4304:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>t,metadata:()=>c,toc:()=>o});var r=s(5893),i=s(1151);const t={},l="MySQL Server API",c={id:"documentation/mysql-server",title:"MySQL Server API",description:"Server",source:"@site/docs/documentation/mysql-server.mdx",sourceDirName:"documentation",slug:"/documentation/mysql-server",permalink:"/node-mysql2/docs/documentation/mysql-server",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/documentation/mysql-server.mdx",tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"Extra Features",permalink:"/node-mysql2/docs/documentation/extras"},next:{title:"Prepared Statements",permalink:"/node-mysql2/docs/documentation/prepared-statements"}},d={},o=[{value:"Server",id:"server",level:2},{value:"Events",id:"events",level:3},{value:"Connection",id:"connection",level:2},{value:"Events",id:"events-1",level:3}];function a(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"mysql-server-api",children:"MySQL Server API"}),"\n",(0,r.jsx)(n.h2,{id:"server",children:"Server"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"createServer()"})," - creates server instance"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Server.listen"})," - listen port / unix socket (same arguments as ",(0,r.jsx)(n.a,{href:"https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback",children:"net.Server.listen"}),")"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"events",children:"Events"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"connect"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"new incoming connection."}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"connection",children:"Connection"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"serverHandshake({ serverVersion, protocolVersion, connectionId, statusFlags, characterSet, capabilityFlags })"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"send server handshake initialisation packet, wait handshake response and start listening for commands"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeOk({ affectedRows: num, insertId: num })"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["send ",(0,r.jsx)(n.a,{href:"https://dev.mysql.com/doc/internals/en/overview.html#packet-OK_Packet",children:"OK packet"})," to client"]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeEof(warnings, statusFlags)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"send EOF packet"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeTextResult(rows, fields)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["write query result to client. Rows and fields are in the same format as in ",(0,r.jsx)(n.code,{children:"connection.query"})," callback."]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeColumns(fields)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"write fields + EOF packets."}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"writeTextRow(row)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"write array (not hash!) of values as result row"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"TODO:"})," binary protocol"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"events-1",children:"Events"}),"\n",(0,r.jsxs)(n.p,{children:["Every command packet received by the server will be emitted as a ",(0,r.jsx)(n.strong,{children:"packet"})," event with the parameters:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"packet:"})," Packet","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"The packet itself"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"knownCommand:"})," boolean","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"is this command known to the server"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"*commandCode:"})," number","\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"the parsed command code (first byte)"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["In addition special events are emitted for ",(0,r.jsx)(n.a,{href:"https://dev.mysql.com/doc/internals/en/text-protocol.html",children:"commands"})," received from the client. If no listener is present a fallback behavior will be invoked."]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"quit()"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Default: close the connection"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"init_db(schemaName: string)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Default: return OK"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"query(sql: string)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Please attach a listener to this. Default: return HA_ERR_INTERNAL_ERROR"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"field_list(table: string, fields: string)"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Default: return ER_WARN_DEPRECATED_SYNTAX"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"ping()"})," - Default: return OK"]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},1151:(e,n,s)=>{s.d(n,{Z:()=>c,a:()=>l});var r=s(7294);const i={},t=r.createContext(i);function l(e){const n=r.useContext(t);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),r.createElement(t.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/59e52bc2.2b8c3e3c.js b/assets/js/59e52bc2.2b8c3e3c.js
deleted file mode 100644
index dbcc2dc863..0000000000
--- a/assets/js/59e52bc2.2b8c3e3c.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[641],{8602:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>h,contentTitle:()=>u,default:()=>x,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var t=n(5893),s=n(1151),l=n(4866),a=n(5162),o=n(6393),i=n(4379);const c={sidebar_position:3,tags:["query"]},u="DELETE",d={id:"examples/queries/simple-queries/delete",title:"DELETE",description:"The examples below also work for the execute method.",source:"@site/docs/examples/queries/simple-queries/delete.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/delete",permalink:"/node-mysql2/docs/examples/queries/simple-queries/delete",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/delete.mdx",tags:[{label:"query",permalink:"/node-mysql2/docs/tags/query"}],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,tags:["query"]},sidebar:"examples",previous:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/update"},next:{title:"Prepared Statements",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/"}},h={},p=[{value:"query(sql)",id:"querysql",level:2},{value:"query(options)",id:"queryoptions",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions-1",level:3}];function m(e){const r={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h1,{id:"delete",children:"DELETE"}),"\n",(0,t.jsxs)(r.p,{children:["The examples below also work for the ",(0,t.jsx)(r.a,{href:"/docs/examples/queries/prepared-statements/delete",children:(0,t.jsx)(r.code,{children:"execute"})})," method."]}),"\n",(0,t.jsx)(r.h2,{id:"querysql",children:"query(sql)"}),"\n",(0,t.jsxs)(r.blockquote,{children:["\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"query(sql: string)"})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\n // highlight-next-line\n const [result, fields] = await connection.query(sql);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\nconnection.query(sql, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"result"}),": contains a ",(0,t.jsx)(r.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(r.admonition,{type:"info",children:(0,t.jsxs)(r.p,{children:["The connection used for the query (",(0,t.jsx)(r.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(r.code,{children:"createConnection"}),", ",(0,t.jsx)(r.code,{children:"createPool"})," or ",(0,t.jsx)(r.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h2,{id:"queryoptions",children:"query(options)"}),"\n",(0,t.jsxs)(r.blockquote,{children:["\n",(0,t.jsx)(r.p,{children:(0,t.jsxs)(r.strong,{children:["query(options: ",(0,t.jsx)(r.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\n // highlight-start\n const [result, fields] = await connection.query({\n sql,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\nconnection.query(\n {\n sql,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"result"}),": contains a ",(0,t.jsx)(r.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(r.admonition,{type:"info",children:(0,t.jsxs)(r.p,{children:["The connection used for the query (",(0,t.jsx)(r.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(r.code,{children:"createConnection"}),", ",(0,t.jsx)(r.code,{children:"createPool"})," or ",(0,t.jsx)(r.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h2,{id:"glossary",children:"Glossary"}),"\n",(0,t.jsx)(r.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,t.jsx)(r.h3,{id:"queryoptions-1",children:"QueryOptions"}),"\n",(0,t.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function x(e={}){const{wrapper:r}={...(0,s.a)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(m,{...e})}):m(e)}},5162:(e,r,n)=>{n.d(r,{Z:()=>a});n(7294);var t=n(512);const s={tabItem:"tabItem_Ymn6"};var l=n(5893);function a(e){let{children:r,hidden:n,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,t.Z)(s.tabItem,a),hidden:n,children:r})}},4866:(e,r,n)=>{n.d(r,{Z:()=>v});var t=n(7294),s=n(512),l=n(2466),a=n(6550),o=n(469),i=n(1980),c=n(7392),u=n(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:r}=e;return!!r&&"object"==typeof r&&"value"in r}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:r,children:n}=e;return(0,t.useMemo)((()=>{const e=r??function(e){return d(e).map((e=>{let{props:{value:r,label:n,attributes:t,default:s}}=e;return{value:r,label:n,attributes:t,default:s}}))}(n);return function(e){const r=(0,c.l)(e,((e,r)=>e.value===r.value));if(r.length>0)throw new Error(`Docusaurus error: Duplicate values "${r.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[r,n])}function p(e){let{value:r,tabValues:n}=e;return n.some((e=>e.value===r))}function m(e){let{queryString:r=!1,groupId:n}=e;const s=(0,a.k6)(),l=function(e){let{queryString:r=!1,groupId:n}=e;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:r,groupId:n});return[(0,i._X)(l),(0,t.useCallback)((e=>{if(!l)return;const r=new URLSearchParams(s.location.search);r.set(l,e),s.replace({...s.location,search:r.toString()})}),[l,s])]}function x(e){const{defaultValue:r,queryString:n=!1,groupId:s}=e,l=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:r,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!p({value:r,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${r}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return r}const t=n.find((e=>e.default))??n[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:r,tabValues:l}))),[c,d]=m({queryString:n,groupId:s}),[x,f]=function(e){let{groupId:r}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(r),[s,l]=(0,u.Nk)(n);return[s,(0,t.useCallback)((e=>{n&&l.set(e)}),[n,l])]}({groupId:s}),b=(()=>{const e=c??x;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{b&&i(b)}),[b]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),f(e)}),[d,f,l]),tabValues:l}}var f=n(2389);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=n(5893);function j(e){let{className:r,block:n,selectedValue:t,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const r=e.currentTarget,n=i.indexOf(r),s=o[n].value;s!==t&&(c(r),a(s))},d=e=>{let r=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=i.indexOf(e.currentTarget)+1;r=i[n]??i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;r=i[n]??i[i.length-1];break}}r?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},r),children:o.map((e=>{let{value:r,label:n,attributes:l}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:t===r?0:-1,"aria-selected":t===r,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,s.Z)("tabs__item",b.tabItem,l?.className,{"tabs__item--active":t===r}),children:n??r},r)}))})}function y(e){let{lazy:r,children:n,selectedValue:s}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(r){const e=l.find((e=>e.props.value===s));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:l.map(((e,r)=>(0,t.cloneElement)(e,{key:r,hidden:e.props.value!==s})))})}function q(e){const r=x(e);return(0,g.jsxs)("div",{className:(0,s.Z)("tabs-container",b.tabList),children:[(0,g.jsx)(j,{...e,...r}),(0,g.jsx)(y,{...e,...r})]})}function v(e){const r=(0,f.Z)();return(0,g.jsx)(q,{...e,children:d(e.children)},String(r))}},4379:(e,r,n)=>{n.d(r,{I:()=>i});var t=n(7294),s=n(2263),l=n(9286),a=n(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:r,language:n,extractMethod:i,methodType:c}=e;const[u,d]=(0,t.useState)(""),[h,p]=(0,t.useState)(!0),[m,x]=(0,t.useState)(!0),{siteConfig:f}=(0,s.Z)(),b=f.baseUrl.replace(/\/$/,""),g=/^\//.test(r)?`${b}${r}`:r;return(0,t.useEffect)((()=>{const e=new AbortController,r=e.signal;return fetch(g,{signal:r}).then((e=>e.text())).then((e=>{const r=i&&c?((e,r,n)=>{const t=e.split("\n"),s=`${n} ${r}`;let l=!1,a=0,o="";for(const i of t)if(i.includes(s)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(r||e),p(!1),x(!1)})).catch((()=>{x(!0),p(!1)})),()=>{e.abort()}}),[g,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:m?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:g}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${n}`,children:u})})})}},6393:(e,r,n)=>{n.d(r,{Z:()=>l});var t=n(4673),s=n(5893);const l=e=>{let{children:r,open:n,title:l}=e;return(0,s.jsx)(t.Z,{open:n,className:"faq",summary:(0,s.jsx)("summary",{children:(0,s.jsx)("strong",{children:l})}),children:(0,s.jsx)("section",{children:r})})}}}]);
\ No newline at end of file
diff --git a/assets/js/59e52bc2.58047b61.js b/assets/js/59e52bc2.58047b61.js
new file mode 100644
index 0000000000..b52988890b
--- /dev/null
+++ b/assets/js/59e52bc2.58047b61.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[641],{8602:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>x,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var t=r(5893),s=r(1151),l=r(4866),a=r(5162),o=r(6393),i=r(4379);const c={sidebar_position:3,tags:["query"]},u="DELETE",d={id:"examples/queries/simple-queries/delete",title:"DELETE",description:"The examples below also work for the execute method.",source:"@site/docs/examples/queries/simple-queries/delete.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/delete",permalink:"/node-mysql2/docs/examples/queries/simple-queries/delete",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/delete.mdx",tags:[{label:"query",permalink:"/node-mysql2/docs/tags/query"}],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,tags:["query"]},sidebar:"examples",previous:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/update"},next:{title:"Prepared Statements",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/"}},h={},p=[{value:"query(sql)",id:"querysql",level:2},{value:"query(options)",id:"queryoptions",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions-1",level:3}];function m(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"delete",children:"DELETE"}),"\n",(0,t.jsxs)(n.p,{children:["The examples below also work for the ",(0,t.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements/delete",children:(0,t.jsx)(n.code,{children:"execute"})})," method."]}),"\n",(0,t.jsx)(n.h2,{id:"querysql",children:"query(sql)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"query(sql: string)"})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\n // highlight-next-line\n const [result, fields] = await connection.query(sql);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\nconnection.query(sql, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"queryoptions",children:"query(options)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["query(options: ",(0,t.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\n // highlight-start\n const [result, fields] = await connection.query({\n sql,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = \"Page\" LIMIT 1';\n\nconnection.query(\n {\n sql,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,t.jsx)(n.h3,{id:"queryoptions-1",children:"QueryOptions"}),"\n",(0,t.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function x(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(m,{...e})}):m(e)}},5162:(e,n,r)=>{r.d(n,{Z:()=>a});r(7294);var t=r(512);const s={tabItem:"tabItem_Ymn6"};var l=r(5893);function a(e){let{children:n,hidden:r,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,t.Z)(s.tabItem,a),hidden:r,children:n})}},4866:(e,n,r)=>{r.d(n,{Z:()=>v});var t=r(7294),s=r(512),l=r(2466),a=r(6550),o=r(469),i=r(1980),c=r(7392),u=r(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:r}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:r,attributes:t,default:s}}=e;return{value:n,label:r,attributes:t,default:s}}))}(r);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,r])}function p(e){let{value:n,tabValues:r}=e;return r.some((e=>e.value===n))}function m(e){let{queryString:n=!1,groupId:r}=e;const s=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:r}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:n,groupId:r});return[(0,i._X)(l),(0,t.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(s.location.search);n.set(l,e),s.replace({...s.location,search:n.toString()})}),[l,s])]}function x(e){const{defaultValue:n,queryString:r=!1,groupId:s}=e,l=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:r}=e;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:r}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${r.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=r.find((e=>e.default))??r[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:l}))),[c,d]=m({queryString:r,groupId:s}),[x,f]=function(e){let{groupId:n}=e;const r=function(e){return e?`docusaurus.tab.${e}`:null}(n),[s,l]=(0,u.Nk)(r);return[s,(0,t.useCallback)((e=>{r&&l.set(e)}),[r,l])]}({groupId:s}),b=(()=>{const e=c??x;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{b&&i(b)}),[b]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),f(e)}),[d,f,l]),tabValues:l}}var f=r(2389);const b={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var g=r(5893);function j(e){let{className:n,block:r,selectedValue:t,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,r=i.indexOf(n),s=o[r].value;s!==t&&(c(n),a(s))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const r=i.indexOf(e.currentTarget)+1;n=i[r]??i[0];break}case"ArrowLeft":{const r=i.indexOf(e.currentTarget)-1;n=i[r]??i[i.length-1];break}}n?.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":r},n),children:o.map((e=>{let{value:n,label:r,attributes:l}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,s.Z)("tabs__item",b.tabItem,l?.className,{"tabs__item--active":t===n}),children:r??n},n)}))})}function y(e){let{lazy:n,children:r,selectedValue:s}=e;const l=(Array.isArray(r)?r:[r]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===s));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==s})))})}function q(e){const n=x(e);return(0,g.jsxs)("div",{className:(0,s.Z)("tabs-container",b.tabList),children:[(0,g.jsx)(j,{...e,...n}),(0,g.jsx)(y,{...e,...n})]})}function v(e){const n=(0,f.Z)();return(0,g.jsx)(q,{...e,children:d(e.children)},String(n))}},4379:(e,n,r)=>{r.d(n,{I:()=>i});var t=r(7294),s=r(2263),l=r(9286),a=r(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:r,extractMethod:i,methodType:c}=e;const[u,d]=(0,t.useState)(""),[h,p]=(0,t.useState)(!0),[m,x]=(0,t.useState)(!0),{siteConfig:f}=(0,s.Z)(),b=f.baseUrl.replace(/\/$/,""),g=/^\//.test(n)?`${b}${n}`:n;return(0,t.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(g,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,r)=>{const t=e.split("\n"),s=`${r} ${n}`;let l=!1,a=0,o="";for(const i of t)if(i.includes(s)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(n||e),p(!1),x(!1)})).catch((()=>{x(!0),p(!1)})),()=>{e.abort()}}),[g,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:m?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:g}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${r}`,children:u})})})}},6393:(e,n,r)=>{r.d(n,{Z:()=>l});var t=r(4673),s=r(5893);const l=e=>{let{children:n,open:r,title:l}=e;return(0,s.jsx)(t.Z,{open:r,className:"faq",summary:(0,s.jsx)("summary",{children:(0,s.jsx)("strong",{children:l})}),children:(0,s.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/7ccab252.53d7e12b.js b/assets/js/7ccab252.53d7e12b.js
deleted file mode 100644
index 083a7a7911..0000000000
--- a/assets/js/7ccab252.53d7e12b.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8054],{3467:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>c,contentTitle:()=>i,default:()=>o,frontMatter:()=>a,metadata:()=>d,toc:()=>l});var n=t(5893),r=t(1151);const a={},i="Prepared Statements",d={id:"examples/queries/prepared-statements/index",title:"Prepared Statements",description:"MySQL2 provides execute helper which will prepare and query the statement.",source:"@site/docs/examples/queries/prepared-statements/index.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/index.mdx",tags:[],version:"current",frontMatter:{},sidebar:"examples",previous:{title:"DELETE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/delete"},next:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/insert"}},c={},l=[];function p(e){const s={a:"a",admonition:"admonition",code:"code",h1:"h1",hr:"hr",input:"input",li:"li",p:"p",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.h1,{id:"prepared-statements",children:"Prepared Statements"}),"\n",(0,n.jsxs)(s.p,{children:["MySQL2 provides ",(0,n.jsx)(s.code,{children:"execute"})," helper which will prepare and query the statement.\nYou can also manually prepare / unprepare statement with ",(0,n.jsx)(s.code,{children:"prepare"})," / ",(0,n.jsx)(s.code,{children:"unprepare"})," methods."]}),"\n",(0,n.jsxs)(s.p,{children:["See detailed documentaion in ",(0,n.jsx)(s.a,{href:"/docs/documentation/prepared-statements",children:"Prepared Statements"}),"."]}),"\n",(0,n.jsx)(s.admonition,{type:"tip",children:(0,n.jsxs)(s.p,{children:["If you execute same statement again, it will be picked form a ",(0,n.jsx)(s.strong,{children:"LRU cache"})," which will save query preparation time and give better performance."]})}),"\n",(0,n.jsx)(s.hr,{}),"\n",(0,n.jsx)(s.p,{children:"Usage examples:"}),"\n",(0,n.jsxs)(s.ul,{className:"contains-task-list",children:["\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/insert",children:(0,n.jsx)(s.strong,{children:"INSERT"})})]}),"\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/select",children:(0,n.jsx)(s.strong,{children:"SELECT"})})]}),"\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/update",children:(0,n.jsx)(s.strong,{children:"UPDATE"})})]}),"\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/delete",children:(0,n.jsx)(s.strong,{children:"DELETE"})})]}),"\n"]})]})}function o(e={}){const{wrapper:s}={...(0,r.a)(),...e.components};return s?(0,n.jsx)(s,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},1151:(e,s,t)=>{t.d(s,{Z:()=>d,a:()=>i});var n=t(7294);const r={},a=n.createContext(r);function i(e){const s=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function d(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(a.Provider,{value:s},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/7ccab252.f82d2892.js b/assets/js/7ccab252.f82d2892.js
new file mode 100644
index 0000000000..595b85c081
--- /dev/null
+++ b/assets/js/7ccab252.f82d2892.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8054],{3467:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>c,contentTitle:()=>i,default:()=>o,frontMatter:()=>a,metadata:()=>d,toc:()=>l});var n=t(5893),r=t(1151);const a={},i="Prepared Statements",d={id:"examples/queries/prepared-statements/index",title:"Prepared Statements",description:"MySQL2 provides execute helper which will prepare and query the statement.",source:"@site/docs/examples/queries/prepared-statements/index.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/index.mdx",tags:[],version:"current",frontMatter:{},sidebar:"examples",previous:{title:"DELETE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/delete"},next:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/insert"}},c={},l=[];function p(e){const s={a:"a",admonition:"admonition",code:"code",h1:"h1",input:"input",li:"li",p:"p",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.h1,{id:"prepared-statements",children:"Prepared Statements"}),"\n",(0,n.jsxs)(s.p,{children:["MySQL2 provides ",(0,n.jsx)(s.code,{children:"execute"})," helper which will prepare and query the statement.\nYou can also manually prepare / unprepare statement with ",(0,n.jsx)(s.code,{children:"prepare"})," / ",(0,n.jsx)(s.code,{children:"unprepare"})," methods."]}),"\n",(0,n.jsxs)(s.p,{children:["See detailed documentaion in ",(0,n.jsx)(s.a,{href:"/docs/documentation/prepared-statements",children:"Prepared Statements"}),"."]}),"\n",(0,n.jsx)(s.admonition,{type:"tip",children:(0,n.jsxs)(s.p,{children:["If you execute same statement again, it will be picked form a ",(0,n.jsx)(s.strong,{children:"LRU cache"})," which will save query preparation time and give better performance."]})}),"\n",(0,n.jsx)("hr",{}),"\n",(0,n.jsx)(s.p,{children:"Usage examples:"}),"\n",(0,n.jsxs)(s.ul,{className:"contains-task-list",children:["\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/insert",children:(0,n.jsx)(s.strong,{children:"INSERT"})})]}),"\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/select",children:(0,n.jsx)(s.strong,{children:"SELECT"})})]}),"\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/update",children:(0,n.jsx)(s.strong,{children:"UPDATE"})})]}),"\n",(0,n.jsxs)(s.li,{className:"task-list-item",children:[(0,n.jsx)(s.input,{type:"checkbox",checked:!0,disabled:!0})," ",(0,n.jsx)(s.a,{href:"/docs/examples/queries/prepared-statements/delete",children:(0,n.jsx)(s.strong,{children:"DELETE"})})]}),"\n"]})]})}function o(e={}){const{wrapper:s}={...(0,r.a)(),...e.components};return s?(0,n.jsx)(s,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},1151:(e,s,t)=>{t.d(s,{Z:()=>d,a:()=>i});var n=t(7294);const r={},a=n.createContext(r);function i(e){const s=n.useContext(a);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function d(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(a.Provider,{value:s},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/7fbd6b3a.80d8bb64.js b/assets/js/7fbd6b3a.80d8bb64.js
new file mode 100644
index 0000000000..b111f2d015
--- /dev/null
+++ b/assets/js/7fbd6b3a.80d8bb64.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9964],{8937:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>p});var r=s(5893),t=s(1151),l=s(4866),a=s(5162),o=s(6393),c=s(4379);const i={sidebar_position:1,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="SELECT",d={id:"examples/queries/prepared-statements/select",title:"SELECT",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/select.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/select",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/select",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/select.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/insert"},next:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/update"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"select",children:"SELECT"}),"\n",(0,r.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\n const values = ['Page', 45];\n\n // highlight-next-line\n const [rows, fields] = await connection.execute(sql, values);\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(a.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\nconst values = ['Page', 45];\n\nconnection.execute(sql, values, (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n});\n"})})})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["The connection used for the query (",(0,r.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,r.jsx)(n.code,{children:"createConnection"}),", ",(0,r.jsx)(n.code,{children:"createPool"})," or ",(0,r.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["execute(options: ",(0,r.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\n const values = ['Page', 45];\n\n // highlight-start\n const [rows, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(a.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\nconst values = ['Page', 45];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["The connection used for the query (",(0,r.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,r.jsx)(n.code,{children:"createConnection"}),", ",(0,r.jsx)(n.code,{children:"createPool"})," or ",(0,r.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["execute(options: ",(0,r.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\n const values = ['Page', 45];\n\n // highlight-start\n const [rows, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(a.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\nconst values = ['Page', 45];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["The connection used for the query (",(0,r.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,r.jsx)(n.code,{children:"createConnection"}),", ",(0,r.jsx)(n.code,{children:"createPool"})," or ",(0,r.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,r.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,r.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,r.jsx)(c.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(x,{...e})}):x(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>a});s(7294);var r=s(512);const t={tabItem:"tabItem_Ymn6"};var l=s(5893);function a(e){let{children:n,hidden:s,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,r.Z)(t.tabItem,a),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>q});var r=s(7294),t=s(512),l=s(2466),a=s(6550),o=s(469),c=s(1980),i=s(7392),u=s(12);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:r,default:t}}=e;return{value:n,label:s,attributes:r,default:t}}))}(s);return function(e){const n=(0,i.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function p(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:s}=e;const t=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,c._X)(l),(0,r.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(t.location.search);n.set(l,e),t.replace({...t.location,search:n.toString()})}),[l,t])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:t}=e,l=h(e),[a,c]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=s.find((e=>e.default))??s[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:l}))),[i,d]=x({queryString:s,groupId:t}),[m,g]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[t,l]=(0,u.Nk)(s);return[t,(0,r.useCallback)((e=>{s&&l.set(e)}),[s,l])]}({groupId:t}),j=(()=>{const e=i??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{j&&c(j)}),[j]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);c(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function b(e){let{className:n,block:s,selectedValue:r,selectValue:a,tabValues:o}=e;const c=[],{blockElementScrollPositionUntilNextRender:i}=(0,l.o5)(),u=e=>{const n=e.currentTarget,s=c.indexOf(n),t=o[s].value;t!==r&&(i(n),a(t))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=c.indexOf(e.currentTarget)+1;n=c[s]??c[0];break}case"ArrowLeft":{const s=c.indexOf(e.currentTarget)-1;n=c[s]??c[c.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.Z)("tabs",{"tabs--block":s},n),children:o.map((e=>{let{value:n,label:s,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>c.push(e),onKeyDown:d,onClick:u,...l,className:(0,t.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":r===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:t}=e;const l=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===t));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==t})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,t.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,g.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>c});var r=s(7294),t=s(2263),l=s(9286),a=s(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),c=e=>{let{url:n,language:s,extractMethod:c,methodType:i}=e;const[u,d]=(0,r.useState)(""),[h,p]=(0,r.useState)(!0),[x,m]=(0,r.useState)(!0),{siteConfig:g}=(0,t.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,r.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=c&&i?((e,n,s)=>{const r=e.split("\n"),t=`${s} ${n}`;let l=!1,a=0,o="";for(const c of r)if(c.includes(t)&&(l=!0),l&&(c.includes("{")&&a++,o+=c+"\n",c.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,c,i):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,c,i]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${s}`,children:u})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>l});var r=s(4673),t=s(5893);const l=e=>{let{children:n,open:s,title:l}=e;return(0,t.jsx)(r.Z,{open:s,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:l})}),children:(0,t.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/7fbd6b3a.b2a4ea36.js b/assets/js/7fbd6b3a.b2a4ea36.js
deleted file mode 100644
index 964d33c3b0..0000000000
--- a/assets/js/7fbd6b3a.b2a4ea36.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9964],{8937:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>p});var r=s(5893),t=s(1151),l=s(4866),a=s(5162),o=s(6393),c=s(4379);const i={sidebar_position:1,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="SELECT",d={id:"examples/queries/prepared-statements/select",title:"SELECT",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/select.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/select",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/select",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/select.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/insert"},next:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/update"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"select",children:"SELECT"}),"\n",(0,r.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\n const values = ['Page', 45];\n\n // highlight-next-line\n const [rows, fields] = await connection.execute(sql, values);\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(a.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\nconst values = ['Page', 45];\n\nconnection.execute(sql, values, (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n});\n"})})})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["The connection used for the query (",(0,r.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,r.jsx)(n.code,{children:"createConnection"}),", ",(0,r.jsx)(n.code,{children:"createPool"})," or ",(0,r.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["execute(options: ",(0,r.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\n const values = ['Page', 45];\n\n // highlight-start\n const [rows, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(a.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\nconst values = ['Page', 45];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["The connection used for the query (",(0,r.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,r.jsx)(n.code,{children:"createConnection"}),", ",(0,r.jsx)(n.code,{children:"createPool"})," or ",(0,r.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["execute(options: ",(0,r.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\n const values = ['Page', 45];\n\n // highlight-start\n const [rows, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(a.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = ? AND `age` > ?';\nconst values = ['Page', 45];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["The connection used for the query (",(0,r.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,r.jsx)(n.code,{children:"createConnection"}),", ",(0,r.jsx)(n.code,{children:"createPool"})," or ",(0,r.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,r.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,r.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,r.jsx)(c.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(x,{...e})}):x(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>a});s(7294);var r=s(512);const t={tabItem:"tabItem_Ymn6"};var l=s(5893);function a(e){let{children:n,hidden:s,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,r.Z)(t.tabItem,a),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>q});var r=s(7294),t=s(512),l=s(2466),a=s(6550),o=s(469),c=s(1980),i=s(7392),u=s(12);function d(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:r,default:t}}=e;return{value:n,label:s,attributes:r,default:t}}))}(s);return function(e){const n=(0,i.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function p(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:s}=e;const t=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,c._X)(l),(0,r.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(t.location.search);n.set(l,e),t.replace({...t.location,search:n.toString()})}),[l,t])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:t}=e,l=h(e),[a,c]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=s.find((e=>e.default))??s[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:l}))),[i,d]=x({queryString:s,groupId:t}),[m,g]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[t,l]=(0,u.Nk)(s);return[t,(0,r.useCallback)((e=>{s&&l.set(e)}),[s,l])]}({groupId:t}),j=(()=>{const e=i??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{j&&c(j)}),[j]);return{selectedValue:a,selectValue:(0,r.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);c(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function b(e){let{className:n,block:s,selectedValue:r,selectValue:a,tabValues:o}=e;const c=[],{blockElementScrollPositionUntilNextRender:i}=(0,l.o5)(),u=e=>{const n=e.currentTarget,s=c.indexOf(n),t=o[s].value;t!==r&&(i(n),a(t))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=c.indexOf(e.currentTarget)+1;n=c[s]??c[0];break}case"ArrowLeft":{const s=c.indexOf(e.currentTarget)-1;n=c[s]??c[c.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.Z)("tabs",{"tabs--block":s},n),children:o.map((e=>{let{value:n,label:s,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>c.push(e),onKeyDown:d,onClick:u,...l,className:(0,t.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":r===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:t}=e;const l=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===t));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==t})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,t.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,g.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>c});var r=s(7294),t=s(2263),l=s(9286),a=s(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),c=e=>{let{url:n,language:s,extractMethod:c,methodType:i}=e;const[u,d]=(0,r.useState)(""),[h,p]=(0,r.useState)(!0),[x,m]=(0,r.useState)(!0),{siteConfig:g}=(0,t.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,r.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=c&&i?((e,n,s)=>{const r=e.split("\n"),t=`${s} ${n}`;let l=!1,a=0,o="";for(const c of r)if(c.includes(t)&&(l=!0),l&&(c.includes("{")&&a++,o+=c+"\n",c.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,c,i):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,c,i]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${s}`,children:u})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>l});var r=s(4673),t=s(5893);const l=e=>{let{children:n,open:s,title:l}=e;return(0,t.jsx)(r.Z,{open:s,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:l})}),children:(0,t.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/8b8ccc10.1c3b82e9.js b/assets/js/8b8ccc10.1c3b82e9.js
deleted file mode 100644
index e6c661f578..0000000000
--- a/assets/js/8b8ccc10.1c3b82e9.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8534],{3961:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var s=t(5893),r=t(1151),l=t(4866),a=t(5162),o=t(6393),i=t(4379);const c={sidebar_position:3,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="DELETE",d={id:"examples/queries/prepared-statements/delete",title:"DELETE",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/delete.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/delete",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/delete",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/delete.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/update"},next:{title:"Binlog Watcher",permalink:"/node-mysql2/docs/examples/binlog-watcher"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"delete",children:"DELETE"}),"\n",(0,s.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\n const values = ['Page'];\n\n // highlight-next-line\n const [result, fields] = await connection.execute(sql, values);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\nconst values = ['Page'];\n\nconnection.execute(sql, values, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\n const values = ['Page'];\n\n // highlight-start\n const [result, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\nconst values = ['Page'];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\n const values = ['Page'];\n\n // highlight-start\n const [result, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\nconst values = ['Page'];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,s.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,s.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,s.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(x,{...e})}):x(e)}},5162:(e,n,t)=>{t.d(n,{Z:()=>a});t(7294);var s=t(512);const r={tabItem:"tabItem_Ymn6"};var l=t(5893);function a(e){let{children:n,hidden:t,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(r.tabItem,a),hidden:t,children:n})}},4866:(e,n,t)=>{t.d(n,{Z:()=>q});var s=t(7294),r=t(512),l=t(2466),a=t(6550),o=t(469),i=t(1980),c=t(7392),u=t(12);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:t}=e;const r=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function m(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,l=h(e),[a,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:t,groupId:r}),[m,g]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,u.Nk)(t);return[r,(0,s.useCallback)((e=>{t&&l.set(e)}),[t,l])]}({groupId:r}),j=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:a,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=t(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=t(5893);function b(e){let{className:n,block:t,selectedValue:s,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,t=i.indexOf(n),r=o[t].value;r!==s&&(c(n),a(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=i.indexOf(e.currentTarget)+1;n=i[t]??i[0];break}case"ArrowLeft":{const t=i.indexOf(e.currentTarget)-1;n=i[t]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":t},n),children:o.map((e=>{let{value:n,label:t,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,r.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:r}=e;const l=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,g.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,t)=>{t.d(n,{I:()=>i});var s=t(7294),r=t(2263),l=t(9286),a=t(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:t,extractMethod:i,methodType:c}=e;const[u,d]=(0,s.useState)(""),[h,p]=(0,s.useState)(!0),[x,m]=(0,s.useState)(!0),{siteConfig:g}=(0,r.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,t)=>{const s=e.split("\n"),r=`${t} ${n}`;let l=!1,a=0,o="";for(const i of s)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${t}`,children:u})})})}},6393:(e,n,t)=>{t.d(n,{Z:()=>l});var s=t(4673),r=t(5893);const l=e=>{let{children:n,open:t,title:l}=e;return(0,r.jsx)(s.Z,{open:t,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/8b8ccc10.a9b6fe0b.js b/assets/js/8b8ccc10.a9b6fe0b.js
new file mode 100644
index 0000000000..1a7a31faef
--- /dev/null
+++ b/assets/js/8b8ccc10.a9b6fe0b.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8534],{3961:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var s=t(5893),r=t(1151),l=t(4866),a=t(5162),o=t(6393),i=t(4379);const c={sidebar_position:3,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="DELETE",d={id:"examples/queries/prepared-statements/delete",title:"DELETE",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/delete.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/delete",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/delete",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/delete.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/update"},next:{title:"Binlog Watcher",permalink:"/node-mysql2/docs/examples/binlog-watcher"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"delete",children:"DELETE"}),"\n",(0,s.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\n const values = ['Page'];\n\n // highlight-next-line\n const [result, fields] = await connection.execute(sql, values);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\nconst values = ['Page'];\n\nconnection.execute(sql, values, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\n const values = ['Page'];\n\n // highlight-start\n const [result, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\nconst values = ['Page'];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\n const values = ['Page'];\n\n // highlight-start\n const [result, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'DELETE FROM `users` WHERE `name` = ? LIMIT 1';\nconst values = ['Page'];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,s.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,s.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,s.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(x,{...e})}):x(e)}},5162:(e,n,t)=>{t.d(n,{Z:()=>a});t(7294);var s=t(512);const r={tabItem:"tabItem_Ymn6"};var l=t(5893);function a(e){let{children:n,hidden:t,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(r.tabItem,a),hidden:t,children:n})}},4866:(e,n,t)=>{t.d(n,{Z:()=>q});var s=t(7294),r=t(512),l=t(2466),a=t(6550),o=t(469),i=t(1980),c=t(7392),u=t(12);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:t}=e;const r=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function m(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,l=h(e),[a,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:t,groupId:r}),[m,g]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,u.Nk)(t);return[r,(0,s.useCallback)((e=>{t&&l.set(e)}),[t,l])]}({groupId:r}),j=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:a,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=t(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=t(5893);function b(e){let{className:n,block:t,selectedValue:s,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,t=i.indexOf(n),r=o[t].value;r!==s&&(c(n),a(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=i.indexOf(e.currentTarget)+1;n=i[t]??i[0];break}case"ArrowLeft":{const t=i.indexOf(e.currentTarget)-1;n=i[t]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":t},n),children:o.map((e=>{let{value:n,label:t,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,r.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:r}=e;const l=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,g.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,t)=>{t.d(n,{I:()=>i});var s=t(7294),r=t(2263),l=t(9286),a=t(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:t,extractMethod:i,methodType:c}=e;const[u,d]=(0,s.useState)(""),[h,p]=(0,s.useState)(!0),[x,m]=(0,s.useState)(!0),{siteConfig:g}=(0,r.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,t)=>{const s=e.split("\n"),r=`${t} ${n}`;let l=!1,a=0,o="";for(const i of s)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${t}`,children:u})})})}},6393:(e,n,t)=>{t.d(n,{Z:()=>l});var s=t(4673),r=t(5893);const l=e=>{let{children:n,open:t,title:l}=e;return(0,r.jsx)(s.Z,{open:t,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/8fcb4d7f.439505a5.js b/assets/js/8fcb4d7f.439505a5.js
new file mode 100644
index 0000000000..decd0ba0d2
--- /dev/null
+++ b/assets/js/8fcb4d7f.439505a5.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[81],{3050:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var s=r(5893),t=r(1151),l=r(4866),o=r(5162),a=r(6393),i=r(4379);const c={sidebar_position:1,tags:["query"]},u="SELECT",d={id:"examples/queries/simple-queries/select",title:"SELECT",description:"The examples below also work for the execute method.",source:"@site/docs/examples/queries/simple-queries/select.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/select",permalink:"/node-mysql2/docs/examples/queries/simple-queries/select",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/select.mdx",tags:[{label:"query",permalink:"/node-mysql2/docs/tags/query"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,tags:["query"]},sidebar:"examples",previous:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/simple-queries/insert"},next:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/update"}},h={},p=[{value:"query(sql)",id:"querysql",level:2},{value:"query(options)",id:"queryoptions",level:2},{value:"query(options) \u2014 Row as Array",id:"queryoptions--row-as-array",level:2},{value:"Glossary",id:"glossary",level:2},{value:"QueryOptions",id:"queryoptions-1",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"select",children:"SELECT"}),"\n",(0,s.jsxs)(n.p,{children:["The examples below also work for the ",(0,s.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements/select",children:(0,s.jsx)(n.code,{children:"execute"})})," method."]}),"\n",(0,s.jsx)(n.h2,{id:"querysql",children:"query(sql)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"query(sql: string)"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(o.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\n // highlight-next-line\n const [rows, fields] = await connection.query(sql);\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(o.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\nconnection.query(sql, (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n});\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"queryoptions",children:"query(options)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["query(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(o.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\n // highlight-start\n const [rows, fields] = await connection.query({\n sql,\n // ... other options\n });\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(o.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\nconnection.query(\n {\n sql,\n // ... other options\n },\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"queryoptions--row-as-array",children:"query(options) \u2014 Row as Array"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["query(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(o.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\n // highlight-start\n const [rows, fields] = await connection.query({\n sql,\n rowsAsArray: true,\n // ... other options\n });\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(o.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\nconnection.query(\n {\n sql,\n rowsAsArray: true,\n // ... other options\n },\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"rows"})," contains rows returned by server as array"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"queryoptions-1",children:"QueryOptions"}),"\n",(0,s.jsx)(a.Z,{title:"QueryOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(x,{...e})}):x(e)}},5162:(e,n,r)=>{r.d(n,{Z:()=>o});r(7294);var s=r(512);const t={tabItem:"tabItem_Ymn6"};var l=r(5893);function o(e){let{children:n,hidden:r,className:o}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(t.tabItem,o),hidden:r,children:n})}},4866:(e,n,r)=>{r.d(n,{Z:()=>v});var s=r(7294),t=r(512),l=r(2466),o=r(6550),a=r(469),i=r(1980),c=r(7392),u=r(12);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:r}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:r,attributes:s,default:t}}=e;return{value:n,label:r,attributes:s,default:t}}))}(r);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,r])}function p(e){let{value:n,tabValues:r}=e;return r.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:r}=e;const t=(0,o.k6)(),l=function(e){let{queryString:n=!1,groupId:r}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:n,groupId:r});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(t.location.search);n.set(l,e),t.replace({...t.location,search:n.toString()})}),[l,t])]}function m(e){const{defaultValue:n,queryString:r=!1,groupId:t}=e,l=h(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:r}=e;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:r}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${r.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=r.find((e=>e.default))??r[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:r,groupId:t}),[m,g]=function(e){let{groupId:n}=e;const r=function(e){return e?`docusaurus.tab.${e}`:null}(n),[t,l]=(0,u.Nk)(r);return[t,(0,s.useCallback)((e=>{r&&l.set(e)}),[r,l])]}({groupId:t}),j=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,a.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=r(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=r(5893);function b(e){let{className:n,block:r,selectedValue:s,selectValue:o,tabValues:a}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,r=i.indexOf(n),t=a[r].value;t!==s&&(c(n),o(t))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const r=i.indexOf(e.currentTarget)+1;n=i[r]??i[0];break}case"ArrowLeft":{const r=i.indexOf(e.currentTarget)-1;n=i[r]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.Z)("tabs",{"tabs--block":r},n),children:a.map((e=>{let{value:n,label:r,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,t.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":s===n}),children:r??n},n)}))})}function y(e){let{lazy:n,children:r,selectedValue:t}=e;const l=(Array.isArray(r)?r:[r]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===t));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==t})))})}function q(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,t.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(y,{...e,...n})]})}function v(e){const n=(0,g.Z)();return(0,f.jsx)(q,{...e,children:d(e.children)},String(n))}},4379:(e,n,r)=>{r.d(n,{I:()=>i});var s=r(7294),t=r(2263),l=r(9286),o=r(5893);const a=()=>(0,o.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:r,extractMethod:i,methodType:c}=e;const[u,d]=(0,s.useState)(""),[h,p]=(0,s.useState)(!0),[x,m]=(0,s.useState)(!0),{siteConfig:g}=(0,t.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,r)=>{const s=e.split("\n"),t=`${r} ${n}`;let l=!1,o=0,a="";for(const i of s)if(i.includes(t)&&(l=!0),l&&(i.includes("{")&&o++,a+=i+"\n",i.includes("}")&&(o--,0===o)))break;return a.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,o.jsx)(o.Fragment,{children:h?(0,o.jsx)(a,{}):(0,o.jsx)(o.Fragment,{children:x?(0,o.jsxs)("div",{children:["Unable to access the requested link: ",(0,o.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,o.jsx)(l.Z,{className:`language-${r}`,children:u})})})}},6393:(e,n,r)=>{r.d(n,{Z:()=>l});var s=r(4673),t=r(5893);const l=e=>{let{children:n,open:r,title:l}=e;return(0,t.jsx)(s.Z,{open:r,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:l})}),children:(0,t.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/8fcb4d7f.775cd8a1.js b/assets/js/8fcb4d7f.775cd8a1.js
deleted file mode 100644
index 55097f9e4b..0000000000
--- a/assets/js/8fcb4d7f.775cd8a1.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[81],{3050:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var s=r(5893),t=r(1151),l=r(4866),o=r(5162),a=r(6393),i=r(4379);const c={sidebar_position:1,tags:["query"]},u="SELECT",d={id:"examples/queries/simple-queries/select",title:"SELECT",description:"The examples below also work for the execute method.",source:"@site/docs/examples/queries/simple-queries/select.mdx",sourceDirName:"examples/queries/simple-queries",slug:"/examples/queries/simple-queries/select",permalink:"/node-mysql2/docs/examples/queries/simple-queries/select",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/simple-queries/select.mdx",tags:[{label:"query",permalink:"/node-mysql2/docs/tags/query"}],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,tags:["query"]},sidebar:"examples",previous:{title:"INSERT",permalink:"/node-mysql2/docs/examples/queries/simple-queries/insert"},next:{title:"UPDATE",permalink:"/node-mysql2/docs/examples/queries/simple-queries/update"}},h={},p=[{value:"query(sql)",id:"querysql",level:2},{value:"query(options)",id:"queryoptions",level:2},{value:"query(options) \u2014 Row as Array",id:"queryoptions--row-as-array",level:2},{value:"Glossary",id:"glossary",level:2},{value:"QueryOptions",id:"queryoptions-1",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"select",children:"SELECT"}),"\n",(0,s.jsxs)(n.p,{children:["The examples below also work for the ",(0,s.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements/select",children:(0,s.jsx)(n.code,{children:"execute"})})," method."]}),"\n",(0,s.jsx)(n.h2,{id:"querysql",children:"query(sql)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"query(sql: string)"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(o.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\n // highlight-next-line\n const [rows, fields] = await connection.query(sql);\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(o.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\nconnection.query(sql, (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n});\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"queryoptions",children:"query(options)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["query(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(o.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\n // highlight-start\n const [rows, fields] = await connection.query({\n sql,\n // ... other options\n });\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(o.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\nconnection.query(\n {\n sql,\n // ... other options\n },\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"rows"})," contains rows returned by server"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"queryoptions--row-as-array",children:"query(options) \u2014 Row as Array"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["query(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(o.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\n // highlight-start\n const [rows, fields] = await connection.query({\n sql,\n rowsAsArray: true,\n // ... other options\n });\n // highlight-end\n\n console.log(rows);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(o.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'SELECT * FROM `users` WHERE `name` = \"Page\" AND `age` > 45';\n\nconnection.query(\n {\n sql,\n rowsAsArray: true,\n // ... other options\n },\n (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"rows"})," contains rows returned by server as array"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about rows, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:".query()"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"queryoptions-1",children:"QueryOptions"}),"\n",(0,s.jsx)(a.Z,{title:"QueryOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(x,{...e})}):x(e)}},5162:(e,n,r)=>{r.d(n,{Z:()=>o});r(7294);var s=r(512);const t={tabItem:"tabItem_Ymn6"};var l=r(5893);function o(e){let{children:n,hidden:r,className:o}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(t.tabItem,o),hidden:r,children:n})}},4866:(e,n,r)=>{r.d(n,{Z:()=>v});var s=r(7294),t=r(512),l=r(2466),o=r(6550),a=r(469),i=r(1980),c=r(7392),u=r(12);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:r}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:r,attributes:s,default:t}}=e;return{value:n,label:r,attributes:s,default:t}}))}(r);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,r])}function p(e){let{value:n,tabValues:r}=e;return r.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:r}=e;const t=(0,o.k6)(),l=function(e){let{queryString:n=!1,groupId:r}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return r??null}({queryString:n,groupId:r});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(t.location.search);n.set(l,e),t.replace({...t.location,search:n.toString()})}),[l,t])]}function m(e){const{defaultValue:n,queryString:r=!1,groupId:t}=e,l=h(e),[o,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:r}=e;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:r}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${r.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=r.find((e=>e.default))??r[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:r,groupId:t}),[m,g]=function(e){let{groupId:n}=e;const r=function(e){return e?`docusaurus.tab.${e}`:null}(n),[t,l]=(0,u.Nk)(r);return[t,(0,s.useCallback)((e=>{r&&l.set(e)}),[r,l])]}({groupId:t}),j=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,a.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:o,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=r(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=r(5893);function b(e){let{className:n,block:r,selectedValue:s,selectValue:o,tabValues:a}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,r=i.indexOf(n),t=a[r].value;t!==s&&(c(n),o(t))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const r=i.indexOf(e.currentTarget)+1;n=i[r]??i[0];break}case"ArrowLeft":{const r=i.indexOf(e.currentTarget)-1;n=i[r]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.Z)("tabs",{"tabs--block":r},n),children:a.map((e=>{let{value:n,label:r,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,t.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":s===n}),children:r??n},n)}))})}function y(e){let{lazy:n,children:r,selectedValue:t}=e;const l=(Array.isArray(r)?r:[r]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===t));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==t})))})}function q(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,t.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(y,{...e,...n})]})}function v(e){const n=(0,g.Z)();return(0,f.jsx)(q,{...e,children:d(e.children)},String(n))}},4379:(e,n,r)=>{r.d(n,{I:()=>i});var s=r(7294),t=r(2263),l=r(9286),o=r(5893);const a=()=>(0,o.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:r,extractMethod:i,methodType:c}=e;const[u,d]=(0,s.useState)(""),[h,p]=(0,s.useState)(!0),[x,m]=(0,s.useState)(!0),{siteConfig:g}=(0,t.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,r)=>{const s=e.split("\n"),t=`${r} ${n}`;let l=!1,o=0,a="";for(const i of s)if(i.includes(t)&&(l=!0),l&&(i.includes("{")&&o++,a+=i+"\n",i.includes("}")&&(o--,0===o)))break;return a.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,o.jsx)(o.Fragment,{children:h?(0,o.jsx)(a,{}):(0,o.jsx)(o.Fragment,{children:x?(0,o.jsxs)("div",{children:["Unable to access the requested link: ",(0,o.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,o.jsx)(l.Z,{className:`language-${r}`,children:u})})})}},6393:(e,n,r)=>{r.d(n,{Z:()=>l});var s=r(4673),t=r(5893);const l=e=>{let{children:n,open:r,title:l}=e;return(0,t.jsx)(s.Z,{open:r,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:l})}),children:(0,t.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/9e767aa9.244f9a95.js b/assets/js/9e767aa9.244f9a95.js
new file mode 100644
index 0000000000..4e88269bbc
--- /dev/null
+++ b/assets/js/9e767aa9.244f9a95.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8806],{7372:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>c,toc:()=>a});var i=s(5893),t=s(1151),o=s(4442);const r={slug:"/documentation",title:"Introduction"},l="Documentation",c={id:"documentation/index",title:"Introduction",description:"[node-mysql]//github.com/mysqljs/mysql",source:"@site/docs/documentation/00-index.mdx",sourceDirName:"documentation",slug:"/documentation",permalink:"/node-mysql2/docs/documentation",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/documentation/00-index.mdx",tags:[],version:"current",sidebarPosition:0,frontMatter:{slug:"/documentation",title:"Introduction"},sidebar:"docs",previous:{title:"Stability Badges",permalink:"/node-mysql2/docs/stability-badges"},next:{title:"Authentication Switch Request",permalink:"/node-mysql2/docs/documentation/authentication-switch"}},d={},a=[{value:"Examples",id:"examples",level:2},{value:"Known incompatibilities with Node MySQL",id:"known-incompatibilities-with-node-mysql",level:2},{value:"Other Resources",id:"other-resources",level:2},{value:"Benchmarks",id:"benchmarks",level:2}];function h(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.V,{title:"Documentation"}),"\n",(0,i.jsx)(n.h1,{id:"documentation",children:"Documentation"}),"\n",(0,i.jsxs)(n.p,{children:["MySQL2 aims to be a drop in replacement for ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"}),"."]}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.em,{children:["If you see any API incompatibilities with ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"}),", please report via github issue."]})})}),"\n",(0,i.jsxs)(n.p,{children:["Not only ",(0,i.jsx)(n.strong,{children:"MySQL2"})," offers better performance over ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"}),", we also support these additional features:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/prepared-statements",children:"Prepared Statements"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/promise-wrapper",children:"Promise Wrapper"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/authentication-switch",children:"Authentication Switch"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/extras",children:"More Features"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/mysql-server",children:"MySQL Server"})}),"\n",(0,i.jsx)(n.li,{children:"Pooling"}),"\n",(0,i.jsx)(n.li,{children:"SSL"}),"\n",(0,i.jsx)(n.li,{children:"MySQL Compression"}),"\n",(0,i.jsx)(n.li,{children:"Binary Log Protocol Client"}),"\n"]}),"\n",(0,i.jsx)("hr",{}),"\n",(0,i.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,i.jsxs)(n.p,{children:["Please check these ",(0,i.jsx)(n.a,{href:"/docs/examples",children:"examples"})," for ",(0,i.jsx)(n.strong,{children:"MySQL2"}),"."]}),"\n",(0,i.jsx)("hr",{}),"\n",(0,i.jsxs)(n.h2,{id:"known-incompatibilities-with-node-mysql",children:["Known incompatibilities with ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"zeroFill"})," flag is ignored in type conversion.\nYou need to check corresponding field's zeroFill flag and convert to string manually if this is of importance to you."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"DECIMAL"})," and ",(0,i.jsx)(n.code,{children:"NEWDECIMAL"})," types always returned as ",(0,i.jsx)(n.code,{children:"string"})," unless you pass this config option:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n decimalNumbers: true,\n}\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsx)(n.p,{children:"This option could lose precision on the number as Javascript Number is a Float!"})}),"\n",(0,i.jsx)("hr",{}),"\n",(0,i.jsx)(n.h2,{id:"other-resources",children:"Other Resources"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://dev.mysql.com/doc/internals/en/client-server-protocol.html",children:"Wire protocol documentation"})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"})," - Most popular node.js mysql client library"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/mscdex/node-mariasql/",children:"node-mariasql"})," - Bindings to libmariasql. One of the fastest clients"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/Sannis/node-mysql-libmysqlclient",children:"node-libmysqlclient"})," - Bindings to libmysqlclient"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/siddontang/go-mysql",children:"go-mysql"})," - MySQL Go client (prepared statements, binlog protocol, server)"]}),"\n"]}),"\n",(0,i.jsx)("hr",{}),"\n",(0,i.jsx)(n.h2,{id:"benchmarks",children:"Benchmarks"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://gist.github.com/sidorares/ffe9ee9c423f763e3b6b",children:"https://gist.github.com/sidorares/ffe9ee9c423f763e3b6b"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"npm run benchmarks"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://github.com/mscdex/node-mysql-benchmarks",children:"node-mysql-benchmarks"})}),"\n",(0,i.jsxs)(n.li,{children:["try to run example ",(0,i.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/benchmarks",children:"benchmarks"})," on your system"]}),"\n"]})]})}function m(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}},4442:(e,n,s)=>{s.d(n,{V:()=>o});var i=s(5742),t=s(5893);const o=e=>{let{title:n}=e;return(0,t.jsx)(i.Z,{children:(0,t.jsx)("title",{children:n})})}},1151:(e,n,s)=>{s.d(n,{Z:()=>l,a:()=>r});var i=s(7294);const t={},o=i.createContext(t);function r(e){const n=i.useContext(o);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:r(e.components),i.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/9e767aa9.33391d2e.js b/assets/js/9e767aa9.33391d2e.js
deleted file mode 100644
index 630746ae4f..0000000000
--- a/assets/js/9e767aa9.33391d2e.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8806],{7372:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>c,toc:()=>h});var i=s(5893),t=s(1151),o=s(4442);const r={slug:"/documentation",title:"Introduction"},l="Documentation",c={id:"documentation/index",title:"Introduction",description:"[node-mysql]//github.com/mysqljs/mysql",source:"@site/docs/documentation/00-index.mdx",sourceDirName:"documentation",slug:"/documentation",permalink:"/node-mysql2/docs/documentation",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/documentation/00-index.mdx",tags:[],version:"current",sidebarPosition:0,frontMatter:{slug:"/documentation",title:"Introduction"},sidebar:"docs",previous:{title:"Stability Badges",permalink:"/node-mysql2/docs/stability-badges"},next:{title:"Authentication Switch Request",permalink:"/node-mysql2/docs/documentation/authentication-switch"}},d={},h=[{value:"Examples",id:"examples",level:2},{value:"Known incompatibilities with Node MySQL",id:"known-incompatibilities-with-node-mysql",level:2},{value:"Other Resources",id:"other-resources",level:2},{value:"Benchmarks",id:"benchmarks",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.V,{title:"Documentation"}),"\n",(0,i.jsx)(n.h1,{id:"documentation",children:"Documentation"}),"\n",(0,i.jsxs)(n.p,{children:["MySQL2 aims to be a drop in replacement for ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"}),"."]}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.em,{children:["If you see any API incompatibilities with ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"}),", please report via github issue."]})})}),"\n",(0,i.jsxs)(n.p,{children:["Not only ",(0,i.jsx)(n.strong,{children:"MySQL2"})," offers better performance over ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"}),", we also support these additional features:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/prepared-statements",children:"Prepared Statements"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/promise-wrapper",children:"Promise Wrapper"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/authentication-switch",children:"Authentication Switch"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/extras",children:"More Features"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/docs/documentation/mysql-server",children:"MySQL Server"})}),"\n",(0,i.jsx)(n.li,{children:"Pooling"}),"\n",(0,i.jsx)(n.li,{children:"SSL"}),"\n",(0,i.jsx)(n.li,{children:"MySQL Compression"}),"\n",(0,i.jsx)(n.li,{children:"Binary Log Protocol Client"}),"\n"]}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,i.jsxs)(n.p,{children:["Please check these ",(0,i.jsx)(n.a,{href:"/docs/examples",children:"examples"})," for ",(0,i.jsx)(n.strong,{children:"MySQL2"}),"."]}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsxs)(n.h2,{id:"known-incompatibilities-with-node-mysql",children:["Known incompatibilities with ",(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"zeroFill"})," flag is ignored in type conversion.\nYou need to check corresponding field's zeroFill flag and convert to string manually if this is of importance to you."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"DECIMAL"})," and ",(0,i.jsx)(n.code,{children:"NEWDECIMAL"})," types always returned as ",(0,i.jsx)(n.code,{children:"string"})," unless you pass this config option:"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n decimalNumbers: true,\n}\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsx)(n.p,{children:"This option could lose precision on the number as Javascript Number is a Float!"})}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsx)(n.h2,{id:"other-resources",children:"Other Resources"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://dev.mysql.com/doc/internals/en/client-server-protocol.html",children:"Wire protocol documentation"})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/mysqljs/mysql",children:"Node MySQL"})," - Most popular node.js mysql client library"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/mscdex/node-mariasql/",children:"node-mariasql"})," - Bindings to libmariasql. One of the fastest clients"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/Sannis/node-mysql-libmysqlclient",children:"node-libmysqlclient"})," - Bindings to libmysqlclient"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://github.com/siddontang/go-mysql",children:"go-mysql"})," - MySQL Go client (prepared statements, binlog protocol, server)"]}),"\n"]}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsx)(n.h2,{id:"benchmarks",children:"Benchmarks"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://gist.github.com/sidorares/ffe9ee9c423f763e3b6b",children:"https://gist.github.com/sidorares/ffe9ee9c423f763e3b6b"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"npm run benchmarks"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"https://github.com/mscdex/node-mysql-benchmarks",children:"node-mysql-benchmarks"})}),"\n",(0,i.jsxs)(n.li,{children:["try to run example ",(0,i.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/benchmarks",children:"benchmarks"})," on your system"]}),"\n"]})]})}function m(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},4442:(e,n,s)=>{s.d(n,{V:()=>o});var i=s(5742),t=s(5893);const o=e=>{let{title:n}=e;return(0,t.jsx)(i.Z,{children:(0,t.jsx)("title",{children:n})})}},1151:(e,n,s)=>{s.d(n,{Z:()=>l,a:()=>r});var i=s(7294);const t={},o=i.createContext(t);function r(e){const n=i.useContext(o);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:r(e.components),i.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/b07748b5.6c0d5c52.js b/assets/js/b07748b5.6c0d5c52.js
new file mode 100644
index 0000000000..0c45613adf
--- /dev/null
+++ b/assets/js/b07748b5.6c0d5c52.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4403],{214:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>d,default:()=>m,frontMatter:()=>a,metadata:()=>u,toc:()=>p});var r=s(5893),o=s(1151),l=s(4866),t=s(5162),c=s(6393),i=s(4379);const a={sidebar_position:3,tags:["createPoolCluster","URI","SHA1","RDS","SSL","Socks"]},d="createPoolCluster",u={id:"examples/connections/createPoolCluster",title:"createPoolCluster",description:"For queries please see the Simple Queries and Prepared Statements examples.",source:"@site/docs/examples/connections/createPoolCluster.mdx",sourceDirName:"examples/connections",slug:"/examples/connections/createPoolCluster",permalink:"/node-mysql2/docs/examples/connections/createPoolCluster",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/connections/createPoolCluster.mdx",tags:[{label:"createPoolCluster",permalink:"/node-mysql2/docs/tags/create-pool-cluster"},{label:"URI",permalink:"/node-mysql2/docs/tags/uri"},{label:"SHA1",permalink:"/node-mysql2/docs/tags/sha-1"},{label:"RDS",permalink:"/node-mysql2/docs/tags/rds"},{label:"SSL",permalink:"/node-mysql2/docs/tags/ssl"},{label:"Socks",permalink:"/node-mysql2/docs/tags/socks"}],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,tags:["createPoolCluster","URI","SHA1","RDS","SSL","Socks"]},sidebar:"examples",previous:{title:"createPool",permalink:"/node-mysql2/docs/examples/connections/create-pool"},next:{title:"Simple Queries",permalink:"/node-mysql2/docs/examples/queries/simple-queries/"}},h={},p=[{value:"add(group, connectionUri)",id:"addgroup-connectionuri",level:2},{value:"add(group, config)",id:"addgroup-config",level:2},{value:"add(group, config) \u2014 SHA1",id:"addgroup-config--sha1",level:2},{value:"add(group, config) \u2014 SSL",id:"addgroup-config--ssl",level:2},{value:"add(group, config) \u2014 RDS SSL",id:"addgroup-config--rds-ssl",level:2},{value:"Related Links",id:"related-links",level:3},{value:"add(group, config) \u2014 Socks",id:"addgroup-config--socks",level:2},{value:"Glossary",id:"glossary",level:2},{value:"PoolOptions",id:"pooloptions",level:3}];function g(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"createpoolcluster",children:"createPoolCluster"}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["For queries please see the ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,r.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,r.jsx)(n.strong,{children:"Prepared Statements"})})," examples."]})}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-connectionuri",children:"add(group, connectionUri)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"add(group: string, connectionUri: string)"})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', 'mysql://root:password@localhost:3306/test');\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', 'mysql://root:password@localhost:3306/test');\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config",children:"add(group, config)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--sha1",children:"add(group, config) \u2014 SHA1"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n // ...\n passwordSha1: Buffer.from(\n '8bb6118f8fd6935ad0876a3be34a717d32708ffd',\n 'hex'\n ),\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n // ...\n passwordSha1: Buffer.from('8bb6118f8fd6935ad0876a3be34a717d32708ffd', 'hex'),\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--ssl",children:"add(group, config) \u2014 SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})}),(0,r.jsxs)(t.Z,{value:"certs/ca-cert.pem",children:[(0,r.jsx)(i.I,{language:"plan",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/test/fixtures/ssl/certs/ca.pem"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["See ",(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/test/fixtures/ssl/certs",children:"ssl/certs"}),"."]}),"\n"]})]})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--rds-ssl",children:"add(group, config) \u2014 RDS SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["You can use ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," string as value to ssl property to connect to ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," MySQL over SSL."]}),"\n",(0,r.jsxs)(n.p,{children:["In that case ",(0,r.jsx)(n.a,{href:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem",children:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem"})," CA cert is used:"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(t.Z,{value:"promise.js",default:!0,children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const [res] = await connection.query('SHOW `status` LIKE \"Ssl_cipher\"');\n await poolCluster.end();\n\n console.log(res);\n} catch (err) {\n console.log(err);\n}\n"})})})]}),(0,r.jsxs)(t.Z,{value:"callback.js",children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"connectionquery('SHOW `status` LIKE \"Ssl_cipher\"', function (err, res) {\n poolCluster.end();\n\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(res);\n});\n"})})})]})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)(n.h3,{id:"related-links",children:"Related Links"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Issues"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues/2130",children:"#2130 \u2014 Update TLS certs for Amazon RDS instances"})}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Pull Requests"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2119",children:"#2119 \u2014 fix: make startTls code compatible with Bun"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2131",children:"#2131 \u2014 Update Amazon RDS SSL CA cert"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--socks",children:"add(group, config) \u2014 Socks"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"A.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\nconst socksProxy = new SocksConnection({ port: 3306 });\n// highlight-start\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n stream: socksProxy,\n});\n// poolCluster.add('clusterB', '...');\n\nconst poolNamespace = poolCluster.of('clusterA');\n// highlight-end\n"})})}),(0,r.jsx)(t.Z,{value:"B.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\n// highlight-start\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n debug: 1,\n stream: function () {\n return new SocksConnection({ port: 3306 });\n },\n});\n// poolCluster.add('clusterB', '...');\n\nconst poolNamespace = poolCluster.of('clusterA');\n// highlight-end\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"poolNamespace.execute('SELECT SLEEP(1.1) AS `www`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npoolNamespace.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npoolNamespace.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n"})})}),"\n",(0,r.jsx)("hr",{}),"\n",(0,r.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,r.jsx)(n.h3,{id:"pooloptions",children:"PoolOptions"}),"\n",(0,r.jsxs)("blockquote",{children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"PoolOptions"})," extends all options from ",(0,r.jsx)(n.strong,{children:"ConnectionOptions"}),":"]}),(0,r.jsx)(c.Z,{title:"ConnectionOptions Specification",children:(0,r.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Connection.d.ts",extractMethod:"ConnectionOptions",methodType:"interface"})})]}),"\n",(0,r.jsx)(c.Z,{title:"PoolOptions Specification",children:(0,r.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Pool.d.ts",extractMethod:"PoolOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,o.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>t});s(7294);var r=s(512);const o={tabItem:"tabItem_Ymn6"};var l=s(5893);function t(e){let{children:n,hidden:s,className:t}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,t),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>C});var r=s(7294),o=s(512),l=s(2466),t=s(6550),c=s(469),i=s(1980),a=s(7392),d=s(12);function u(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:s,attributes:r,default:o}}=e;return{value:n,label:s,attributes:r,default:o}}))}(s);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function p(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function g(e){let{queryString:n=!1,groupId:s}=e;const o=(0,t.k6)(),l=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(l),(0,r.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(o.location.search);n.set(l,e),o.replace({...o.location,search:n.toString()})}),[l,o])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:o}=e,l=h(e),[t,i]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=s.find((e=>e.default))??s[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:l}))),[a,u]=g({queryString:s,groupId:o}),[m,x]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[o,l]=(0,d.Nk)(s);return[o,(0,r.useCallback)((e=>{s&&l.set(e)}),[s,l])]}({groupId:o}),j=(()=>{const e=a??m;return p({value:e,tabValues:l})?e:null})();(0,c.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:t,selectValue:(0,r.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),x(e)}),[u,x,l]),tabValues:l}}var x=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function y(e){let{className:n,block:s,selectedValue:r,selectValue:t,tabValues:c}=e;const i=[],{blockElementScrollPositionUntilNextRender:a}=(0,l.o5)(),d=e=>{const n=e.currentTarget,s=i.indexOf(n),o=c[s].value;o!==r&&(a(n),t(o))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":s},n),children:c.map((e=>{let{value:n,label:s,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>i.push(e),onKeyDown:u,onClick:d,...l,className:(0,o.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":r===n}),children:s??n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:o}=e;const l=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function q(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,o.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(y,{...e,...n}),(0,f.jsx)(b,{...e,...n})]})}function C(e){const n=(0,x.Z)();return(0,f.jsx)(q,{...e,children:u(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>i});var r=s(7294),o=s(2263),l=s(9286),t=s(5893);const c=()=>(0,t.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:s,extractMethod:i,methodType:a}=e;const[d,u]=(0,r.useState)(""),[h,p]=(0,r.useState)(!0),[g,m]=(0,r.useState)(!0),{siteConfig:x}=(0,o.Z)(),j=x.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,r.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&a?((e,n,s)=>{const r=e.split("\n"),o=`${s} ${n}`;let l=!1,t=0,c="";for(const i of r)if(i.includes(o)&&(l=!0),l&&(i.includes("{")&&t++,c+=i+"\n",i.includes("}")&&(t--,0===t)))break;return c.trim()||e})(e,i,a):e;u(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,a]),(0,t.jsx)(t.Fragment,{children:h?(0,t.jsx)(c,{}):(0,t.jsx)(t.Fragment,{children:g?(0,t.jsxs)("div",{children:["Unable to access the requested link: ",(0,t.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,t.jsx)(l.Z,{className:`language-${s}`,children:d})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>l});var r=s(4673),o=s(5893);const l=e=>{let{children:n,open:s,title:l}=e;return(0,o.jsx)(r.Z,{open:s,className:"faq",summary:(0,o.jsx)("summary",{children:(0,o.jsx)("strong",{children:l})}),children:(0,o.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/b07748b5.e822c15e.js b/assets/js/b07748b5.e822c15e.js
deleted file mode 100644
index d157a941fd..0000000000
--- a/assets/js/b07748b5.e822c15e.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4403],{214:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>d,default:()=>m,frontMatter:()=>a,metadata:()=>u,toc:()=>p});var r=s(5893),o=s(1151),l=s(4866),t=s(5162),c=s(6393),i=s(4379);const a={sidebar_position:3,tags:["createPoolCluster","URI","SHA1","RDS","SSL","Socks"]},d="createPoolCluster",u={id:"examples/connections/createPoolCluster",title:"createPoolCluster",description:"For queries please see the Simple Queries and Prepared Statements examples.",source:"@site/docs/examples/connections/createPoolCluster.mdx",sourceDirName:"examples/connections",slug:"/examples/connections/createPoolCluster",permalink:"/node-mysql2/docs/examples/connections/createPoolCluster",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/connections/createPoolCluster.mdx",tags:[{label:"createPoolCluster",permalink:"/node-mysql2/docs/tags/create-pool-cluster"},{label:"URI",permalink:"/node-mysql2/docs/tags/uri"},{label:"SHA1",permalink:"/node-mysql2/docs/tags/sha-1"},{label:"RDS",permalink:"/node-mysql2/docs/tags/rds"},{label:"SSL",permalink:"/node-mysql2/docs/tags/ssl"},{label:"Socks",permalink:"/node-mysql2/docs/tags/socks"}],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3,tags:["createPoolCluster","URI","SHA1","RDS","SSL","Socks"]},sidebar:"examples",previous:{title:"createPool",permalink:"/node-mysql2/docs/examples/connections/create-pool"},next:{title:"Simple Queries",permalink:"/node-mysql2/docs/examples/queries/simple-queries/"}},h={},p=[{value:"add(group, connectionUri)",id:"addgroup-connectionuri",level:2},{value:"add(group, config)",id:"addgroup-config",level:2},{value:"add(group, config) \u2014 SHA1",id:"addgroup-config--sha1",level:2},{value:"add(group, config) \u2014 SSL",id:"addgroup-config--ssl",level:2},{value:"add(group, config) \u2014 RDS SSL",id:"addgroup-config--rds-ssl",level:2},{value:"Related Links",id:"related-links",level:3},{value:"add(group, config) \u2014 Socks",id:"addgroup-config--socks",level:2},{value:"Glossary",id:"glossary",level:2},{value:"PoolOptions",id:"pooloptions",level:3}];function g(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"createpoolcluster",children:"createPoolCluster"}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["For queries please see the ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/simple-queries",children:(0,r.jsx)(n.strong,{children:"Simple Queries"})})," and ",(0,r.jsx)(n.a,{href:"/docs/examples/queries/prepared-statements",children:(0,r.jsx)(n.strong,{children:"Prepared Statements"})})," examples."]})}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-connectionuri",children:"add(group, connectionUri)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"add(group: string, connectionUri: string)"})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', 'mysql://root:password@localhost:3306/test');\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', 'mysql://root:password@localhost:3306/test');\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config",children:"add(group, config)"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n host: 'localhost',\n user: 'root',\n database: 'test',\n // port: 3306,\n // password: '',\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--sha1",children:"add(group, config) \u2014 SHA1"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n // ...\n passwordSha1: Buffer.from(\n '8bb6118f8fd6935ad0876a3be34a717d32708ffd',\n 'hex'\n ),\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n // ...\n passwordSha1: Buffer.from('8bb6118f8fd6935ad0876a3be34a717d32708ffd', 'hex'),\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--ssl",children:"add(group, config) \u2014 SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"promise.js",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,r.jsx)(t.Z,{value:"callback.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n // ...\n ssl: {\n // key: fs.readFileSync('./certs/client-key.pem'),\n // cert: fs.readFileSync('./certs/client-cert.pem')\n ca: fs.readFileSync('./certs/ca-cert.pem'),\n },\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})})}),(0,r.jsxs)(t.Z,{value:"certs/ca-cert.pem",children:[(0,r.jsx)(i.I,{language:"plan",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/test/fixtures/ssl/certs/ca.pem"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["See ",(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/tree/master/test/fixtures/ssl/certs",children:"ssl/certs"}),"."]}),"\n"]})]})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--rds-ssl",children:"add(group, config) \u2014 RDS SSL"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["You can use ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," string as value to ssl property to connect to ",(0,r.jsx)(n.strong,{children:"Amazon RDS"})," MySQL over SSL."]}),"\n",(0,r.jsxs)(n.p,{children:["In that case ",(0,r.jsx)(n.a,{href:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem",children:"https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem"})," CA cert is used:"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(t.Z,{value:"promise.js",default:!0,children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n // highlight-start\n const poolCluster = mysql.createPoolCluster();\n\n poolCluster.add('clusterA', {\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n });\n // poolCluster.add('clusterB', '...');\n\n const connection = await poolCluster.getConnection('clusterA');\n // highlight-end\n // ... some query\n\n // highlight-next-line\n connection.release();\n} catch (err) {\n console.log(err);\n}\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"try {\n const [res] = await connection.query('SHOW `status` LIKE \"Ssl_cipher\"');\n await poolCluster.end();\n\n console.log(res);\n} catch (err) {\n console.log(err);\n}\n"})})})]}),(0,r.jsxs)(t.Z,{value:"callback.js",children:[(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n // ...\n host: 'db.id.ap-southeast-2.rds.amazonaws.com',\n ssl: 'Amazon RDS',\n});\n// poolCluster.add('clusterB', '...');\n\npoolCluster.getConnection('clusterA', function (err, connection) {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n // ... some query\n\n connection.release();\n});\n"})}),(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"connectionquery('SHOW `status` LIKE \"Ssl_cipher\"', function (err, res) {\n poolCluster.end();\n\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(res);\n});\n"})})})]})]}),"\n",(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsx)(n.p,{children:"Don't forget to release the connection when finished by using:"}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"connection.release()"})}),"\n"]})]}),"\n",(0,r.jsx)(n.h3,{id:"related-links",children:"Related Links"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Issues"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/issues/2130",children:"#2130 \u2014 Update TLS certs for Amazon RDS instances"})}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Pull Requests"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2119",children:"#2119 \u2014 fix: make startTls code compatible with Bun"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/pull/2131",children:"#2131 \u2014 Update Amazon RDS SSL CA cert"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"addgroup-config--socks",children:"add(group, config) \u2014 Socks"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["add(group: string, config: ",(0,r.jsx)(n.a,{href:"#pooloptions",children:"PoolOptions"}),")"]})}),"\n"]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(t.Z,{value:"A.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\nconst socksProxy = new SocksConnection({ port: 3306 });\n// highlight-start\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n stream: socksProxy,\n});\n// poolCluster.add('clusterB', '...');\n\nconst poolNamespace = poolCluster.of('clusterA');\n// highlight-end\n"})})}),(0,r.jsx)(t.Z,{value:"B.js",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\nconst SocksConnection = require('socksjs');\n\n// highlight-start\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('clusterA', {\n debug: 1,\n stream: function () {\n return new SocksConnection({ port: 3306 });\n },\n});\n// poolCluster.add('clusterB', '...');\n\nconst poolNamespace = poolCluster.of('clusterA');\n// highlight-end\n"})})})]}),"\n",(0,r.jsx)(n.admonition,{title:"Testing",type:"tip",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"poolNamespace.execute('SELECT SLEEP(1.1) AS `www`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npoolNamespace.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n\npoolNamespace.execute('SELECT SLEEP(1) AS `qqq`', (err, rows, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(rows, fields);\n});\n"})})}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,r.jsx)(n.h3,{id:"pooloptions",children:"PoolOptions"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"PoolOptions"})," extends all options from ",(0,r.jsx)(n.strong,{children:"ConnectionOptions"}),":"]}),"\n",(0,r.jsx)(c.Z,{title:"ConnectionOptions Specification",children:(0,r.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Connection.d.ts",extractMethod:"ConnectionOptions",methodType:"interface"})}),"\n"]}),"\n",(0,r.jsx)(c.Z,{title:"PoolOptions Specification",children:(0,r.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/Pool.d.ts",extractMethod:"PoolOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,o.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>t});s(7294);var r=s(512);const o={tabItem:"tabItem_Ymn6"};var l=s(5893);function t(e){let{children:n,hidden:s,className:t}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,t),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>C});var r=s(7294),o=s(512),l=s(2466),t=s(6550),c=s(469),i=s(1980),a=s(7392),d=s(12);function u(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:s,attributes:r,default:o}}=e;return{value:n,label:s,attributes:r,default:o}}))}(s);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function p(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function g(e){let{queryString:n=!1,groupId:s}=e;const o=(0,t.k6)(),l=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(l),(0,r.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(o.location.search);n.set(l,e),o.replace({...o.location,search:n.toString()})}),[l,o])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:o}=e,l=h(e),[t,i]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=s.find((e=>e.default))??s[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:l}))),[a,u]=g({queryString:s,groupId:o}),[m,x]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[o,l]=(0,d.Nk)(s);return[o,(0,r.useCallback)((e=>{s&&l.set(e)}),[s,l])]}({groupId:o}),j=(()=>{const e=a??m;return p({value:e,tabValues:l})?e:null})();(0,c.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:t,selectValue:(0,r.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),u(e),x(e)}),[u,x,l]),tabValues:l}}var x=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function y(e){let{className:n,block:s,selectedValue:r,selectValue:t,tabValues:c}=e;const i=[],{blockElementScrollPositionUntilNextRender:a}=(0,l.o5)(),d=e=>{const n=e.currentTarget,s=i.indexOf(n),o=c[s].value;o!==r&&(a(n),t(o))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":s},n),children:c.map((e=>{let{value:n,label:s,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>i.push(e),onKeyDown:u,onClick:d,...l,className:(0,o.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":r===n}),children:s??n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:o}=e;const l=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===o));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==o})))})}function q(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,o.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(y,{...e,...n}),(0,f.jsx)(b,{...e,...n})]})}function C(e){const n=(0,x.Z)();return(0,f.jsx)(q,{...e,children:u(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>i});var r=s(7294),o=s(2263),l=s(9286),t=s(5893);const c=()=>(0,t.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:s,extractMethod:i,methodType:a}=e;const[d,u]=(0,r.useState)(""),[h,p]=(0,r.useState)(!0),[g,m]=(0,r.useState)(!0),{siteConfig:x}=(0,o.Z)(),j=x.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,r.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&a?((e,n,s)=>{const r=e.split("\n"),o=`${s} ${n}`;let l=!1,t=0,c="";for(const i of r)if(i.includes(o)&&(l=!0),l&&(i.includes("{")&&t++,c+=i+"\n",i.includes("}")&&(t--,0===t)))break;return c.trim()||e})(e,i,a):e;u(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,a]),(0,t.jsx)(t.Fragment,{children:h?(0,t.jsx)(c,{}):(0,t.jsx)(t.Fragment,{children:g?(0,t.jsxs)("div",{children:["Unable to access the requested link: ",(0,t.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,t.jsx)(l.Z,{className:`language-${s}`,children:d})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>l});var r=s(4673),o=s(5893);const l=e=>{let{children:n,open:s,title:l}=e;return(0,o.jsx)(r.Z,{open:s,className:"faq",summary:(0,o.jsx)("summary",{children:(0,o.jsx)("strong",{children:l})}),children:(0,o.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/b80d201b.074f18ce.js b/assets/js/b80d201b.074f18ce.js
deleted file mode 100644
index eb83841abc..0000000000
--- a/assets/js/b80d201b.074f18ce.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6061],{1384:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var s=t(5893),r=t(1151),l=t(4866),a=t(5162),o=t(6393),i=t(4379);const c={sidebar_position:2,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="UPDATE",d={id:"examples/queries/prepared-statements/update",title:"UPDATE",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/update.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/update",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/update",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/update.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"SELECT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/select"},next:{title:"DELETE",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/delete"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"update",children:"UPDATE"}),"\n",(0,s.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\n const values = [20, 'Josh'];\n\n // highlight-next-line\n const [result, fields] = await connection.execute(sql, values);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\nconst values = [20, 'Josh'];\n\nconnection.execute(sql, values, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\n const values = [20, 'Josh'];\n\n // highlight-start\n const [result, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\nconst values = [20, 'Josh'];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\n const values = [20, 'Josh'];\n\n // highlight-start\n const [result, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\nconst values = [20, 'Josh'];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,s.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,s.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,s.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(x,{...e})}):x(e)}},5162:(e,n,t)=>{t.d(n,{Z:()=>a});t(7294);var s=t(512);const r={tabItem:"tabItem_Ymn6"};var l=t(5893);function a(e){let{children:n,hidden:t,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(r.tabItem,a),hidden:t,children:n})}},4866:(e,n,t)=>{t.d(n,{Z:()=>q});var s=t(7294),r=t(512),l=t(2466),a=t(6550),o=t(469),i=t(1980),c=t(7392),u=t(12);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:t}=e;const r=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function m(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,l=h(e),[a,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:t,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,u.Nk)(t);return[r,(0,s.useCallback)((e=>{t&&l.set(e)}),[t,l])]}({groupId:r}),g=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{g&&i(g)}),[g]);return{selectedValue:a,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),j(e)}),[d,j,l]),tabValues:l}}var j=t(2389);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=t(5893);function b(e){let{className:n,block:t,selectedValue:s,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,t=i.indexOf(n),r=o[t].value;r!==s&&(c(n),a(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=i.indexOf(e.currentTarget)+1;n=i[t]??i[0];break}case"ArrowLeft":{const t=i.indexOf(e.currentTarget)-1;n=i[t]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":t},n),children:o.map((e=>{let{value:n,label:t,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,r.Z)("tabs__item",g.tabItem,l?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:r}=e;const l=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",g.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,j.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,t)=>{t.d(n,{I:()=>i});var s=t(7294),r=t(2263),l=t(9286),a=t(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:t,extractMethod:i,methodType:c}=e;const[u,d]=(0,s.useState)(""),[h,p]=(0,s.useState)(!0),[x,m]=(0,s.useState)(!0),{siteConfig:j}=(0,r.Z)(),g=j.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${g}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,t)=>{const s=e.split("\n"),r=`${t} ${n}`;let l=!1,a=0,o="";for(const i of s)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${t}`,children:u})})})}},6393:(e,n,t)=>{t.d(n,{Z:()=>l});var s=t(4673),r=t(5893);const l=e=>{let{children:n,open:t,title:l}=e;return(0,r.jsx)(s.Z,{open:t,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/b80d201b.9b7031af.js b/assets/js/b80d201b.9b7031af.js
new file mode 100644
index 0000000000..8ff181a1ef
--- /dev/null
+++ b/assets/js/b80d201b.9b7031af.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6061],{1384:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var s=t(5893),r=t(1151),l=t(4866),a=t(5162),o=t(6393),i=t(4379);const c={sidebar_position:2,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="UPDATE",d={id:"examples/queries/prepared-statements/update",title:"UPDATE",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/update.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/update",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/update",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/update.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"SELECT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/select"},next:{title:"DELETE",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/delete"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"update",children:"UPDATE"}),"\n",(0,s.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\n const values = [20, 'Josh'];\n\n // highlight-next-line\n const [result, fields] = await connection.execute(sql, values);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\nconst values = [20, 'Josh'];\n\nconnection.execute(sql, values, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\n const values = [20, 'Josh'];\n\n // highlight-start\n const [result, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\nconst values = [20, 'Josh'];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["execute(options: ",(0,s.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\n const values = [20, 'Josh'];\n\n // highlight-start\n const [result, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,s.jsx)(a.Z,{value:"callback.js",children:(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const sql = 'UPDATE `users` SET `age` = ? WHERE `name` = ? LIMIT 1';\nconst values = [20, 'Josh'];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"result"}),": contains a ",(0,s.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["The connection used for the query (",(0,s.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"})," or ",(0,s.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,s.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,s.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,s.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,s.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,s.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(x,{...e})}):x(e)}},5162:(e,n,t)=>{t.d(n,{Z:()=>a});t(7294);var s=t(512);const r={tabItem:"tabItem_Ymn6"};var l=t(5893);function a(e){let{children:n,hidden:t,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,s.Z)(r.tabItem,a),hidden:t,children:n})}},4866:(e,n,t)=>{t.d(n,{Z:()=>q});var s=t(7294),r=t(512),l=t(2466),a=t(6550),o=t(469),i=t(1980),c=t(7392),u=t(12);function d(e){return s.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,s.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:t}=e;return(0,s.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:t,attributes:s,default:r}}=e;return{value:n,label:t,attributes:s,default:r}}))}(t);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function p(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:t}=e;const r=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,i._X)(l),(0,s.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function m(e){const{defaultValue:n,queryString:t=!1,groupId:r}=e,l=h(e),[a,i]=(0,s.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const s=t.find((e=>e.default))??t[0];if(!s)throw new Error("Unexpected error: 0 tabValues");return s.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:t,groupId:r}),[m,j]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,u.Nk)(t);return[r,(0,s.useCallback)((e=>{t&&l.set(e)}),[t,l])]}({groupId:r}),g=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{g&&i(g)}),[g]);return{selectedValue:a,selectValue:(0,s.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),j(e)}),[d,j,l]),tabValues:l}}var j=t(2389);const g={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=t(5893);function b(e){let{className:n,block:t,selectedValue:s,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,t=i.indexOf(n),r=o[t].value;r!==s&&(c(n),a(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=i.indexOf(e.currentTarget)+1;n=i[t]??i[0];break}case"ArrowLeft":{const t=i.indexOf(e.currentTarget)-1;n=i[t]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":t},n),children:o.map((e=>{let{value:n,label:t,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:s===n?0:-1,"aria-selected":s===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,r.Z)("tabs__item",g.tabItem,l?.className,{"tabs__item--active":s===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:r}=e;const l=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,s.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,s.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",g.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,j.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,t)=>{t.d(n,{I:()=>i});var s=t(7294),r=t(2263),l=t(9286),a=t(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:t,extractMethod:i,methodType:c}=e;const[u,d]=(0,s.useState)(""),[h,p]=(0,s.useState)(!0),[x,m]=(0,s.useState)(!0),{siteConfig:j}=(0,r.Z)(),g=j.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${g}${n}`:n;return(0,s.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,t)=>{const s=e.split("\n"),r=`${t} ${n}`;let l=!1,a=0,o="";for(const i of s)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${t}`,children:u})})})}},6393:(e,n,t)=>{t.d(n,{Z:()=>l});var s=t(4673),r=t(5893);const l=e=>{let{children:n,open:t,title:l}=e;return(0,r.jsx)(s.Z,{open:t,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/cdbda324.5473c064.js b/assets/js/cdbda324.5473c064.js
new file mode 100644
index 0000000000..26efbbbb05
--- /dev/null
+++ b/assets/js/cdbda324.5473c064.js
@@ -0,0 +1,2 @@
+/*! For license information please see cdbda324.5473c064.js.LICENSE.txt */
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4116],{1851:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>h,contentTitle:()=>i,default:()=>g,frontMatter:()=>c,metadata:()=>a,toc:()=>d});var s=r(5893),t=r(1151),o=r(6393),l=r(3901);const c={},i="How to handle errors?",a={id:"faq/how-to-handle-errors",title:"How to handle errors?",description:"This section details error handling techniques in MySQL2. It covers essential error management strategies for methods such as createConnection, createPool, createPoolCluster, execute and query.",source:"@site/docs/faq/how-to-handle-errors.mdx",sourceDirName:"faq",slug:"/faq/how-to-handle-errors",permalink:"/node-mysql2/docs/faq/how-to-handle-errors",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/faq/how-to-handle-errors.mdx",tags:[],version:"current",frontMatter:{},sidebar:"faq",previous:{title:"Introduction",permalink:"/node-mysql2/docs/faq"}},h={},d=[{value:"Using callbacks",id:"using-callbacks",level:2},{value:"Using promises",id:"using-promises",level:2},{value:"Related Links",id:"related-links",level:2}];function u(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"how-to-handle-errors",children:"How to handle errors?"}),"\n",(0,s.jsxs)(n.p,{children:["This section details error handling techniques in MySQL2. It covers essential error management strategies for methods such as ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"}),", ",(0,s.jsx)(n.code,{children:"createPoolCluster"}),", ",(0,s.jsx)(n.code,{children:"execute"})," and ",(0,s.jsx)(n.code,{children:"query"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"using-callbacks",children:"Using callbacks"}),"\n",(0,s.jsxs)(o.Z,{title:"createConnection",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested and confirmed as the correct answer."}),(0,s.jsx)(n.p,{children:"Handling connection errors by adding an error event listener:"}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconnection = mysql.createConnection({\n host: '',\n user: '',\n database: '',\n});\n\n// highlight-start\nconnection.addListener('error', (err) => {\n if (err instanceof Error) {\n console.log(`createConnection error:`, err);\n }\n});\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPool",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n host: '',\n user: '',\n database: '',\n});\n\npool.getConnection((err, connection) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('pool.getConnection error:', err);\n return;\n }\n // highlight-end\n});\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPoolCluster",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('NodeI', {\n host: '',\n user: '',\n database: '',\n});\n\npoolCluster.getConnection('NodeI', (err, connection) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('poolCluster.getConnection error:', err);\n return;\n }\n // highlight-end\n});\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"execute",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"execute"})," errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"connection.execute('SELEC 1 + 1', (err, rows) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('execute error:', err);\n return;\n }\n // highlight-end\n\n console.log(rows);\n});\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsxs)(o.Z,{title:"query",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"query"})," errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"connection.query('SELEC 1 + 1', (err, rows) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('query error:', err);\n return;\n }\n // highlight-end\n\n console.log(rows);\n});\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsx)(n.h2,{id:"using-promises",children:"Using promises"}),"\n",(0,s.jsxs)(o.Z,{title:"createConnection",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested and confirmed as the correct answer."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n const connection = await mysql.createConnection({\n host: '',\n user: '',\n database: '',\n });\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log(err);\n }\n}\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPool",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\nconst pool = mysql.createPool({\n host: '',\n user: '',\n database: '',\n});\n\ntry {\n const connection = await pool.getConnection();\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log(err);\n }\n}\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPoolCluster",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('NodeI', {\n host: '',\n user: '',\n database: '',\n});\n\ntry {\n await poolCluster.getConnection('NodeI');\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log('createConnection error:', err);\n }\n}\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"execute",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"execute"})," errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const [rows] = await connection.execute('SELEC 1 + 1');\n console.log(rows);\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log('execute error:', err);\n }\n}\n// highlight-end\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsxs)(o.Z,{title:"query",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"query"})," errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const [rows] = await connection.query('SELEC 1 + 1');\n console.log(rows);\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log('query error:', err);\n }\n}\n// highlight-end\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsx)("hr",{}),"\n",(0,s.jsx)(n.h2,{id:"related-links",children:"Related Links"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["Discussions","\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/discussions/1998",children:"#1998"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/discussions/2282",children:"#2282"})}),"\n"]}),"\n"]}),"\n"]})]})}function g(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},4673:(e,n,r)=>{r.d(n,{Z:()=>x});var s=r(7294),t=r(512),o=r(2389),l=r(6043);const c={details:"details_lb9f",isBrowser:"isBrowser_bmU9",collapsibleContent:"collapsibleContent_i85q"};var i=r(5893);function a(e){return!!e&&("SUMMARY"===e.tagName||a(e.parentElement))}function h(e,n){return!!e&&(e===n||h(e.parentElement,n))}function d(e){let{summary:n,children:r,...d}=e;const u=(0,o.Z)(),g=(0,s.useRef)(null),{collapsed:x,setCollapsed:j}=(0,l.u)({initialState:!d.open}),[p,m]=(0,s.useState)(d.open),y=s.isValidElement(n)?n:(0,i.jsx)("summary",{children:n??"Details"});return(0,i.jsxs)("details",{...d,ref:g,open:p,"data-collapsed":x,className:(0,t.Z)(c.details,u&&c.isBrowser,d.className),onMouseDown:e=>{a(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const n=e.target;a(n)&&h(n,g.current)&&(e.preventDefault(),x?(j(!1),m(!0)):j(!0))},children:[y,(0,i.jsx)(l.z,{lazy:!1,collapsed:x,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{j(e),m(!e)},children:(0,i.jsx)("div",{className:c.collapsibleContent,children:r})})]})}const u={details:"details_b_Ee"},g="alert alert--info";function x(e){let{...n}=e;return(0,i.jsx)(d,{...n,className:(0,t.Z)(g,u.details,n.className)})}},6393:(e,n,r)=>{r.d(n,{Z:()=>o});var s=r(4673),t=r(5893);const o=e=>{let{children:n,open:r,title:o}=e;return(0,t.jsx)(s.Z,{open:r,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:o})}),children:(0,t.jsx)("section",{children:n})})}},3901:(e,n,r)=>{r.d(n,{X:()=>u});var s=r(3692),t=r(4297);const o=(0,t.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),l=(0,t.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),c=(0,t.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),i=(0,t.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),a=(0,t.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),h=(0,t.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var d=r(5893);const u=e=>{let{level:n,message:r}=e;const t={0:{title:"Deprecated",icon:(0,d.jsx)(o,{})},1:{title:"Experimental",icon:(0,d.jsx)(l,{})},1.1:{title:"Early Development",icon:(0,d.jsx)(c,{})},1.2:{title:"Release Candidate",icon:(0,d.jsx)(i,{})},2:{title:"Stable",icon:(0,d.jsx)(a,{})},3:{title:"Legacy",icon:(0,d.jsx)(h,{})}};return(0,d.jsxs)("section",{className:"stability","data-level":n,children:[(0,d.jsx)(s.Z,{to:"/docs/stability-badges",children:(0,d.jsxs)("header",{children:[(0,d.jsx)("strong",{children:n}),(0,d.jsx)("span",{children:t[n].title}),t[n].icon]})}),r?(0,d.jsx)("p",{children:r}):null]})}},4297:(e,n,r)=>{r.d(n,{Z:()=>o});var s=r(7294),t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const o=(e,n)=>{const r=(0,s.forwardRef)((({color:r="currentColor",size:o=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:i="",children:a,...h},d)=>{return(0,s.createElement)("svg",{ref:d,...t,width:o,height:o,stroke:r,strokeWidth:c?24*Number(l)/Number(o):l,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,i].join(" "),...h},[...n.map((([e,n])=>(0,s.createElement)(e,n))),...Array.isArray(a)?a:[a]]);var u}));return r.displayName=`${e}`,r}},1151:(e,n,r)=>{r.d(n,{Z:()=>c,a:()=>l});var s=r(7294);const t={},o=s.createContext(t);function l(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:l(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/cdbda324.fbef41bf.js.LICENSE.txt b/assets/js/cdbda324.5473c064.js.LICENSE.txt
similarity index 100%
rename from assets/js/cdbda324.fbef41bf.js.LICENSE.txt
rename to assets/js/cdbda324.5473c064.js.LICENSE.txt
diff --git a/assets/js/cdbda324.fbef41bf.js b/assets/js/cdbda324.fbef41bf.js
deleted file mode 100644
index 65b1abd1de..0000000000
--- a/assets/js/cdbda324.fbef41bf.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! For license information please see cdbda324.fbef41bf.js.LICENSE.txt */
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4116],{1851:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>h,contentTitle:()=>i,default:()=>g,frontMatter:()=>c,metadata:()=>a,toc:()=>d});var s=r(5893),t=r(1151),o=r(6393),l=r(3901);const c={},i="How to handle errors?",a={id:"faq/how-to-handle-errors",title:"How to handle errors?",description:"This section details error handling techniques in MySQL2. It covers essential error management strategies for methods such as createConnection, createPool, createPoolCluster, execute and query.",source:"@site/docs/faq/how-to-handle-errors.mdx",sourceDirName:"faq",slug:"/faq/how-to-handle-errors",permalink:"/node-mysql2/docs/faq/how-to-handle-errors",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/faq/how-to-handle-errors.mdx",tags:[],version:"current",frontMatter:{},sidebar:"faq",previous:{title:"Introduction",permalink:"/node-mysql2/docs/faq"}},h={},d=[{value:"Using callbacks",id:"using-callbacks",level:2},{value:"Using promises",id:"using-promises",level:2},{value:"Related Links",id:"related-links",level:2}];function u(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"how-to-handle-errors",children:"How to handle errors?"}),"\n",(0,s.jsxs)(n.p,{children:["This section details error handling techniques in MySQL2. It covers essential error management strategies for methods such as ",(0,s.jsx)(n.code,{children:"createConnection"}),", ",(0,s.jsx)(n.code,{children:"createPool"}),", ",(0,s.jsx)(n.code,{children:"createPoolCluster"}),", ",(0,s.jsx)(n.code,{children:"execute"})," and ",(0,s.jsx)(n.code,{children:"query"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"using-callbacks",children:"Using callbacks"}),"\n",(0,s.jsxs)(o.Z,{title:"createConnection",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested and confirmed as the correct answer."}),(0,s.jsx)(n.p,{children:"Handling connection errors by adding an error event listener:"}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconnection = mysql.createConnection({\n host: '',\n user: '',\n database: '',\n});\n\n// highlight-start\nconnection.addListener('error', (err) => {\n if (err instanceof Error) {\n console.log(`createConnection error:`, err);\n }\n});\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPool",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst pool = mysql.createPool({\n host: '',\n user: '',\n database: '',\n});\n\npool.getConnection((err, connection) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('pool.getConnection error:', err);\n return;\n }\n // highlight-end\n});\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPoolCluster",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"const mysql = require('mysql2');\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('NodeI', {\n host: '',\n user: '',\n database: '',\n});\n\npoolCluster.getConnection('NodeI', (err, connection) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('poolCluster.getConnection error:', err);\n return;\n }\n // highlight-end\n});\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"execute",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"execute"})," errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"connection.execute('SELEC 1 + 1', (err, rows) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('execute error:', err);\n return;\n }\n // highlight-end\n\n console.log(rows);\n});\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsxs)(o.Z,{title:"query",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"query"})," errors through callback's ",(0,s.jsx)(n.code,{children:"err"})," parameter:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"connection.query('SELEC 1 + 1', (err, rows) => {\n // highlight-start\n if (err instanceof Error) {\n console.log('query error:', err);\n return;\n }\n // highlight-end\n\n console.log(rows);\n});\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsx)(n.h2,{id:"using-promises",children:"Using promises"}),"\n",(0,s.jsxs)(o.Z,{title:"createConnection",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested and confirmed as the correct answer."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\ntry {\n const connection = await mysql.createConnection({\n host: '',\n user: '',\n database: '',\n });\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log(err);\n }\n}\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPool",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\nconst pool = mysql.createPool({\n host: '',\n user: '',\n database: '',\n});\n\ntry {\n const connection = await pool.getConnection();\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log(err);\n }\n}\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"createPoolCluster",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling connection errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import mysql from 'mysql2/promise';\n\nconst poolCluster = mysql.createPoolCluster();\n\npoolCluster.add('NodeI', {\n host: '',\n user: '',\n database: '',\n});\n\ntry {\n await poolCluster.getConnection('NodeI');\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log('createConnection error:', err);\n }\n}\n// highlight-end\n"})})]}),"\n",(0,s.jsxs)(o.Z,{title:"execute",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"execute"})," errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const [rows] = await connection.execute('SELEC 1 + 1');\n console.log(rows);\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log('execute error:', err);\n }\n}\n// highlight-end\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsxs)(o.Z,{title:"query",children:[(0,s.jsx)(l.X,{level:2,message:"This solution has been tested."}),(0,s.jsxs)(n.p,{children:["Handling ",(0,s.jsx)(n.code,{children:"query"})," errors through ",(0,s.jsx)(n.code,{children:"try-catch"})," block:"]}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"try {\n const [rows] = await connection.query('SELEC 1 + 1');\n console.log(rows);\n // highlight-start\n} catch (err) {\n if (err instanceof Error) {\n console.log('query error:', err);\n }\n}\n// highlight-end\n"})}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["It will work for both ",(0,s.jsx)(n.strong,{children:"createConnection"}),", ",(0,s.jsx)(n.strong,{children:"createPool"})," and ",(0,s.jsx)(n.strong,{children:"createPoolCluster"})," connections."]}),"\n"]})]}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.h2,{id:"related-links",children:"Related Links"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["Discussions","\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/discussions/1998",children:"#1998"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2/discussions/2282",children:"#2282"})}),"\n"]}),"\n"]}),"\n"]})]})}function g(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},4673:(e,n,r)=>{r.d(n,{Z:()=>x});var s=r(7294),t=r(512),o=r(2389),l=r(6043);const c={details:"details_lb9f",isBrowser:"isBrowser_bmU9",collapsibleContent:"collapsibleContent_i85q"};var i=r(5893);function a(e){return!!e&&("SUMMARY"===e.tagName||a(e.parentElement))}function h(e,n){return!!e&&(e===n||h(e.parentElement,n))}function d(e){let{summary:n,children:r,...d}=e;const u=(0,o.Z)(),g=(0,s.useRef)(null),{collapsed:x,setCollapsed:j}=(0,l.u)({initialState:!d.open}),[p,m]=(0,s.useState)(d.open),y=s.isValidElement(n)?n:(0,i.jsx)("summary",{children:n??"Details"});return(0,i.jsxs)("details",{...d,ref:g,open:p,"data-collapsed":x,className:(0,t.Z)(c.details,u&&c.isBrowser,d.className),onMouseDown:e=>{a(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const n=e.target;a(n)&&h(n,g.current)&&(e.preventDefault(),x?(j(!1),m(!0)):j(!0))},children:[y,(0,i.jsx)(l.z,{lazy:!1,collapsed:x,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{j(e),m(!e)},children:(0,i.jsx)("div",{className:c.collapsibleContent,children:r})})]})}const u={details:"details_b_Ee"},g="alert alert--info";function x(e){let{...n}=e;return(0,i.jsx)(d,{...n,className:(0,t.Z)(g,u.details,n.className)})}},6393:(e,n,r)=>{r.d(n,{Z:()=>o});var s=r(4673),t=r(5893);const o=e=>{let{children:n,open:r,title:o}=e;return(0,t.jsx)(s.Z,{open:r,className:"faq",summary:(0,t.jsx)("summary",{children:(0,t.jsx)("strong",{children:o})}),children:(0,t.jsx)("section",{children:n})})}},3901:(e,n,r)=>{r.d(n,{X:()=>u});var s=r(3692),t=r(4297);const o=(0,t.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),l=(0,t.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),c=(0,t.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),i=(0,t.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),a=(0,t.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),h=(0,t.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var d=r(5893);const u=e=>{let{level:n,message:r}=e;const t={0:{title:"Deprecated",icon:(0,d.jsx)(o,{})},1:{title:"Experimental",icon:(0,d.jsx)(l,{})},1.1:{title:"Early Development",icon:(0,d.jsx)(c,{})},1.2:{title:"Release Candidate",icon:(0,d.jsx)(i,{})},2:{title:"Stable",icon:(0,d.jsx)(a,{})},3:{title:"Legacy",icon:(0,d.jsx)(h,{})}};return(0,d.jsxs)("section",{className:"stability","data-level":n,children:[(0,d.jsx)(s.Z,{to:"/docs/stability-badges",children:(0,d.jsxs)("header",{children:[(0,d.jsx)("strong",{children:n}),(0,d.jsx)("span",{children:t[n].title}),t[n].icon]})}),r?(0,d.jsx)("p",{children:r}):null]})}},4297:(e,n,r)=>{r.d(n,{Z:()=>o});var s=r(7294),t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const o=(e,n)=>{const r=(0,s.forwardRef)((({color:r="currentColor",size:o=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:i="",children:a,...h},d)=>{return(0,s.createElement)("svg",{ref:d,...t,width:o,height:o,stroke:r,strokeWidth:c?24*Number(l)/Number(o):l,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,i].join(" "),...h},[...n.map((([e,n])=>(0,s.createElement)(e,n))),...Array.isArray(a)?a:[a]]);var u}));return r.displayName=`${e}`,r}},1151:(e,n,r)=>{r.d(n,{Z:()=>c,a:()=>l});var s=r(7294);const t={},o=s.createContext(t);function l(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:l(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/db044f71.a1084822.js b/assets/js/db044f71.a1084822.js
deleted file mode 100644
index 0439a549a2..0000000000
--- a/assets/js/db044f71.a1084822.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! For license information please see db044f71.a1084822.js.LICENSE.txt */
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6159],{8009:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>d});var a=s(5893),i=s(1151),n=s(3901);const r={},o="Stability Badges",l={id:"stability-badges",title:"Stability Badges",description:"The Stability Badges are indications of a section's stability.",source:"@site/docs/stability-badges.mdx",sourceDirName:".",slug:"/stability-badges",permalink:"/node-mysql2/docs/stability-badges",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/stability-badges.mdx",tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"History and Why MySQL2",permalink:"/node-mysql2/docs/history-and-why-mysq2"},next:{title:"Introduction",permalink:"/node-mysql2/docs/documentation"}},c={},d=[];function h(e){const t={blockquote:"blockquote",h1:"h1",hr:"hr",li:"li",p:"p",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.h1,{id:"stability-badges",children:"Stability Badges"}),"\n",(0,a.jsxs)(t.p,{children:["The ",(0,a.jsx)(t.strong,{children:"Stability Badges"})," are indications of a section's stability."]}),"\n",(0,a.jsx)(t.p,{children:"The stability indices are as follows:"}),"\n",(0,a.jsx)(n.X,{level:0,message:"The feature might generate warnings and does not assure backward compatibility."}),"\n",(0,a.jsx)(t.hr,{}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Experimental"}),": These features are not bound by semantic versioning. They may undergo non-backward compatible changes or be removed in future releases. Their use in production is discouraged."]}),"\n",(0,a.jsxs)(t.blockquote,{children:["\n",(0,a.jsx)(t.p,{children:"Use caution with Experimental features, especially in libraries. Users might not expect changes from these unstable features. To reduce surprises, consider using a command-line flag for Experimental features."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Experimental features are classified into stages:"}),"\n",(0,a.jsx)(n.X,{level:1,message:"Experimental features at this stage are currently in development and prone to considerable changes."}),"\n",(0,a.jsx)(n.X,{level:1.1,message:"Experimental features at this stage are approaching minimum viability."}),"\n",(0,a.jsx)(n.X,{level:1.2,message:"Experimental features are close to reaching stability. Major changes are not expected, but they could still occur based on user feedback. Testing and feedback are important to ascertain the readiness of these features for stable classification."}),"\n",(0,a.jsx)(t.hr,{}),"\n",(0,a.jsx)(n.X,{level:2,message:"Compatibility with the MySQL ecosystem is a high priority."}),"\n",(0,a.jsx)(t.hr,{}),"\n",(0,a.jsx)(n.X,{level:3,message:"This feature, while not likely to be removed and still subject to semantic versioning, is not under active maintenance and other options are available."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Features are classified as legacy instead of deprecated when they cause no harm and have widespread use in the MySQL ecosystem. It's unlikely that bugs in legacy features will be addressed."}),"\n"]})]})}function u(e={}){const{wrapper:t}={...(0,i.a)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(h,{...e})}):h(e)}},3901:(e,t,s)=>{s.d(t,{X:()=>u});var a=s(3692),i=s(4297);const n=(0,i.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),r=(0,i.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),o=(0,i.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),l=(0,i.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),c=(0,i.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),d=(0,i.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var h=s(5893);const u=e=>{let{level:t,message:s}=e;const i={0:{title:"Deprecated",icon:(0,h.jsx)(n,{})},1:{title:"Experimental",icon:(0,h.jsx)(r,{})},1.1:{title:"Early Development",icon:(0,h.jsx)(o,{})},1.2:{title:"Release Candidate",icon:(0,h.jsx)(l,{})},2:{title:"Stable",icon:(0,h.jsx)(c,{})},3:{title:"Legacy",icon:(0,h.jsx)(d,{})}};return(0,h.jsxs)("section",{className:"stability","data-level":t,children:[(0,h.jsx)(a.Z,{to:"/docs/stability-badges",children:(0,h.jsxs)("header",{children:[(0,h.jsx)("strong",{children:t}),(0,h.jsx)("span",{children:i[t].title}),i[t].icon]})}),s?(0,h.jsx)("p",{children:s}):null]})}},4297:(e,t,s)=>{s.d(t,{Z:()=>n});var a=s(7294),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const n=(e,t)=>{const s=(0,a.forwardRef)((({color:s="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,...d},h)=>{return(0,a.createElement)("svg",{ref:h,...i,width:n,height:n,stroke:s,strokeWidth:o?24*Number(r)/Number(n):r,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,l].join(" "),...d},[...t.map((([e,t])=>(0,a.createElement)(e,t))),...Array.isArray(c)?c:[c]]);var u}));return s.displayName=`${e}`,s}},1151:(e,t,s)=>{s.d(t,{Z:()=>o,a:()=>r});var a=s(7294);const i={},n=a.createContext(i);function r(e){const t=a.useContext(n);return a.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(n.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
diff --git a/zh-CN/assets/js/db044f71.ad539a4f.js b/assets/js/db044f71.bd4db484.js
similarity index 88%
rename from zh-CN/assets/js/db044f71.ad539a4f.js
rename to assets/js/db044f71.bd4db484.js
index 164ede27bb..e8b6b9613d 100644
--- a/zh-CN/assets/js/db044f71.ad539a4f.js
+++ b/assets/js/db044f71.bd4db484.js
@@ -1,2 +1,2 @@
-/*! For license information please see db044f71.ad539a4f.js.LICENSE.txt */
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6159],{8009:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>d});var a=s(5893),i=s(1151),n=s(3901);const r={},o="Stability Badges",l={id:"stability-badges",title:"Stability Badges",description:"The Stability Badges are indications of a section's stability.",source:"@site/docs/stability-badges.mdx",sourceDirName:".",slug:"/stability-badges",permalink:"/node-mysql2/zh-CN/docs/stability-badges",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/stability-badges.mdx",tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"MySQL2\u7684\u5386\u53f2\u4ee5\u53ca\u9009\u62e9\u539f\u56e0",permalink:"/node-mysql2/zh-CN/docs/history-and-why-mysq2"},next:{title:"Introduction",permalink:"/node-mysql2/zh-CN/docs/documentation"}},c={},d=[];function h(e){const t={blockquote:"blockquote",h1:"h1",hr:"hr",li:"li",p:"p",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.h1,{id:"stability-badges",children:"Stability Badges"}),"\n",(0,a.jsxs)(t.p,{children:["The ",(0,a.jsx)(t.strong,{children:"Stability Badges"})," are indications of a section's stability."]}),"\n",(0,a.jsx)(t.p,{children:"The stability indices are as follows:"}),"\n",(0,a.jsx)(n.X,{level:0,message:"The feature might generate warnings and does not assure backward compatibility."}),"\n",(0,a.jsx)(t.hr,{}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Experimental"}),": These features are not bound by semantic versioning. They may undergo non-backward compatible changes or be removed in future releases. Their use in production is discouraged."]}),"\n",(0,a.jsxs)(t.blockquote,{children:["\n",(0,a.jsx)(t.p,{children:"Use caution with Experimental features, especially in libraries. Users might not expect changes from these unstable features. To reduce surprises, consider using a command-line flag for Experimental features."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Experimental features are classified into stages:"}),"\n",(0,a.jsx)(n.X,{level:1,message:"Experimental features at this stage are currently in development and prone to considerable changes."}),"\n",(0,a.jsx)(n.X,{level:1.1,message:"Experimental features at this stage are approaching minimum viability."}),"\n",(0,a.jsx)(n.X,{level:1.2,message:"Experimental features are close to reaching stability. Major changes are not expected, but they could still occur based on user feedback. Testing and feedback are important to ascertain the readiness of these features for stable classification."}),"\n",(0,a.jsx)(t.hr,{}),"\n",(0,a.jsx)(n.X,{level:2,message:"Compatibility with the MySQL ecosystem is a high priority."}),"\n",(0,a.jsx)(t.hr,{}),"\n",(0,a.jsx)(n.X,{level:3,message:"This feature, while not likely to be removed and still subject to semantic versioning, is not under active maintenance and other options are available."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Features are classified as legacy instead of deprecated when they cause no harm and have widespread use in the MySQL ecosystem. It's unlikely that bugs in legacy features will be addressed."}),"\n"]})]})}function u(e={}){const{wrapper:t}={...(0,i.a)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(h,{...e})}):h(e)}},3901:(e,t,s)=>{s.d(t,{X:()=>u});var a=s(3692),i=s(4297);const n=(0,i.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),r=(0,i.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),o=(0,i.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),l=(0,i.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),c=(0,i.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),d=(0,i.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var h=s(5893);const u=e=>{let{level:t,message:s}=e;const i={0:{title:"Deprecated",icon:(0,h.jsx)(n,{})},1:{title:"Experimental",icon:(0,h.jsx)(r,{})},1.1:{title:"Early Development",icon:(0,h.jsx)(o,{})},1.2:{title:"Release Candidate",icon:(0,h.jsx)(l,{})},2:{title:"Stable",icon:(0,h.jsx)(c,{})},3:{title:"Legacy",icon:(0,h.jsx)(d,{})}};return(0,h.jsxs)("section",{className:"stability","data-level":t,children:[(0,h.jsx)(a.Z,{to:"/docs/stability-badges",children:(0,h.jsxs)("header",{children:[(0,h.jsx)("strong",{children:t}),(0,h.jsx)("span",{children:i[t].title}),i[t].icon]})}),s?(0,h.jsx)("p",{children:s}):null]})}},4297:(e,t,s)=>{s.d(t,{Z:()=>n});var a=s(7294),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const n=(e,t)=>{const s=(0,a.forwardRef)((({color:s="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,...d},h)=>{return(0,a.createElement)("svg",{ref:h,...i,width:n,height:n,stroke:s,strokeWidth:o?24*Number(r)/Number(n):r,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,l].join(" "),...d},[...t.map((([e,t])=>(0,a.createElement)(e,t))),...Array.isArray(c)?c:[c]]);var u}));return s.displayName=`${e}`,s}},1151:(e,t,s)=>{s.d(t,{Z:()=>o,a:()=>r});var a=s(7294);const i={},n=a.createContext(i);function r(e){const t=a.useContext(n);return a.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(n.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
+/*! For license information please see db044f71.bd4db484.js.LICENSE.txt */
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6159],{8009:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>d});var a=s(5893),i=s(1151),n=s(3901);const r={},o="Stability Badges",l={id:"stability-badges",title:"Stability Badges",description:"The Stability Badges are indications of a section's stability.",source:"@site/docs/stability-badges.mdx",sourceDirName:".",slug:"/stability-badges",permalink:"/node-mysql2/docs/stability-badges",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/stability-badges.mdx",tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"History and Why MySQL2",permalink:"/node-mysql2/docs/history-and-why-mysq2"},next:{title:"Introduction",permalink:"/node-mysql2/docs/documentation"}},c={},d=[];function h(e){const t={blockquote:"blockquote",h1:"h1",li:"li",p:"p",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.h1,{id:"stability-badges",children:"Stability Badges"}),"\n",(0,a.jsxs)(t.p,{children:["The ",(0,a.jsx)(t.strong,{children:"Stability Badges"})," are indications of a section's stability."]}),"\n",(0,a.jsx)(t.p,{children:"The stability indices are as follows:"}),"\n",(0,a.jsx)(n.X,{level:0,message:"The feature might generate warnings and does not assure backward compatibility."}),"\n",(0,a.jsx)("hr",{}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.strong,{children:"Experimental"}),": These features are not bound by semantic versioning. They may undergo non-backward compatible changes or be removed in future releases. Their use in production is discouraged."]}),"\n",(0,a.jsxs)(t.blockquote,{children:["\n",(0,a.jsx)(t.p,{children:"Use caution with Experimental features, especially in libraries. Users might not expect changes from these unstable features. To reduce surprises, consider using a command-line flag for Experimental features."}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Experimental features are classified into stages:"}),"\n",(0,a.jsx)(n.X,{level:1,message:"Experimental features at this stage are currently in development and prone to considerable changes."}),"\n",(0,a.jsx)(n.X,{level:1.1,message:"Experimental features at this stage are approaching minimum viability."}),"\n",(0,a.jsx)(n.X,{level:1.2,message:"Experimental features are close to reaching stability. Major changes are not expected, but they could still occur based on user feedback. Testing and feedback are important to ascertain the readiness of these features for stable classification."}),"\n",(0,a.jsx)("hr",{}),"\n",(0,a.jsx)(n.X,{level:2,message:"Compatibility with the MySQL ecosystem is a high priority."}),"\n",(0,a.jsx)("hr",{}),"\n",(0,a.jsx)(n.X,{level:3,message:"This feature, while not likely to be removed and still subject to semantic versioning, is not under active maintenance and other options are available."}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsx)(t.li,{children:"Features are classified as legacy instead of deprecated when they cause no harm and have widespread use in the MySQL ecosystem. It's unlikely that bugs in legacy features will be addressed."}),"\n"]})]})}function u(e={}){const{wrapper:t}={...(0,i.a)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(h,{...e})}):h(e)}},3901:(e,t,s)=>{s.d(t,{X:()=>u});var a=s(3692),i=s(4297);const n=(0,i.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),r=(0,i.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),o=(0,i.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),l=(0,i.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),c=(0,i.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),d=(0,i.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var h=s(5893);const u=e=>{let{level:t,message:s}=e;const i={0:{title:"Deprecated",icon:(0,h.jsx)(n,{})},1:{title:"Experimental",icon:(0,h.jsx)(r,{})},1.1:{title:"Early Development",icon:(0,h.jsx)(o,{})},1.2:{title:"Release Candidate",icon:(0,h.jsx)(l,{})},2:{title:"Stable",icon:(0,h.jsx)(c,{})},3:{title:"Legacy",icon:(0,h.jsx)(d,{})}};return(0,h.jsxs)("section",{className:"stability","data-level":t,children:[(0,h.jsx)(a.Z,{to:"/docs/stability-badges",children:(0,h.jsxs)("header",{children:[(0,h.jsx)("strong",{children:t}),(0,h.jsx)("span",{children:i[t].title}),i[t].icon]})}),s?(0,h.jsx)("p",{children:s}):null]})}},4297:(e,t,s)=>{s.d(t,{Z:()=>n});var a=s(7294),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const n=(e,t)=>{const s=(0,a.forwardRef)((({color:s="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,...d},h)=>{return(0,a.createElement)("svg",{ref:h,...i,width:n,height:n,stroke:s,strokeWidth:o?24*Number(r)/Number(n):r,className:["lucide",`lucide-${u=e,u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,l].join(" "),...d},[...t.map((([e,t])=>(0,a.createElement)(e,t))),...Array.isArray(c)?c:[c]]);var u}));return s.displayName=`${e}`,s}},1151:(e,t,s)=>{s.d(t,{Z:()=>o,a:()=>r});var a=s(7294);const i={},n=a.createContext(i);function r(e){const t=a.useContext(n);return a.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(n.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/db044f71.a1084822.js.LICENSE.txt b/assets/js/db044f71.bd4db484.js.LICENSE.txt
similarity index 100%
rename from assets/js/db044f71.a1084822.js.LICENSE.txt
rename to assets/js/db044f71.bd4db484.js.LICENSE.txt
diff --git a/assets/js/e19cd79a.cb693707.js b/assets/js/e19cd79a.cb693707.js
new file mode 100644
index 0000000000..764fd5677e
--- /dev/null
+++ b/assets/js/e19cd79a.cb693707.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1429],{2998:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var t=s(5893),r=s(1151),l=s(4866),a=s(5162),o=s(6393),i=s(4379);const c={sidebar_position:0,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="INSERT",d={id:"examples/queries/prepared-statements/insert",title:"INSERT",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/insert.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/insert",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/insert",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/insert.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"Prepared Statements",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/"},next:{title:"SELECT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/select"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"insert",children:"INSERT"}),"\n",(0,t.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\n const values = ['Josh', 19, 'Page', 45];\n\n // highlight-next-line\n const [result, fields] = await connection.execute(sql, values);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\nconst values = ['Josh', 19, 'Page', 45];\n\nconnection.execute(sql, values, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["execute(options: ",(0,t.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\n const values = ['Josh', 19, 'Page', 45];\n\n // highlight-start\n const [result, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\nconst values = ['Josh', 19, 'Page', 45];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["execute(options: ",(0,t.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\n const values = ['Josh', 19, 'Page', 45];\n\n // highlight-start\n const [result, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\nconst values = ['Josh', 19, 'Page', 45];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,t.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,t.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(x,{...e})}):x(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>a});s(7294);var t=s(512);const r={tabItem:"tabItem_Ymn6"};var l=s(5893);function a(e){let{children:n,hidden:s,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,t.Z)(r.tabItem,a),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>q});var t=s(7294),r=s(512),l=s(2466),a=s(6550),o=s(469),i=s(1980),c=s(7392),u=s(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function p(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:s}=e;const r=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(l),(0,t.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,l=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:s,groupId:r}),[m,g]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,u.Nk)(s);return[r,(0,t.useCallback)((e=>{s&&l.set(e)}),[s,l])]}({groupId:r}),j=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function b(e){let{className:n,block:s,selectedValue:t,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,s=i.indexOf(n),r=o[s].value;r!==t&&(c(n),a(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":s},n),children:o.map((e=>{let{value:n,label:s,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,r.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:r}=e;const l=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,g.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>i});var t=s(7294),r=s(2263),l=s(9286),a=s(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:s,extractMethod:i,methodType:c}=e;const[u,d]=(0,t.useState)(""),[h,p]=(0,t.useState)(!0),[x,m]=(0,t.useState)(!0),{siteConfig:g}=(0,r.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,t.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,s)=>{const t=e.split("\n"),r=`${s} ${n}`;let l=!1,a=0,o="";for(const i of t)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${s}`,children:u})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>l});var t=s(4673),r=s(5893);const l=e=>{let{children:n,open:s,title:l}=e;return(0,r.jsx)(t.Z,{open:s,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/e19cd79a.d82572fa.js b/assets/js/e19cd79a.d82572fa.js
deleted file mode 100644
index b4363af77e..0000000000
--- a/assets/js/e19cd79a.d82572fa.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1429],{2998:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>c,metadata:()=>d,toc:()=>p});var t=s(5893),r=s(1151),l=s(4866),a=s(5162),o=s(6393),i=s(4379);const c={sidebar_position:0,tags:["Prepared Statements","Placeholders","Parameters","execute"]},u="INSERT",d={id:"examples/queries/prepared-statements/insert",title:"INSERT",description:"execute(sql, values)",source:"@site/docs/examples/queries/prepared-statements/insert.mdx",sourceDirName:"examples/queries/prepared-statements",slug:"/examples/queries/prepared-statements/insert",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/insert",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/examples/queries/prepared-statements/insert.mdx",tags:[{label:"Prepared Statements",permalink:"/node-mysql2/docs/tags/prepared-statements"},{label:"Placeholders",permalink:"/node-mysql2/docs/tags/placeholders"},{label:"Parameters",permalink:"/node-mysql2/docs/tags/parameters"},{label:"execute",permalink:"/node-mysql2/docs/tags/execute"}],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0,tags:["Prepared Statements","Placeholders","Parameters","execute"]},sidebar:"examples",previous:{title:"Prepared Statements",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/"},next:{title:"SELECT",permalink:"/node-mysql2/docs/examples/queries/prepared-statements/select"}},h={},p=[{value:"execute(sql, values)",id:"executesql-values",level:2},{value:"execute(options)",id:"executeoptions",level:2},{value:"execute(options, values)",id:"executeoptions-values",level:2},{value:"Glossary",id:"glossary",level:2},{value:"ResultSetHeader",id:"resultsetheader",level:3},{value:"QueryOptions",id:"queryoptions",level:3}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"insert",children:"INSERT"}),"\n",(0,t.jsx)(n.h2,{id:"executesql-values",children:"execute(sql, values)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.strong,{children:"execute(sql: string, values: any[])"})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\n const values = ['Josh', 19, 'Page', 45];\n\n // highlight-next-line\n const [result, fields] = await connection.execute(sql, values);\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\nconst values = ['Josh', 19, 'Page', 45];\n\nconnection.execute(sql, values, (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n});\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"executeoptions",children:"execute(options)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["execute(options: ",(0,t.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),")"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\n const values = ['Josh', 19, 'Page', 45];\n\n // highlight-start\n const [result, fields] = await connection.execute({\n sql,\n values,\n // ... other options\n });\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\nconst values = ['Josh', 19, 'Page', 45];\n\nconnection.execute(\n {\n sql,\n values,\n // ... other options\n },\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"executeoptions-values",children:"execute(options, values)"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["execute(options: ",(0,t.jsx)(n.a,{href:"#queryoptions",children:"QueryOptions"}),", values: any[])"]})}),"\n"]}),"\n",(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(a.Z,{value:"promise.js",default:!0,children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"try {\n const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\n const values = ['Josh', 19, 'Page', 45];\n\n // highlight-start\n const [result, fields] = await connection.execute(\n {\n sql,\n // ... other options\n },\n values\n );\n // highlight-end\n\n console.log(result);\n console.log(fields);\n} catch (err) {\n console.log(err);\n}\n"})})}),(0,t.jsx)(a.Z,{value:"callback.js",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:"const sql = 'INSERT INTO `users`(`name`, `age`) VALUES (?, ?), (?,?)';\nconst values = ['Josh', 19, 'Page', 45];\n\nconnection.execute(\n {\n sql,\n // ... other options\n },\n values,\n (err, result, fields) => {\n if (err instanceof Error) {\n console.log(err);\n return;\n }\n\n console.log(result);\n console.log(fields);\n }\n);\n"})})})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"result"}),": contains a ",(0,t.jsx)(n.a,{href:"#resultsetheader",children:"ResultSetHeader"})," object, which provides details about the operation executed by the server."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.strong,{children:"fields"})," contains extra meta data about the operation, if available"]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["The connection used for the query (",(0,t.jsx)(n.code,{children:"execute"}),") can be obtained through the ",(0,t.jsx)(n.code,{children:"createConnection"}),", ",(0,t.jsx)(n.code,{children:"createPool"})," or ",(0,t.jsx)(n.code,{children:"createPoolCluster"})," methods."]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"glossary",children:"Glossary"}),"\n",(0,t.jsx)(n.h3,{id:"resultsetheader",children:"ResultSetHeader"}),"\n",(0,t.jsx)(o.Z,{title:"ResultSetHeader Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts",extractMethod:"ResultSetHeader",methodType:"interface"})}),"\n",(0,t.jsx)(n.h3,{id:"queryoptions",children:"QueryOptions"}),"\n",(0,t.jsx)(o.Z,{title:"QueryOptions Specification",children:(0,t.jsx)(i.I,{language:"ts",url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/typings/mysql/lib/protocol/sequences/Query.d.ts",extractMethod:"QueryOptions",methodType:"interface"})})]})}function m(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(x,{...e})}):x(e)}},5162:(e,n,s)=>{s.d(n,{Z:()=>a});s(7294);var t=s(512);const r={tabItem:"tabItem_Ymn6"};var l=s(5893);function a(e){let{children:n,hidden:s,className:a}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,t.Z)(r.tabItem,a),hidden:s,children:n})}},4866:(e,n,s)=>{s.d(n,{Z:()=>q});var t=s(7294),r=s(512),l=s(2466),a=s(6550),o=s(469),i=s(1980),c=s(7392),u=s(12);function d(e){return t.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,t.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function h(e){const{values:n,children:s}=e;return(0,t.useMemo)((()=>{const e=n??function(e){return d(e).map((e=>{let{props:{value:n,label:s,attributes:t,default:r}}=e;return{value:n,label:s,attributes:t,default:r}}))}(s);return function(e){const n=(0,c.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,s])}function p(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function x(e){let{queryString:n=!1,groupId:s}=e;const r=(0,a.k6)(),l=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return s??null}({queryString:n,groupId:s});return[(0,i._X)(l),(0,t.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(r.location.search);n.set(l,e),r.replace({...r.location,search:n.toString()})}),[l,r])]}function m(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,l=h(e),[a,i]=(0,t.useState)((()=>function(e){let{defaultValue:n,tabValues:s}=e;if(0===s.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!p({value:n,tabValues:s}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${s.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const t=s.find((e=>e.default))??s[0];if(!t)throw new Error("Unexpected error: 0 tabValues");return t.value}({defaultValue:n,tabValues:l}))),[c,d]=x({queryString:s,groupId:r}),[m,g]=function(e){let{groupId:n}=e;const s=function(e){return e?`docusaurus.tab.${e}`:null}(n),[r,l]=(0,u.Nk)(s);return[r,(0,t.useCallback)((e=>{s&&l.set(e)}),[s,l])]}({groupId:r}),j=(()=>{const e=c??m;return p({value:e,tabValues:l})?e:null})();(0,o.Z)((()=>{j&&i(j)}),[j]);return{selectedValue:a,selectValue:(0,t.useCallback)((e=>{if(!p({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);i(e),d(e),g(e)}),[d,g,l]),tabValues:l}}var g=s(2389);const j={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var f=s(5893);function b(e){let{className:n,block:s,selectedValue:t,selectValue:a,tabValues:o}=e;const i=[],{blockElementScrollPositionUntilNextRender:c}=(0,l.o5)(),u=e=>{const n=e.currentTarget,s=i.indexOf(n),r=o[s].value;r!==t&&(c(n),a(r))},d=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const s=i.indexOf(e.currentTarget)+1;n=i[s]??i[0];break}case"ArrowLeft":{const s=i.indexOf(e.currentTarget)-1;n=i[s]??i[i.length-1];break}}n?.focus()};return(0,f.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":s},n),children:o.map((e=>{let{value:n,label:s,attributes:l}=e;return(0,f.jsx)("li",{role:"tab",tabIndex:t===n?0:-1,"aria-selected":t===n,ref:e=>i.push(e),onKeyDown:d,onClick:u,...l,className:(0,r.Z)("tabs__item",j.tabItem,l?.className,{"tabs__item--active":t===n}),children:s??n},n)}))})}function v(e){let{lazy:n,children:s,selectedValue:r}=e;const l=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===r));return e?(0,t.cloneElement)(e,{className:"margin-top--md"}):null}return(0,f.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,t.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function y(e){const n=m(e);return(0,f.jsxs)("div",{className:(0,r.Z)("tabs-container",j.tabList),children:[(0,f.jsx)(b,{...e,...n}),(0,f.jsx)(v,{...e,...n})]})}function q(e){const n=(0,g.Z)();return(0,f.jsx)(y,{...e,children:d(e.children)},String(n))}},4379:(e,n,s)=>{s.d(n,{I:()=>i});var t=s(7294),r=s(2263),l=s(9286),a=s(5893);const o=()=>(0,a.jsx)("span",{className:"loader"}),i=e=>{let{url:n,language:s,extractMethod:i,methodType:c}=e;const[u,d]=(0,t.useState)(""),[h,p]=(0,t.useState)(!0),[x,m]=(0,t.useState)(!0),{siteConfig:g}=(0,r.Z)(),j=g.baseUrl.replace(/\/$/,""),f=/^\//.test(n)?`${j}${n}`:n;return(0,t.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(f,{signal:n}).then((e=>e.text())).then((e=>{const n=i&&c?((e,n,s)=>{const t=e.split("\n"),r=`${s} ${n}`;let l=!1,a=0,o="";for(const i of t)if(i.includes(r)&&(l=!0),l&&(i.includes("{")&&a++,o+=i+"\n",i.includes("}")&&(a--,0===a)))break;return o.trim()||e})(e,i,c):e;d(n||e),p(!1),m(!1)})).catch((()=>{m(!0),p(!1)})),()=>{e.abort()}}),[f,i,c]),(0,a.jsx)(a.Fragment,{children:h?(0,a.jsx)(o,{}):(0,a.jsx)(a.Fragment,{children:x?(0,a.jsxs)("div",{children:["Unable to access the requested link: ",(0,a.jsx)("code",{children:f}),". Please verify the link or try again later."]}):(0,a.jsx)(l.Z,{className:`language-${s}`,children:u})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>l});var t=s(4673),r=s(5893);const l=e=>{let{children:n,open:s,title:l}=e;return(0,r.jsx)(t.Z,{open:s,className:"faq",summary:(0,r.jsx)("summary",{children:(0,r.jsx)("strong",{children:l})}),children:(0,r.jsx)("section",{children:n})})}}}]);
\ No newline at end of file
diff --git a/assets/js/f8d74a12.2efd1f29.js b/assets/js/f8d74a12.2efd1f29.js
new file mode 100644
index 0000000000..e0ee205e24
--- /dev/null
+++ b/assets/js/f8d74a12.2efd1f29.js
@@ -0,0 +1,2 @@
+/*! For license information please see f8d74a12.2efd1f29.js.LICENSE.txt */
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5807],{7330:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>x,contentTitle:()=>d,default:()=>p,frontMatter:()=>a,metadata:()=>h,toc:()=>m});var t=s(5893),i=s(1151),r=s(6393),l=s(8609),o=s(3901),c=s(4379);const a={title:"Documentation Site"},d="Website Contributing Guidelines",h={id:"contributing/website",title:"Documentation Site",description:"This website is built using Docusaurus 3, a modern static website generator.",source:"@site/docs/contributing/website.mdx",sourceDirName:"contributing",slug:"/contributing/website",permalink:"/node-mysql2/docs/contributing/website",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/contributing/website.mdx",tags:[],version:"current",frontMatter:{title:"Documentation Site"},sidebar:"docs",previous:{title:"MySQL2",permalink:"/node-mysql2/docs/contributing"}},x={},m=[{value:"Environment",id:"environment",level:2},{value:"Development",id:"development",level:2},{value:"Extras Components",id:"extras-components",level:2},{value:"History",id:"history",level:3},{value:"Stability",id:"stability",level:3},{value:"FAQ",id:"faq",level:3},{value:"ExternalCodeEmbed",id:"externalcodeembed",level:3},{value:"Running Tests",id:"running-tests",level:2}];function u(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"website-contributing-guidelines",children:"Website Contributing Guidelines"}),"\n",(0,t.jsxs)(n.p,{children:["This website is built using ",(0,t.jsx)(n.a,{href:"https://docusaurus.io/",children:"Docusaurus 3"}),", a modern static website generator."]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"environment",children:"Environment"}),"\n",(0,t.jsx)(n.p,{children:"You will need these tools installed on your system:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://nodejs.org/",children:"Node.js (18.x or higher)"})}),"\n"]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"development",children:"Development"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:["Fork the ",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2",children:"MySQL2"})," repository."]}),"\n",(0,t.jsxs)(n.li,{children:["Download your forked repository locally. The website's workspace is the \"",(0,t.jsx)(n.em,{children:"website"}),'" directory in ',(0,t.jsx)(n.strong,{children:"node-mysql2"})," root."]}),"\n",(0,t.jsxs)(n.li,{children:["Create a new branch from ",(0,t.jsx)(n.code,{children:"master"})," (optional)."]}),"\n",(0,t.jsxs)(n.li,{children:["Run ",(0,t.jsx)(n.code,{children:"cd website"})," to enter the website workspace."]}),"\n",(0,t.jsxs)(n.li,{children:["Run ",(0,t.jsx)(n.code,{children:"npm ci"})," to install the dependecies from ",(0,t.jsx)(n.em,{children:"package-lock.json"}),"."]}),"\n",(0,t.jsxs)(n.li,{children:["Run ",(0,t.jsx)(n.code,{children:"npm start"})," to starting the local development."]}),"\n"]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"It will start a local development server and opens up a browser window. Most changes are reflected live without having to restart the server."}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.strong,{children:"Docusaurus"})," complete documentation, please ",(0,t.jsx)(n.a,{href:"https://docusaurus.io/docs",children:"see here"}),"."]}),"\n",(0,t.jsx)(r.Z,{title:"CLI example",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/sidorares/node-mysql2.git\ngit checkout -b website # optional\ncd /path-to/node-mysql2/website\nnpm ci\nnpm start\n"})})}),"\n",(0,t.jsxs)(n.p,{children:["Documentation is auto-generated from ",(0,t.jsx)(n.strong,{children:"MDX"})," files placed in these directories:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.em,{children:"./docs/documentation"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.em,{children:"./docs/examples"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.em,{children:"./docs/faq"})}),"\n"]}),"\n",(0,t.jsxs)(n.admonition,{title:"Caution",type:"danger",children:[(0,t.jsxs)(n.p,{children:["Note that the website has its own ",(0,t.jsx)(n.em,{children:"package.json"}),"."]}),(0,t.jsxs)(n.p,{children:["Please, do not install dependencies for the website in ",(0,t.jsx)(n.strong,{children:"node-mysql2"})," root."]})]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"extras-components",children:"Extras Components"}),"\n",(0,t.jsx)(n.p,{children:"Every extra component is thoroughly documented with complete typings descriptions."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://docusaurus.io/docs/markdown-features",children:(0,t.jsx)(n.strong,{children:"Docusaurus Markdown Features:"})})," The MDX compiler transforms Markdown files to React components, and allows you to use JSX in your Markdown content. This enables you to easily interleave React components within your content, and create delightful learning experiences."]}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"history",children:"History"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"History"})," component displays version changes in a table format, listing version numbers alongside their changes."]}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { History } from '@site/src/components/History';\n\n\n"})}),"\n","\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["You can also utilize React components in the ",(0,t.jsx)(n.code,{children:"changes"})," option."]})}),"\n",(0,t.jsx)(r.Z,{title:"Example",children:(0,t.jsx)(l.A,{records:[{version:"1.0.0",changes:["Some change message."]}]})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"stability",children:"Stability"}),"\n",(0,t.jsxs)(n.p,{children:["See the ",(0,t.jsx)(n.a,{href:"/docs/stability-badges",children:"Stability Badges"})," for more detais."]}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { Stability } from '@site/src/components/Stability';\n\n\n\n"})}),"\n","\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["You can also utilize React components in the ",(0,t.jsx)(n.code,{children:"message"})," option."]})}),"\n",(0,t.jsxs)(n.p,{children:["Available levels: ",(0,t.jsx)(n.code,{children:"0"}),", ",(0,t.jsx)(n.code,{children:"1"}),", ",(0,t.jsx)(n.code,{children:"1.1"}),", ",(0,t.jsx)(n.code,{children:"1.2"}),", ",(0,t.jsx)(n.code,{children:"2"})," and ",(0,t.jsx)(n.code,{children:"3"}),"."]}),"\n",(0,t.jsxs)(r.Z,{title:"Example",children:[(0,t.jsx)(o.X,{level:2}),(0,t.jsx)(o.X,{level:2,message:"Some message."})]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"faq",children:"FAQ"}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { FAQ } from '@site/src/components/FAQ';\n\n\n\n > Some markdown (**MDX**) content.\n\n\n"})}),"\n","\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["The ",(0,t.jsx)(n.strong,{children:"FAQ"})," component can be utilized in any section or page."]}),"\n",(0,t.jsxs)(n.li,{children:["Code blocks are compatible and can be used within the ",(0,t.jsx)(n.strong,{children:"FAQ"})," component."]}),"\n"]})}),"\n",(0,t.jsx)(r.Z,{title:"Example",children:(0,t.jsx)(r.Z,{title:"Title",children:(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["Some markdown (",(0,t.jsx)(n.strong,{children:"MDX"}),") content."]}),"\n"]})})}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h3,{id:"externalcodeembed",children:"ExternalCodeEmbed"}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { ExternalCodeEmbed } from '@site/src/components/ExternalCodeEmbed';\n\n\n\n\n"})}),"\n","\n",(0,t.jsxs)(r.Z,{title:"Example",children:[(0,t.jsx)(c.I,{url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/.prettierrc",language:"json"}),(0,t.jsx)(c.I,{url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/tools/parse-row.js",language:"js",extractMethod:"parseC",methodType:"function"})]}),"\n",(0,t.jsx)("hr",{}),"\n",(0,t.jsx)(n.h2,{id:"running-tests",children:"Running Tests"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run test\n"})}),"\n",(0,t.jsxs)(r.Z,{title:"Check Prettier and ESLint rules for compliance",children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run lintcheck\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]}),"\n",(0,t.jsxs)(r.Z,{title:"Check for typings errors",children:[(0,t.jsx)(o.X,{level:1,message:(0,t.jsxs)(t.Fragment,{children:["Checks for ",(0,t.jsx)(n.strong,{children:"MDX"})," components are missing."]})}),(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run typecheck\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]}),"\n",(0,t.jsxs)(r.Z,{title:"Clear and build the website",children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run clear\nnpm run build\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]}),"\n",(0,t.jsxs)(r.Z,{title:"Fix issues from Prettier and ESLint rules",open:!0,children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run lint\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"To prevent lint issues, it is recommended to execute this command before creating your commit."}),"\n",(0,t.jsxs)(n.li,{children:["Not included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]})]})}function p(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},4379:(e,n,s)=>{s.d(n,{I:()=>c});var t=s(7294),i=s(2263),r=s(9286),l=s(5893);const o=()=>(0,l.jsx)("span",{className:"loader"}),c=e=>{let{url:n,language:s,extractMethod:c,methodType:a}=e;const[d,h]=(0,t.useState)(""),[x,m]=(0,t.useState)(!0),[u,p]=(0,t.useState)(!0),{siteConfig:j}=(0,i.Z)(),g=j.baseUrl.replace(/\/$/,""),b=/^\//.test(n)?`${g}${n}`:n;return(0,t.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(b,{signal:n}).then((e=>e.text())).then((e=>{const n=c&&a?((e,n,s)=>{const t=e.split("\n"),i=`${s} ${n}`;let r=!1,l=0,o="";for(const c of t)if(c.includes(i)&&(r=!0),r&&(c.includes("{")&&l++,o+=c+"\n",c.includes("}")&&(l--,0===l)))break;return o.trim()||e})(e,c,a):e;h(n||e),m(!1),p(!1)})).catch((()=>{p(!0),m(!1)})),()=>{e.abort()}}),[b,c,a]),(0,l.jsx)(l.Fragment,{children:x?(0,l.jsx)(o,{}):(0,l.jsx)(l.Fragment,{children:u?(0,l.jsxs)("div",{children:["Unable to access the requested link: ",(0,l.jsx)("code",{children:b}),". Please verify the link or try again later."]}):(0,l.jsx)(r.Z,{className:`language-${s}`,children:d})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>r});var t=s(4673),i=s(5893);const r=e=>{let{children:n,open:s,title:r}=e;return(0,i.jsx)(t.Z,{open:s,className:"faq",summary:(0,i.jsx)("summary",{children:(0,i.jsx)("strong",{children:r})}),children:(0,i.jsx)("section",{children:n})})}},8609:(e,n,s)=>{s.d(n,{A:()=>l});var t=s(4673);const i=(0,s(4297).Z)("FileClock",[["path",{d:"M16 22h2c.5 0 1-.2 1.4-.6.4-.4.6-.9.6-1.4V7.5L14.5 2H6c-.5 0-1 .2-1.4.6C4.2 3 4 3.5 4 4v3",key:"9lo3o3"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);var r=s(5893);const l=e=>{let{records:n,open:s}=e;return(0,r.jsx)(t.Z,{open:s,summary:(0,r.jsxs)("summary",{children:[(0,r.jsx)(i,{})," History"]}),className:"history",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Version"}),(0,r.jsx)("th",{children:"Changes"})]})}),(0,r.jsx)("tbody",{children:n.map(((e,n)=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("strong",{children:["v",e.version.replace(/[^0-9.]/g,"")]})}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{className:"changes",children:e.changes.map(((e,n)=>(0,r.jsx)("section",{children:e},`change:${n}`)))})})]},`record:${n}`)))})]})})}},3901:(e,n,s)=>{s.d(n,{X:()=>x});var t=s(3692),i=s(4297);const r=(0,i.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),l=(0,i.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),o=(0,i.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),c=(0,i.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),a=(0,i.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),d=(0,i.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var h=s(5893);const x=e=>{let{level:n,message:s}=e;const i={0:{title:"Deprecated",icon:(0,h.jsx)(r,{})},1:{title:"Experimental",icon:(0,h.jsx)(l,{})},1.1:{title:"Early Development",icon:(0,h.jsx)(o,{})},1.2:{title:"Release Candidate",icon:(0,h.jsx)(c,{})},2:{title:"Stable",icon:(0,h.jsx)(a,{})},3:{title:"Legacy",icon:(0,h.jsx)(d,{})}};return(0,h.jsxs)("section",{className:"stability","data-level":n,children:[(0,h.jsx)(t.Z,{to:"/docs/stability-badges",children:(0,h.jsxs)("header",{children:[(0,h.jsx)("strong",{children:n}),(0,h.jsx)("span",{children:i[n].title}),i[n].icon]})}),s?(0,h.jsx)("p",{children:s}):null]})}},4297:(e,n,s)=>{s.d(n,{Z:()=>r});var t=s(7294),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const r=(e,n)=>{const s=(0,t.forwardRef)((({color:s="currentColor",size:r=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:a,...d},h)=>{return(0,t.createElement)("svg",{ref:h,...i,width:r,height:r,stroke:s,strokeWidth:o?24*Number(l)/Number(r):l,className:["lucide",`lucide-${x=e,x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,c].join(" "),...d},[...n.map((([e,n])=>(0,t.createElement)(e,n))),...Array.isArray(a)?a:[a]]);var x}));return s.displayName=`${e}`,s}}}]);
\ No newline at end of file
diff --git a/assets/js/f8d74a12.650ad441.js.LICENSE.txt b/assets/js/f8d74a12.2efd1f29.js.LICENSE.txt
similarity index 100%
rename from assets/js/f8d74a12.650ad441.js.LICENSE.txt
rename to assets/js/f8d74a12.2efd1f29.js.LICENSE.txt
diff --git a/assets/js/f8d74a12.650ad441.js b/assets/js/f8d74a12.650ad441.js
deleted file mode 100644
index c8dd76897c..0000000000
--- a/assets/js/f8d74a12.650ad441.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! For license information please see f8d74a12.650ad441.js.LICENSE.txt */
-"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5807],{7330:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>x,contentTitle:()=>d,default:()=>p,frontMatter:()=>a,metadata:()=>h,toc:()=>m});var t=s(5893),i=s(1151),r=s(6393),l=s(8609),o=s(3901),c=s(4379);const a={title:"Documentation Site"},d="Website Contributing Guidelines",h={id:"contributing/website",title:"Documentation Site",description:"This website is built using Docusaurus 3, a modern static website generator.",source:"@site/docs/contributing/website.mdx",sourceDirName:"contributing",slug:"/contributing/website",permalink:"/node-mysql2/docs/contributing/website",draft:!1,unlisted:!1,editUrl:"https://github.com/sidorares/node-mysql2/tree/master/website/docs/contributing/website.mdx",tags:[],version:"current",frontMatter:{title:"Documentation Site"},sidebar:"docs",previous:{title:"MySQL2",permalink:"/node-mysql2/docs/contributing"}},x={},m=[{value:"Environment",id:"environment",level:2},{value:"Development",id:"development",level:2},{value:"Extras Components",id:"extras-components",level:2},{value:"History",id:"history",level:3},{value:"Stability",id:"stability",level:3},{value:"FAQ",id:"faq",level:3},{value:"ExternalCodeEmbed",id:"externalcodeembed",level:3},{value:"Running Tests",id:"running-tests",level:2}];function u(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"website-contributing-guidelines",children:"Website Contributing Guidelines"}),"\n",(0,t.jsxs)(n.p,{children:["This website is built using ",(0,t.jsx)(n.a,{href:"https://docusaurus.io/",children:"Docusaurus 3"}),", a modern static website generator."]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"environment",children:"Environment"}),"\n",(0,t.jsx)(n.p,{children:"You will need these tools installed on your system:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://nodejs.org/",children:"Node.js (18.x or higher)"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"development",children:"Development"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:["Fork the ",(0,t.jsx)(n.a,{href:"https://github.com/sidorares/node-mysql2",children:"MySQL2"})," repository."]}),"\n",(0,t.jsxs)(n.li,{children:["Download your forked repository locally. The website's workspace is the \"",(0,t.jsx)(n.em,{children:"website"}),'" directory in ',(0,t.jsx)(n.strong,{children:"node-mysql2"})," root."]}),"\n",(0,t.jsxs)(n.li,{children:["Create a new branch from ",(0,t.jsx)(n.code,{children:"master"})," (optional)."]}),"\n",(0,t.jsxs)(n.li,{children:["Run ",(0,t.jsx)(n.code,{children:"cd website"})," to enter the website workspace."]}),"\n",(0,t.jsxs)(n.li,{children:["Run ",(0,t.jsx)(n.code,{children:"npm ci"})," to install the dependecies from ",(0,t.jsx)(n.em,{children:"package-lock.json"}),"."]}),"\n",(0,t.jsxs)(n.li,{children:["Run ",(0,t.jsx)(n.code,{children:"npm start"})," to starting the local development."]}),"\n"]}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"It will start a local development server and opens up a browser window. Most changes are reflected live without having to restart the server."}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["For ",(0,t.jsx)(n.strong,{children:"Docusaurus"})," complete documentation, please ",(0,t.jsx)(n.a,{href:"https://docusaurus.io/docs",children:"see here"}),"."]}),"\n",(0,t.jsx)(r.Z,{title:"CLI example",children:(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/sidorares/node-mysql2.git\ngit checkout -b website # optional\ncd /path-to/node-mysql2/website\nnpm ci\nnpm start\n"})})}),"\n",(0,t.jsxs)(n.p,{children:["Documentation is auto-generated from ",(0,t.jsx)(n.strong,{children:"MDX"})," files placed in these directories:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.em,{children:"./docs/documentation"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.em,{children:"./docs/examples"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.em,{children:"./docs/faq"})}),"\n"]}),"\n",(0,t.jsxs)(n.admonition,{title:"Caution",type:"danger",children:[(0,t.jsxs)(n.p,{children:["Note that the website has its own ",(0,t.jsx)(n.em,{children:"package.json"}),"."]}),(0,t.jsxs)(n.p,{children:["Please, do not install dependencies for the website in ",(0,t.jsx)(n.strong,{children:"node-mysql2"})," root."]})]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"extras-components",children:"Extras Components"}),"\n",(0,t.jsx)(n.p,{children:"Every extra component is thoroughly documented with complete typings descriptions."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://docusaurus.io/docs/markdown-features",children:(0,t.jsx)(n.strong,{children:"Docusaurus Markdown Features:"})})," The MDX compiler transforms Markdown files to React components, and allows you to use JSX in your Markdown content. This enables you to easily interleave React components within your content, and create delightful learning experiences."]}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"history",children:"History"}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"History"})," component displays version changes in a table format, listing version numbers alongside their changes."]}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { History } from '@site/src/components/History';\n\n\n"})}),"\n","\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["You can also utilize React components in the ",(0,t.jsx)(n.code,{children:"changes"})," option."]})}),"\n",(0,t.jsx)(r.Z,{title:"Example",children:(0,t.jsx)(l.A,{records:[{version:"1.0.0",changes:["Some change message."]}]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"stability",children:"Stability"}),"\n",(0,t.jsxs)(n.p,{children:["See the ",(0,t.jsx)(n.a,{href:"/docs/stability-badges",children:"Stability Badges"})," for more detais."]}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { Stability } from '@site/src/components/Stability';\n\n\n\n"})}),"\n","\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["You can also utilize React components in the ",(0,t.jsx)(n.code,{children:"message"})," option."]})}),"\n",(0,t.jsxs)(n.p,{children:["Available levels: ",(0,t.jsx)(n.code,{children:"0"}),", ",(0,t.jsx)(n.code,{children:"1"}),", ",(0,t.jsx)(n.code,{children:"1.1"}),", ",(0,t.jsx)(n.code,{children:"1.2"}),", ",(0,t.jsx)(n.code,{children:"2"})," and ",(0,t.jsx)(n.code,{children:"3"}),"."]}),"\n",(0,t.jsxs)(r.Z,{title:"Example",children:[(0,t.jsx)(o.X,{level:2}),(0,t.jsx)(o.X,{level:2,message:"Some message."})]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"faq",children:"FAQ"}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { FAQ } from '@site/src/components/FAQ';\n\n\n\n > Some markdown (**MDX**) content.\n\n\n"})}),"\n","\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["The ",(0,t.jsx)(n.strong,{children:"FAQ"})," component can be utilized in any section or page."]}),"\n",(0,t.jsxs)(n.li,{children:["Code blocks are compatible and can be used within the ",(0,t.jsx)(n.strong,{children:"FAQ"})," component."]}),"\n"]})}),"\n",(0,t.jsx)(r.Z,{title:"Example",children:(0,t.jsx)(r.Z,{title:"Title",children:(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["Some markdown (",(0,t.jsx)(n.strong,{children:"MDX"}),") content."]}),"\n"]})})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h3,{id:"externalcodeembed",children:"ExternalCodeEmbed"}),"\n","\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-tsx",children:"import { ExternalCodeEmbed } from '@site/src/components/ExternalCodeEmbed';\n\n\n\n\n"})}),"\n","\n",(0,t.jsxs)(r.Z,{title:"Example",children:[(0,t.jsx)(c.I,{url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/.prettierrc",language:"json"}),(0,t.jsx)(c.I,{url:"https://raw.githubusercontent.com/sidorares/node-mysql2/master/tools/parse-row.js",language:"js",extractMethod:"parseC",methodType:"function"})]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"running-tests",children:"Running Tests"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run test\n"})}),"\n",(0,t.jsxs)(r.Z,{title:"Check Prettier and ESLint rules for compliance",children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run lintcheck\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]}),"\n",(0,t.jsxs)(r.Z,{title:"Check for typings errors",children:[(0,t.jsx)(o.X,{level:1,message:(0,t.jsxs)(t.Fragment,{children:["Checks for ",(0,t.jsx)(n.strong,{children:"MDX"})," components are missing."]})}),(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run typecheck\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]}),"\n",(0,t.jsxs)(r.Z,{title:"Clear and build the website",children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run clear\nnpm run build\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]}),"\n",(0,t.jsxs)(r.Z,{title:"Fix issues from Prettier and ESLint rules",open:!0,children:[(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npm run lint\n"})}),(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"To prevent lint issues, it is recommended to execute this command before creating your commit."}),"\n",(0,t.jsxs)(n.li,{children:["Not included in the ",(0,t.jsx)(n.strong,{children:"GitHub Actions"})," workflow."]}),"\n"]})]})]})}function p(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},4379:(e,n,s)=>{s.d(n,{I:()=>c});var t=s(7294),i=s(2263),r=s(9286),l=s(5893);const o=()=>(0,l.jsx)("span",{className:"loader"}),c=e=>{let{url:n,language:s,extractMethod:c,methodType:a}=e;const[d,h]=(0,t.useState)(""),[x,m]=(0,t.useState)(!0),[u,p]=(0,t.useState)(!0),{siteConfig:j}=(0,i.Z)(),g=j.baseUrl.replace(/\/$/,""),b=/^\//.test(n)?`${g}${n}`:n;return(0,t.useEffect)((()=>{const e=new AbortController,n=e.signal;return fetch(b,{signal:n}).then((e=>e.text())).then((e=>{const n=c&&a?((e,n,s)=>{const t=e.split("\n"),i=`${s} ${n}`;let r=!1,l=0,o="";for(const c of t)if(c.includes(i)&&(r=!0),r&&(c.includes("{")&&l++,o+=c+"\n",c.includes("}")&&(l--,0===l)))break;return o.trim()||e})(e,c,a):e;h(n||e),m(!1),p(!1)})).catch((()=>{p(!0),m(!1)})),()=>{e.abort()}}),[b,c,a]),(0,l.jsx)(l.Fragment,{children:x?(0,l.jsx)(o,{}):(0,l.jsx)(l.Fragment,{children:u?(0,l.jsxs)("div",{children:["Unable to access the requested link: ",(0,l.jsx)("code",{children:b}),". Please verify the link or try again later."]}):(0,l.jsx)(r.Z,{className:`language-${s}`,children:d})})})}},6393:(e,n,s)=>{s.d(n,{Z:()=>r});var t=s(4673),i=s(5893);const r=e=>{let{children:n,open:s,title:r}=e;return(0,i.jsx)(t.Z,{open:s,className:"faq",summary:(0,i.jsx)("summary",{children:(0,i.jsx)("strong",{children:r})}),children:(0,i.jsx)("section",{children:n})})}},8609:(e,n,s)=>{s.d(n,{A:()=>l});var t=s(4673);const i=(0,s(4297).Z)("FileClock",[["path",{d:"M16 22h2c.5 0 1-.2 1.4-.6.4-.4.6-.9.6-1.4V7.5L14.5 2H6c-.5 0-1 .2-1.4.6C4.2 3 4 3.5 4 4v3",key:"9lo3o3"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);var r=s(5893);const l=e=>{let{records:n,open:s}=e;return(0,r.jsx)(t.Z,{open:s,summary:(0,r.jsxs)("summary",{children:[(0,r.jsx)(i,{})," History"]}),className:"history",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Version"}),(0,r.jsx)("th",{children:"Changes"})]})}),(0,r.jsx)("tbody",{children:n.map(((e,n)=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("strong",{children:["v",e.version.replace(/[^0-9.]/g,"")]})}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{className:"changes",children:e.changes.map(((e,n)=>(0,r.jsx)("section",{children:e},`change:${n}`)))})})]},`record:${n}`)))})]})})}},3901:(e,n,s)=>{s.d(n,{X:()=>x});var t=s(3692),i=s(4297);const r=(0,i.Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),l=(0,i.Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),o=(0,i.Z)("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]),c=(0,i.Z)("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]),a=(0,i.Z)("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),d=(0,i.Z)("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var h=s(5893);const x=e=>{let{level:n,message:s}=e;const i={0:{title:"Deprecated",icon:(0,h.jsx)(r,{})},1:{title:"Experimental",icon:(0,h.jsx)(l,{})},1.1:{title:"Early Development",icon:(0,h.jsx)(o,{})},1.2:{title:"Release Candidate",icon:(0,h.jsx)(c,{})},2:{title:"Stable",icon:(0,h.jsx)(a,{})},3:{title:"Legacy",icon:(0,h.jsx)(d,{})}};return(0,h.jsxs)("section",{className:"stability","data-level":n,children:[(0,h.jsx)(t.Z,{to:"/docs/stability-badges",children:(0,h.jsxs)("header",{children:[(0,h.jsx)("strong",{children:n}),(0,h.jsx)("span",{children:i[n].title}),i[n].icon]})}),s?(0,h.jsx)("p",{children:s}):null]})}},4297:(e,n,s)=>{s.d(n,{Z:()=>r});var t=s(7294),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const r=(e,n)=>{const s=(0,t.forwardRef)((({color:s="currentColor",size:r=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:a,...d},h)=>{return(0,t.createElement)("svg",{ref:h,...i,width:r,height:r,stroke:s,strokeWidth:o?24*Number(l)/Number(r):l,className:["lucide",`lucide-${x=e,x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim()}`,c].join(" "),...d},[...n.map((([e,n])=>(0,t.createElement)(e,n))),...Array.isArray(a)?a:[a]]);var x}));return s.displayName=`${e}`,s}}}]);
\ No newline at end of file
diff --git a/assets/js/runtime~main.212a933d.js b/assets/js/runtime~main.4212af77.js
similarity index 58%
rename from assets/js/runtime~main.212a933d.js
rename to assets/js/runtime~main.4212af77.js
index 8cce907456..02e99ece60 100644
--- a/assets/js/runtime~main.212a933d.js
+++ b/assets/js/runtime~main.4212af77.js
@@ -1 +1 @@
-(()=>{"use strict";var e,a,f,c,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var f=t[e]={exports:{}};return b[e].call(f.exports,f,f.exports,r),f.exports}r.m=b,e=[],r.O=(a,f,c,d)=>{if(!f){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](f[o])))?f.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[f,c,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};a=a||[null,f({}),f([]),f(f)];for(var t=2&c&&e;"object"==typeof t&&!~a.indexOf(t);t=f(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(d,b),d},r.d=(e,a)=>{for(var f in a)r.o(a,f)&&!r.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,f)=>(r.f[f](e,a),a)),[])),r.u=e=>"assets/js/"+({53:"935f2afb",81:"8fcb4d7f",384:"1cee01a7",452:"a55c4658",505:"f1dc11e5",556:"22161331",576:"54768732",630:"f54f1246",641:"59e52bc2",979:"4e6d26eb",1233:"c84c75a7",1411:"20afe101",1420:"54eaaaae",1429:"e19cd79a",1437:"bc31cbdb",1465:"fb880757",1611:"822ff0a2",2002:"d2b048c9",2030:"ad7b17cf",2456:"c2813336",2496:"13833ed5",2714:"2a05ee09",2839:"2bc14e22",2991:"ed06a4b6",2995:"32f1b34f",3237:"1df93b7f",3326:"f4597ecd",3433:"76dfa484",3561:"5814edec",3586:"4e92b6b6",3751:"3720c009",3776:"f76f5ab7",4116:"cdbda324",4121:"55960ee5",4173:"4edc808e",4243:"3226d26d",4368:"a94703ab",4403:"b07748b5",5003:"57495183",5072:"0e27d5d9",5775:"11a54026",5807:"f8d74a12",5909:"f43af5ae",6061:"b80d201b",6159:"db044f71",7272:"0fd3066c",7435:"b825a63d",7918:"17896441",7920:"1a4e3797",8054:"7ccab252",8263:"546b1c5f",8406:"cffacdf0",8453:"508f32b9",8518:"a7bd4aaa",8534:"8b8ccc10",8625:"11e11f3b",8722:"5834a125",8806:"9e767aa9",8882:"3945bec1",9140:"df04d3c8",9308:"8e56b1fa",9380:"ac5f2e4a",9458:"1568425c",9594:"3be0564c",9661:"5e95c892",9924:"df203c0f",9961:"f11325fe",9964:"7fbd6b3a"}[e]||e)+"."+{53:"2459718c",81:"775cd8a1",384:"67bafbd9",452:"d2d37fb7",505:"e9c930e2",556:"bdd78c44",576:"7adc3ec4",630:"3d0942fa",641:"2b8c3e3c",979:"3058face",1233:"bc5502d7",1411:"be6389dc",1420:"22d6bdf5",1429:"d82572fa",1437:"ea3bd4c2",1465:"7c9dd290",1611:"d2b9e2d9",1772:"b0ede415",2002:"7ea067b0",2030:"9952a969",2456:"514f73c4",2496:"3d37ad7a",2714:"1e59c012",2839:"684b748e",2991:"46e32666",2995:"be941bc6",3237:"8f7e93f0",3326:"a48e25c9",3433:"abc20e14",3561:"dcf7d68b",3586:"4e5b1065",3751:"8c42b22a",3776:"8bdadfff",4116:"fbef41bf",4121:"4f929515",4173:"1929d38c",4243:"e340bb5c",4368:"265346fe",4403:"e822c15e",5003:"d7fc7e0f",5020:"614bd897",5072:"777a9488",5525:"36b2ab15",5775:"7e616dd9",5807:"650ad441",5909:"b162e030",6061:"074f18ce",6159:"a1084822",7272:"e8dbfbc3",7435:"cf070d2a",7918:"569c1c67",7920:"b37fdfae",8054:"53d7e12b",8263:"a8bfad30",8406:"7e0341de",8443:"30345cef",8453:"cc76f031",8518:"687d6c08",8534:"1c3b82e9",8625:"958ffa2a",8722:"6ad752fa",8806:"33391d2e",8882:"42f65154",9140:"1dfc1fb6",9308:"bbf9e2fc",9380:"75c0af2a",9458:"6348d27b",9594:"99fbf261",9661:"5a7f2413",9924:"56844b1b",9961:"0f31a6f3",9964:"b2a4ea36"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},d="website:",r.l=(e,a,f,b)=>{if(c[e])c[e].push(a);else{var t,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=c[e];if(delete c[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(f))),a)return a(f)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/node-mysql2/",r.gca=function(e){return e={17896441:"7918",22161331:"556",54768732:"576",57495183:"5003","935f2afb":"53","8fcb4d7f":"81","1cee01a7":"384",a55c4658:"452",f1dc11e5:"505",f54f1246:"630","59e52bc2":"641","4e6d26eb":"979",c84c75a7:"1233","20afe101":"1411","54eaaaae":"1420",e19cd79a:"1429",bc31cbdb:"1437",fb880757:"1465","822ff0a2":"1611",d2b048c9:"2002",ad7b17cf:"2030",c2813336:"2456","13833ed5":"2496","2a05ee09":"2714","2bc14e22":"2839",ed06a4b6:"2991","32f1b34f":"2995","1df93b7f":"3237",f4597ecd:"3326","76dfa484":"3433","5814edec":"3561","4e92b6b6":"3586","3720c009":"3751",f76f5ab7:"3776",cdbda324:"4116","55960ee5":"4121","4edc808e":"4173","3226d26d":"4243",a94703ab:"4368",b07748b5:"4403","0e27d5d9":"5072","11a54026":"5775",f8d74a12:"5807",f43af5ae:"5909",b80d201b:"6061",db044f71:"6159","0fd3066c":"7272",b825a63d:"7435","1a4e3797":"7920","7ccab252":"8054","546b1c5f":"8263",cffacdf0:"8406","508f32b9":"8453",a7bd4aaa:"8518","8b8ccc10":"8534","11e11f3b":"8625","5834a125":"8722","9e767aa9":"8806","3945bec1":"8882",df04d3c8:"9140","8e56b1fa":"9308",ac5f2e4a:"9380","1568425c":"9458","3be0564c":"9594","5e95c892":"9661",df203c0f:"9924",f11325fe:"9961","7fbd6b3a":"9964"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,f)=>{var c=r.o(e,a)?e[a]:void 0;if(0!==c)if(c)f.push(c[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var d=new Promise(((f,d)=>c=e[a]=[f,d]));f.push(c[2]=d);var b=r.p+r.u(a),t=new Error;r.l(b,(f=>{if(r.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var d=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,c[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,f)=>{var c,d,b=f[0],t=f[1],o=f[2],n=0;if(b.some((a=>0!==e[a]))){for(c in t)r.o(t,c)&&(r.m[c]=t[c]);if(o)var i=o(r)}for(a&&a(f);n{"use strict";var e,a,f,d,c,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var f=t[e]={exports:{}};return b[e].call(f.exports,f,f.exports,r),f.exports}r.m=b,e=[],r.O=(a,f,d,c)=>{if(!f){var b=1/0;for(i=0;i=c)&&Object.keys(r.O).every((e=>r.O[e](f[o])))?f.splice(o--,1):(t=!1,c0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[f,d,c]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var c=Object.create(null);r.r(c);var b={};a=a||[null,f({}),f([]),f(f)];for(var t=2&d&&e;"object"==typeof t&&!~a.indexOf(t);t=f(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(c,b),c},r.d=(e,a)=>{for(var f in a)r.o(a,f)&&!r.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,f)=>(r.f[f](e,a),a)),[])),r.u=e=>"assets/js/"+({53:"935f2afb",81:"8fcb4d7f",384:"1cee01a7",452:"a55c4658",505:"f1dc11e5",556:"22161331",576:"54768732",630:"f54f1246",641:"59e52bc2",979:"4e6d26eb",1233:"c84c75a7",1411:"20afe101",1420:"54eaaaae",1429:"e19cd79a",1437:"bc31cbdb",1465:"fb880757",1611:"822ff0a2",2002:"d2b048c9",2030:"ad7b17cf",2456:"c2813336",2496:"13833ed5",2714:"2a05ee09",2839:"2bc14e22",2991:"ed06a4b6",2995:"32f1b34f",3237:"1df93b7f",3326:"f4597ecd",3433:"76dfa484",3561:"5814edec",3586:"4e92b6b6",3751:"3720c009",3776:"f76f5ab7",4116:"cdbda324",4121:"55960ee5",4173:"4edc808e",4243:"3226d26d",4368:"a94703ab",4403:"b07748b5",5003:"57495183",5072:"0e27d5d9",5775:"11a54026",5807:"f8d74a12",5909:"f43af5ae",6061:"b80d201b",6159:"db044f71",7272:"0fd3066c",7435:"b825a63d",7918:"17896441",7920:"1a4e3797",8054:"7ccab252",8263:"546b1c5f",8406:"cffacdf0",8453:"508f32b9",8518:"a7bd4aaa",8534:"8b8ccc10",8625:"11e11f3b",8722:"5834a125",8806:"9e767aa9",8882:"3945bec1",9140:"df04d3c8",9308:"8e56b1fa",9380:"ac5f2e4a",9458:"1568425c",9594:"3be0564c",9661:"5e95c892",9924:"df203c0f",9961:"f11325fe",9964:"7fbd6b3a"}[e]||e)+"."+{53:"2459718c",81:"439505a5",384:"67bafbd9",452:"d2d37fb7",505:"e9c930e2",556:"bdd78c44",576:"2ebf0dd6",630:"3d0942fa",641:"58047b61",979:"3058face",1233:"bc5502d7",1411:"be6389dc",1420:"09adf8e5",1429:"cb693707",1437:"ea3bd4c2",1465:"7c9dd290",1611:"d2b9e2d9",1772:"b0ede415",2002:"7ea067b0",2030:"9952a969",2456:"514f73c4",2496:"3d37ad7a",2714:"1e59c012",2839:"4e0be83f",2991:"46e32666",2995:"be941bc6",3237:"7c544ac9",3326:"a48e25c9",3433:"abc20e14",3561:"dcf7d68b",3586:"4e5b1065",3751:"8c42b22a",3776:"8bdadfff",4116:"5473c064",4121:"4f929515",4173:"7f854e52",4243:"e340bb5c",4368:"265346fe",4403:"6c0d5c52",5003:"a3a923b6",5020:"614bd897",5072:"777a9488",5525:"36b2ab15",5775:"7e616dd9",5807:"2efd1f29",5909:"b162e030",6061:"9b7031af",6159:"bd4db484",7272:"e8dbfbc3",7435:"cf070d2a",7918:"569c1c67",7920:"b37fdfae",8054:"f82d2892",8263:"a8bfad30",8406:"7e0341de",8443:"30345cef",8453:"cc76f031",8518:"687d6c08",8534:"a9b6fe0b",8625:"bcef533c",8722:"6ad752fa",8806:"244f9a95",8882:"42f65154",9140:"1dfc1fb6",9308:"bbf9e2fc",9380:"75c0af2a",9458:"9968efa5",9594:"99fbf261",9661:"5a7f2413",9924:"56844b1b",9961:"0f31a6f3",9964:"80d8bb64"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),d={},c="website:",r.l=(e,a,f,b)=>{if(d[e])d[e].push(a);else{var t,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var c=d[e];if(delete d[e],t.parentNode&&t.parentNode.removeChild(t),c&&c.forEach((e=>e(f))),a)return a(f)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/node-mysql2/",r.gca=function(e){return e={17896441:"7918",22161331:"556",54768732:"576",57495183:"5003","935f2afb":"53","8fcb4d7f":"81","1cee01a7":"384",a55c4658:"452",f1dc11e5:"505",f54f1246:"630","59e52bc2":"641","4e6d26eb":"979",c84c75a7:"1233","20afe101":"1411","54eaaaae":"1420",e19cd79a:"1429",bc31cbdb:"1437",fb880757:"1465","822ff0a2":"1611",d2b048c9:"2002",ad7b17cf:"2030",c2813336:"2456","13833ed5":"2496","2a05ee09":"2714","2bc14e22":"2839",ed06a4b6:"2991","32f1b34f":"2995","1df93b7f":"3237",f4597ecd:"3326","76dfa484":"3433","5814edec":"3561","4e92b6b6":"3586","3720c009":"3751",f76f5ab7:"3776",cdbda324:"4116","55960ee5":"4121","4edc808e":"4173","3226d26d":"4243",a94703ab:"4368",b07748b5:"4403","0e27d5d9":"5072","11a54026":"5775",f8d74a12:"5807",f43af5ae:"5909",b80d201b:"6061",db044f71:"6159","0fd3066c":"7272",b825a63d:"7435","1a4e3797":"7920","7ccab252":"8054","546b1c5f":"8263",cffacdf0:"8406","508f32b9":"8453",a7bd4aaa:"8518","8b8ccc10":"8534","11e11f3b":"8625","5834a125":"8722","9e767aa9":"8806","3945bec1":"8882",df04d3c8:"9140","8e56b1fa":"9308",ac5f2e4a:"9380","1568425c":"9458","3be0564c":"9594","5e95c892":"9661",df203c0f:"9924",f11325fe:"9961","7fbd6b3a":"9964"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,f)=>{var d=r.o(e,a)?e[a]:void 0;if(0!==d)if(d)f.push(d[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var c=new Promise(((f,c)=>d=e[a]=[f,c]));f.push(d[2]=c);var b=r.p+r.u(a),t=new Error;r.l(b,(f=>{if(r.o(e,a)&&(0!==(d=e[a])&&(e[a]=void 0),d)){var c=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;t.message="Loading chunk "+a+" failed.\n("+c+": "+b+")",t.name="ChunkLoadError",t.type=c,t.request=b,d[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,f)=>{var d,c,b=f[0],t=f[1],o=f[2],n=0;if(b.some((a=>0!==e[a]))){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(o)var i=o(r)}for(a&&a(f);nMySQL2 | Quickstart
-
+
diff --git a/docs/acknowledgements.html b/docs/acknowledgements.html
index 12c0e5eca8..675bc23ed6 100644
--- a/docs/acknowledgements.html
+++ b/docs/acknowledgements.html
@@ -4,7 +4,7 @@
Acknowledgements | Quickstart
-
+
diff --git a/docs/api-and-configurations.html b/docs/api-and-configurations.html
index af7217a9f3..435331af7e 100644
--- a/docs/api-and-configurations.html
+++ b/docs/api-and-configurations.html
@@ -4,7 +4,7 @@
API and Configuration | Quickstart
-
+
diff --git a/docs/contributing.html b/docs/contributing.html
index c441826694..757ee26736 100644
--- a/docs/contributing.html
+++ b/docs/contributing.html
@@ -4,7 +4,7 @@
Contributing
-
+
diff --git a/docs/contributing/website.html b/docs/contributing/website.html
index bc42b7a3b1..39eceab05e 100644
--- a/docs/contributing/website.html
+++ b/docs/contributing/website.html
@@ -4,7 +4,7 @@
Documentation Site | Quickstart
-
+
diff --git a/docs/documentation.html b/docs/documentation.html
index 77b2bff6db..dc11b314ae 100644
--- a/docs/documentation.html
+++ b/docs/documentation.html
@@ -4,7 +4,7 @@
Documentation
-
+
diff --git a/docs/documentation/authentication-switch.html b/docs/documentation/authentication-switch.html
index 026cdad7e7..87ea58169c 100644
--- a/docs/documentation/authentication-switch.html
+++ b/docs/documentation/authentication-switch.html
@@ -4,7 +4,7 @@
Authentication Switch Request | Quickstart
-
+
diff --git a/docs/documentation/extras.html b/docs/documentation/extras.html
index ac2ccbcb60..e9d76b7587 100644
--- a/docs/documentation/extras.html
+++ b/docs/documentation/extras.html
@@ -4,7 +4,7 @@
Extra Features | Quickstart
-
+
diff --git a/docs/documentation/mysql-server.html b/docs/documentation/mysql-server.html
index 7945a1b080..696480f9f6 100644
--- a/docs/documentation/mysql-server.html
+++ b/docs/documentation/mysql-server.html
@@ -4,7 +4,7 @@
MySQL Server API | Quickstart
-
+
diff --git a/docs/documentation/prepared-statements.html b/docs/documentation/prepared-statements.html
index a4570bf3b6..7d77945128 100644
--- a/docs/documentation/prepared-statements.html
+++ b/docs/documentation/prepared-statements.html
@@ -4,7 +4,7 @@
Prepared Statements | Quickstart
-
+
diff --git a/docs/documentation/promise-wrapper.html b/docs/documentation/promise-wrapper.html
index d48549f8b6..aeb39e0af2 100644
--- a/docs/documentation/promise-wrapper.html
+++ b/docs/documentation/promise-wrapper.html
@@ -4,7 +4,7 @@
Promise Wrappers | Quickstart
-
+
diff --git a/docs/documentation/typescript-examples.html b/docs/documentation/typescript-examples.html
index 733ff22eec..881f76030b 100644
--- a/docs/documentation/typescript-examples.html
+++ b/docs/documentation/typescript-examples.html
@@ -4,7 +4,7 @@
Using MySQL2 with TypeScript | Quickstart
-
+
diff --git a/docs/examples.html b/docs/examples.html
index dd015f0e0c..e660b27d72 100644
--- a/docs/examples.html
+++ b/docs/examples.html
@@ -4,7 +4,7 @@
Examples
-
+
diff --git a/docs/examples/binlog-watcher.html b/docs/examples/binlog-watcher.html
index 23339b8d15..cdda8d0891 100644
--- a/docs/examples/binlog-watcher.html
+++ b/docs/examples/binlog-watcher.html
@@ -4,7 +4,7 @@
Binlog Watcher | Quickstart
-
+
diff --git a/docs/examples/connections/create-connection.html b/docs/examples/connections/create-connection.html
index 98799ac6b0..9173fd9677 100644
--- a/docs/examples/connections/create-connection.html
+++ b/docs/examples/connections/create-connection.html
@@ -4,7 +4,7 @@
createConnection | Quickstart
-
+
diff --git a/docs/examples/connections/create-pool.html b/docs/examples/connections/create-pool.html
index ebf08abdb8..caf15ff83b 100644
--- a/docs/examples/connections/create-pool.html
+++ b/docs/examples/connections/create-pool.html
@@ -4,7 +4,7 @@
createPool | Quickstart
-
+
@@ -87,10 +87,7 @@