"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[5693],{8453:(e,n,r)=>{r.d(n,{R:()=>d,x:()=>c});var l=r(6540);const t={},s=l.createContext(t);function d(e){const n=l.useContext(s);return l.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:d(e.components),l.createElement(s.Provider,{value:n},e.children)}},8772:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>o,contentTitle:()=>c,default:()=>u,frontMatter:()=>d,metadata:()=>l,toc:()=>i});const l=JSON.parse('{"id":"XXTLanControl.lua/tabledb/create","title":"\u521b\u5efa\u6570\u636e\u8868 (LCC.db.create)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/tabledb/create.md","sourceDirName":"XXTLanControl.lua/tabledb","slug":"/XXTLanControl.lua/tabledb/create","permalink":"/docs/XXTLanControl.lua/tabledb/create","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":20,"frontMatter":{"sidebar_position":20},"sidebar":"tutorialSidebar","previous":{"title":"\u6570\u636e\u8868\u64cd\u4f5c","permalink":"/docs/XXTLanControl.lua/tabledb/"},"next":{"title":"\u6279\u91cf\u65b0\u589e\u884c (LCC.db.add)","permalink":"/docs/XXTLanControl.lua/tabledb/add"}}');var t=r(4848),s=r(8453);const d={sidebar_position:20},c="\u521b\u5efa\u6570\u636e\u8868 (LCC.db.create)",o={},i=[{value:"\u58f0\u660e",id:"\u58f0\u660e",level:2},{value:"\u53c2\u6570",id:"\u53c2\u6570",level:2},{value:"\u8fd4\u56de\u503c",id:"\u8fd4\u56de\u503c",level:2},{value:"\u8bf4\u660e",id:"\u8bf4\u660e",level:2},{value:"\u793a\u4f8b",id:"\u793a\u4f8b",level:2}];function a(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"\u521b\u5efa\u6570\u636e\u8868-lccdbcreate",children:"\u521b\u5efa\u6570\u636e\u8868 (LCC.db.create)"})}),"\n",(0,t.jsx)(n.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"ok, err = LCC.db.create(name, columns, timeout?)\n"})}),"\n",(0,t.jsx)(n.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["name",(0,t.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u8868\u540d\u79f0\uff0c\u5fc5\u987b\u975e\u7a7a\u4e14\u4e0d\u8d85\u8fc7 256 \u5b57\u8282"]}),"\n",(0,t.jsxs)(n.li,{children:["columns",(0,t.jsx)(n.br,{}),"\n","\u8868\u7c7b\u578b\uff0c\u5217\u540d\u79f0\u6570\u7ec4\uff1b\u6bcf\u4e2a\u5217\u540d\u90fd\u5fc5\u987b\u662f\u975e\u7a7a\u5408\u6cd5 UTF-8\uff0c\u4e0d\u80fd\u91cd\u590d\uff0c\u4e5f\u4e0d\u80fd\u4e3a ",(0,t.jsx)(n.code,{children:"id"})]}),"\n",(0,t.jsxs)(n.li,{children:["timeout",(0,t.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,t.jsx)(n.code,{children:"60"})]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["ok",(0,t.jsx)(n.br,{}),"\n","\u5e03\u5c14\u578b\uff0c\u521b\u5efa\u6210\u529f\u8fd4\u56de ",(0,t.jsx)(n.code,{children:"true"}),"\uff1b\u5931\u8d25\u8fd4\u56de ",(0,t.jsx)(n.code,{children:"false"})]}),"\n",(0,t.jsxs)(n.li,{children:["err",(0,t.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,t.jsx)(n.code,{children:"nil"}),"\uff0c\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0\uff1b\u8868\u5df2\u5b58\u5728\u65f6\u4e3a ",(0,t.jsx)(n.code,{children:"'table already exists'"})]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["\u65b0\u5efa\u8868\u7ed3\u6784\uff0c\u6240\u6709\u7528\u6237\u5217\u7c7b\u578b\u4e3a ",(0,t.jsx)(n.code,{children:"TEXT"}),"\uff0c\u5e76\u81ea\u52a8\u9644\u5e26\u81ea\u589e ",(0,t.jsx)(n.code,{children:"id"}),"\u3002",(0,t.jsx)(n.br,{}),"\n","\u8868\u540d\u4e3a\u7a7a\u6216\u8d85\u8fc7 256 \u5b57\u8282\u3001\u5217\u540d\u4e0d\u662f\u5408\u6cd5 UTF-8 \u65f6\uff0c\u4f1a\u89e6\u53d1 Lua \u53c2\u6570\u6821\u9a8c\u9519\u8bef\u3002",(0,t.jsx)(n.br,{}),"\n","\u91cd\u590d\u5217\u540d\u4f1a\u8fd4\u56de\u9519\u8bef\u4fe1\u606f\u3002"]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'local ok, err = LCC.db.create("\u4efb\u52a1\u8868", {"\u540d\u79f0", "\u72b6\u6001", "\u5907\u6ce8"})\nif not ok then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}}}]);