"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[960],{4969:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>l,contentTitle:()=>i,default:()=>o,frontMatter:()=>c,metadata:()=>n,toc:()=>a});const n=JSON.parse('{"id":"classes/insert","title":"Insert","description":"Performs a query to insert new data into a table.","source":"@site/docs/classes/insert.md","sourceDirName":"classes","slug":"/classes/insert","permalink":"/awSQL/classes/insert","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":4,"frontMatter":{"sidebar_position":4},"sidebar":"defaultSidebar","previous":{"title":"Select","permalink":"/awSQL/classes/select"},"next":{"title":"Delete","permalink":"/awSQL/classes/delete"}}');var r=t(4848),d=t(8453);const c={sidebar_position:4},i="Insert",l={},a=[{value:"Methods",id:"methods",level:2},{value:"selectDatabase()",id:"selectdatabase",level:3},{value:"data()",id:"data",level:3},{value:"execute()",id:"execute",level:3}];function h(e){const s={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,d.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.header,{children:(0,r.jsx)(s.h1,{id:"insert",children:"Insert"})}),"\n",(0,r.jsx)(s.p,{children:"Performs a query to insert new data into a table."}),"\n",(0,r.jsx)(s.h2,{id:"methods",children:"Methods"}),"\n",(0,r.jsx)(s.h3,{id:"selectdatabase",children:"selectDatabase()"}),"\n",(0,r.jsxs)(s.p,{children:["\u2192 (",(0,r.jsx)(s.code,{children:"database"})," = ",(0,r.jsx)(s.strong,{children:"String"}),") \u2192 ",(0,r.jsx)(s.code,{children:"this"})]}),"\n",(0,r.jsx)(s.p,{children:"Selects a different database for this query."}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"Parameters"})}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Parameter"}),(0,r.jsx)(s.th,{children:"Type"}),(0,r.jsx)(s.th,{children:"Description"})]})}),(0,r.jsx)(s.tbody,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"database"})}),(0,r.jsx)(s.td,{children:(0,r.jsx)(s.strong,{children:"String"})}),(0,r.jsx)(s.td,{children:"Name of the database to select"})]})})]}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"Returns"})}),"\n",(0,r.jsxs)(s.p,{children:["\u2192 ",(0,r.jsx)(s.code,{children:"this"})]}),"\n",(0,r.jsx)(s.hr,{}),"\n",(0,r.jsx)(s.h3,{id:"data",children:"data()"}),"\n",(0,r.jsxs)(s.p,{children:["\u2192 (",(0,r.jsx)(s.code,{children:"objects"})," = ",(0,r.jsx)(s.strong,{children:"Array"}),"<",(0,r.jsx)(s.strong,{children:"Object"}),">) \u2192 ",(0,r.jsx)(s.code,{children:"this"})]}),"\n",(0,r.jsx)(s.p,{children:"The data (rows) to insert."}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"Parameters"})}),"\n",(0,r.jsxs)(s.table,{children:[(0,r.jsx)(s.thead,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.th,{children:"Parameter"}),(0,r.jsx)(s.th,{children:"Type"}),(0,r.jsx)(s.th,{children:"Description"})]})}),(0,r.jsx)(s.tbody,{children:(0,r.jsxs)(s.tr,{children:[(0,r.jsx)(s.td,{children:(0,r.jsx)(s.code,{children:"objects"})}),(0,r.jsxs)(s.td,{children:[(0,r.jsx)(s.strong,{children:"Array"}),"<",(0,r.jsx)(s.strong,{children:"Object"}),">"]}),(0,r.jsx)(s.td,{children:"Array containing objects to insert, where the key represent the column-name. All objects must have the same key-structure!"})]})})]}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"Returns"})}),"\n",(0,r.jsxs)(s.p,{children:["\u2192 ",(0,r.jsx)(s.code,{children:"this"})]}),"\n",(0,r.jsx)(s.hr,{}),"\n",(0,r.jsx)(s.h3,{id:"execute",children:"execute()"}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"async"})," \u2192 () \u2192 ",(0,r.jsx)(s.strong,{children:"any"})]}),"\n",(0,r.jsx)(s.p,{children:"Executes the prepared query."}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"Returns"})}),"\n",(0,r.jsxs)(s.p,{children:["\u2192 ",(0,r.jsx)(s.strong,{children:"any"})," - Query result"]}),"\n",(0,r.jsx)(s.hr,{})]})}function o(e={}){const{wrapper:s}={...(0,d.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>c,x:()=>i});var n=t(6540);const r={},d=n.createContext(r);function c(e){const s=n.useContext(d);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function i(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),n.createElement(d.Provider,{value:s},e.children)}}}]);