awSQL/docs/docusaurus/build/assets/js/7617dfbd.1084b43b.js
2025-03-14 23:49:58 +01:00

1 line
26 KiB
JavaScript

"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[468],{8350:(e,r,s)=>{s.r(r),s.d(r,{assets:()=>i,contentTitle:()=>c,default:()=>x,frontMatter:()=>l,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"classes/instance","title":"Instance","description":"Holds connection data and is the gateway to performing queries.","source":"@site/docs/classes/instance.md","sourceDirName":"classes","slug":"/classes/instance","permalink":"/awSQL/classes/instance","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":2,"frontMatter":{"sidebar_position":2},"sidebar":"defaultSidebar","previous":{"title":"awSQL","permalink":"/awSQL/classes/awsql"},"next":{"title":"Select","permalink":"/awSQL/classes/select"}}');var t=s(4848),d=s(8453);const l={sidebar_position:2},c="Instance",i={},h=[{value:"Methods",id:"methods",level:2},{value:"connect()",id:"connect",level:3},{value:"destroy()",id:"destroy",level:3},{value:"queryRaw()",id:"queryraw",level:3},{value:"getDatabases()",id:"getdatabases",level:3},{value:"selectDatabase()",id:"selectdatabase",level:3},{value:"getTables()",id:"gettables",level:3},{value:"select()",id:"select",level:3},{value:"insert()",id:"insert",level:3},{value:"delete()",id:"delete",level:3},{value:"update()",id:"update",level:3},{value:"dropDatabase()",id:"dropdatabase",level:3},{value:"dropTable()",id:"droptable",level:3},{value:"createDatabase()",id:"createdatabase",level:3},{value:"createTable()",id:"createtable",level:3},{value:"alterTable()",id:"altertable",level:3},{value:"createStructure()",id:"createstructure",level:3},{value:"getStructure()",id:"getstructure",level:3},{value:"checkStructure()",id:"checkstructure",level:3},{value:"total()",id:"total",level:3},{value:"isConnected()",id:"isconnected",level:3}];function a(e){const r={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,d.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.header,{children:(0,t.jsx)(r.h1,{id:"instance",children:"Instance"})}),"\n",(0,t.jsx)(r.p,{children:"Holds connection data and is the gateway to performing queries."}),"\n",(0,t.jsxs)(r.p,{children:["Instances can be managed via the default export ",(0,t.jsx)(r.a,{href:"./awsql",children:"awSQL"})]}),"\n",(0,t.jsx)(r.h2,{id:"methods",children:"Methods"}),"\n",(0,t.jsx)(r.h3,{id:"connect",children:"connect()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"Promise"})," \u2192 () \u2192 ",(0,t.jsx)(r.strong,{children:"String"})]}),"\n",(0,t.jsx)(r.p,{children:"Connects the instance."}),"\n",(0,t.jsx)(r.admonition,{title:"Possible crash",type:"warning",children:(0,t.jsx)(r.p,{children:"Throws an error whenever the connection fails with an error"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"String"}),' - A connection string in the following format: "Connected to ',(0,t.jsx)(r.code,{children:"host"})," with user ",(0,t.jsx)(r.code,{children:"user"}),'"']}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"destroy",children:"destroy()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 () \u2192 ",(0,t.jsx)(r.strong,{children:"true"})]}),"\n",(0,t.jsx)(r.p,{children:"Destroys the connection"}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"true"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"queryraw",children:"queryRaw()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"queryString"})," = ",(0,t.jsx)(r.strong,{children:"String"}),", ",(0,t.jsx)(r.code,{children:"values"}),"? = ",(0,t.jsx)(r.strong,{children:"Array"}),"<",(0,t.jsx)(r.strong,{children:"any"}),">) \u2192 ",(0,t.jsx)(r.strong,{children:"any"})]}),"\n",(0,t.jsx)(r.p,{children:"Performs a raw query with the given sql-string."}),"\n",(0,t.jsxs)(r.p,{children:["To prevent sql-injections use ? and push your values in order into the ",(0,t.jsx)(r.code,{children:"values"})," array."]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsxs)(r.tbody,{children:[(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"queryString"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The sql-query to perform"})]}),(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"values"})}),(0,t.jsxs)(r.td,{children:[(0,t.jsx)(r.strong,{children:"Array"}),"<",(0,t.jsx)(r.strong,{children:"any"}),">"]}),(0,t.jsx)(r.td,{children:"? in the query string will be replaced by this values in order"})]})]})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"any"})," - Whatever the query returns"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"getdatabases",children:"getDatabases()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"excludeSchema"}),"? = ",(0,t.jsx)(r.strong,{children:"Boolean"}),") \u2192 ",(0,t.jsx)(r.strong,{children:"Array"}),"<",(0,t.jsx)(r.strong,{children:"String"}),">"]}),"\n",(0,t.jsx)(r.p,{children:"Returns a list of database names the user has access to"}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsxs)(r.td,{children:[(0,t.jsx)(r.code,{children:"excludeSchema"})," ",(0,t.jsx)(r.strong,{children:"option"})]}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"Boolean"})}),(0,t.jsx)(r.td,{children:"Whether to exclude the default database 'information_schema'"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"Array"}),"<",(0,t.jsx)(r.strong,{children:"String"}),">"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"selectdatabase",children:"selectDatabase()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"name"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.code,{children:"this"})]}),"\n",(0,t.jsx)(r.p,{children:"Selects a default database for future queries"}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"name"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The database to select"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.code,{children:"this"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"gettables",children:"getTables()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"database"}),"? = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.strong,{children:"Array"}),"<",(0,t.jsx)(r.strong,{children:"String"}),">"]}),"\n",(0,t.jsx)(r.p,{children:"Returns a list of tables for the selected database"}),"\n",(0,t.jsx)(r.admonition,{title:"Possible crash",type:"warning",children:(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"options.multipleStatemens"})," must have been set to ",(0,t.jsx)(r.strong,{children:"true"})," at creation of this instance for this to work. If not this will throw an error."]})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsxs)(r.td,{children:[(0,t.jsx)(r.code,{children:"database"})," ",(0,t.jsx)(r.strong,{children:"optional"})]}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"Database to get tables of. Can be empty as long as a default database was set with 'selectDatabase'"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"Array"}),"<",(0,t.jsx)(r.strong,{children:"String"}),">"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"select",children:"select()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"from"})," = ",(0,t.jsx)(r.strong,{children:"String"}),", ",(0,t.jsx)(r.code,{children:"...columns"}),"? = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.a,{href:"./select",children:"Select"})]}),"\n",(0,t.jsx)(r.p,{children:"Prepares a new select query."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsxs)(r.tbody,{children:[(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"from"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"Name of the table to select from"})]}),(0,t.jsxs)(r.tr,{children:[(0,t.jsxs)(r.td,{children:[(0,t.jsx)(r.code,{children:"...columns"})," ",(0,t.jsx)(r.strong,{children:"optional"})]}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsxs)(r.td,{children:["Names of the columns to include in the query. Leave empty to select all (",(0,t.jsx)(r.code,{children:"*"}),")"]})]})]})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./select",children:"Select"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"insert",children:"insert()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"into"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.a,{href:"./insert",children:"Insert"})]}),"\n",(0,t.jsx)(r.p,{children:"Prepares a new query to insert data."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"into"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"Name of the table to insert into"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./insert",children:"Insert"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"delete",children:"delete()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"from"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.a,{href:"./delete",children:"Delete"})]}),"\n",(0,t.jsx)(r.p,{children:"Prepares a new query to delete data."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"from"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"Name of the table to delete from"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./delete",children:"Delete"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"update",children:"update()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"table"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.a,{href:"./update",children:"Update"})]}),"\n",(0,t.jsx)(r.p,{children:"Prepares a new query to update data."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"table"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"Name of the table to update data of"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./update",children:"Update"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"dropdatabase",children:"dropDatabase()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"database"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.strong,{children:"any"})]}),"\n",(0,t.jsx)(r.p,{children:"Drops a whole database"}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsx)(r.li,{children:"Requires admin privileges"}),"\n"]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"database"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the database to drop"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"any"})," - Whatever the query result is"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"droptable",children:"dropTable()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"table"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.strong,{children:"any"})]}),"\n",(0,t.jsx)(r.p,{children:"Drops a whole table."}),"\n",(0,t.jsx)(r.admonition,{title:"Possible crash",type:"warning",children:(0,t.jsxs)(r.p,{children:["A default database must be set with ",(0,t.jsx)(r.a,{href:"#selectdatabase",children:"selectDatabase()"})]})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"table"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the table to drop"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"any"})," - Whatever the query result is"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"createdatabase",children:"createDatabase()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"name"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.strong,{children:"any"})]}),"\n",(0,t.jsx)(r.p,{children:"Creates a new database."}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsx)(r.li,{children:"Requires admin privileges"}),"\n"]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"name"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the database to create"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"any"})," - Whatever the query result is"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"createtable",children:"createTable()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"name"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.a,{href:"./create-table",children:"CreateTable"})]}),"\n",(0,t.jsx)(r.p,{children:"Prepares to create a new table."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"name"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the table to create"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./create-table",children:"CreateTable"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"altertable",children:"alterTable()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 (",(0,t.jsx)(r.code,{children:"name"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.a,{href:"./alter-table",children:"AlterTable"})]}),"\n",(0,t.jsx)(r.p,{children:"Prepares to alter a table."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"name"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the table to alter"})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./alter-table",children:"AlterTable"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"createstructure",children:"createStructure()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 () \u2192 ",(0,t.jsx)(r.a,{href:"./structure",children:"Structure"})]}),"\n",(0,t.jsx)(r.p,{children:"Creates a new structure."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./structure",children:"Structure"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"getstructure",children:"getStructure()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"table"})," = ",(0,t.jsx)(r.strong,{children:"String"}),", ",(0,t.jsx)(r.code,{children:"database"}),"? = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.a,{href:"./structure",children:"Structure"})]}),"\n",(0,t.jsx)(r.p,{children:"Returns the structure object of a table."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsxs)(r.tbody,{children:[(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"table"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the table to get structure of"})]}),(0,t.jsxs)(r.tr,{children:[(0,t.jsxs)(r.td,{children:[(0,t.jsx)(r.code,{children:"database"})," ",(0,t.jsx)(r.strong,{children:"optional"})]}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsxs)(r.td,{children:["Name of the underlying database. Can be empty when a default database was set with ",(0,t.jsx)(r.a,{href:"#selectdatabase",children:"selectDatabase()"})]})]})]})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.a,{href:"./structure",children:"Structure"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"checkstructure",children:"checkStructure()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"table"})," = ",(0,t.jsx)(r.strong,{children:"String"}),", ",(0,t.jsx)(r.code,{children:"desiredStructure"})," = ",(0,t.jsx)(r.a,{href:"./structure",children:"Structure"}),", ",(0,t.jsx)(r.code,{children:"database"}),"? = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.strong,{children:"Object"})]}),"\n",(0,t.jsx)(r.p,{children:"Checks the structure of a table against a given structure."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsxs)(r.tbody,{children:[(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"table"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the table to check"})]}),(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"desiredStructure"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.a,{href:"./structure",children:"Structure"})}),(0,t.jsx)(r.td,{children:"The structure to check against"})]}),(0,t.jsxs)(r.tr,{children:[(0,t.jsxs)(r.td,{children:[(0,t.jsx)(r.code,{children:"database"})," ",(0,t.jsx)(r.strong,{children:"optional"})]}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsxs)(r.td,{children:["Name of the underlying database. Can be empty when a default database was set with ",(0,t.jsx)(r.a,{href:"#selectdatabase",children:"selectDatabase()"})]})]})]})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"Object"})]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"{\r\n errors: [<...String>], // Holds error messages\r\n passed: [<...String>] // Holds success messages\r\n}\n"})}),"\n",(0,t.jsx)(r.admonition,{type:"info",children:(0,t.jsxs)(r.p,{children:["If ",(0,t.jsx)(r.code,{children:"errors.length"})," is ",(0,t.jsx)(r.code,{children:"0"})," the structure is correct"]})}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"total",children:"total()"}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"async"})," \u2192 (",(0,t.jsx)(r.code,{children:"table"})," = ",(0,t.jsx)(r.strong,{children:"String"}),") \u2192 ",(0,t.jsx)(r.strong,{children:"Number"})]}),"\n",(0,t.jsx)(r.p,{children:"Returns the total amount of rows of a table."}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsx)(r.li,{children:"A default database must be set"}),"\n"]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Parameters"})}),"\n",(0,t.jsxs)(r.table,{children:[(0,t.jsx)(r.thead,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.th,{children:"Parameter"}),(0,t.jsx)(r.th,{children:"Type"}),(0,t.jsx)(r.th,{children:"Description"})]})}),(0,t.jsx)(r.tbody,{children:(0,t.jsxs)(r.tr,{children:[(0,t.jsx)(r.td,{children:(0,t.jsx)(r.code,{children:"table"})}),(0,t.jsx)(r.td,{children:(0,t.jsx)(r.strong,{children:"String"})}),(0,t.jsx)(r.td,{children:"The name of the table to check."})]})})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"Number"})]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"isconnected",children:"isConnected()"}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 () \u2192 ",(0,t.jsx)(r.strong,{children:"Boolean"})]}),"\n",(0,t.jsx)(r.p,{children:"Returns whether the connection has been established."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.p,{children:["\u2192 ",(0,t.jsx)(r.strong,{children:"Boolean"})]})]})}function x(e={}){const{wrapper:r}={...(0,d.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},8453:(e,r,s)=>{s.d(r,{R:()=>l,x:()=>c});var n=s(6540);const t={},d=n.createContext(t);function l(e){const r=n.useContext(d);return n.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function c(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:l(e.components),n.createElement(d.Provider,{value:r},e.children)}}}]);