"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3676],{6864:(e,n,d)=>{d.r(n),d.d(n,{assets:()=>o,contentTitle:()=>t,default:()=>u,frontMatter:()=>s,metadata:()=>l,toc:()=>c});const l=JSON.parse('{"id":"XXTLanControl.lua/tabledb/edit","title":"\u6279\u91cf\u66f4\u65b0\u884c (LCC.db.edit)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/tabledb/edit.md","sourceDirName":"XXTLanControl.lua/tabledb","slug":"/XXTLanControl.lua/tabledb/edit","permalink":"/docs/XXTLanControl.lua/tabledb/edit","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":50,"frontMatter":{"sidebar_position":50},"sidebar":"tutorialSidebar","previous":{"title":"\u6279\u91cf\u5220\u9664\u884c (LCC.db.del)","permalink":"/docs/XXTLanControl.lua/tabledb/del"},"next":{"title":"\u6761\u4ef6\u67e5\u8be2\u884c\u5217\u8868 (LCC.db.list)","permalink":"/docs/XXTLanControl.lua/tabledb/list"}}');var r=d(4848),i=d(8453);const s={sidebar_position:50},t="\u6279\u91cf\u66f4\u65b0\u884c (LCC.db.edit)",o={},c=[{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,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"\u6279\u91cf\u66f4\u65b0\u884c-lccdbedit",children:"\u6279\u91cf\u66f4\u65b0\u884c (LCC.db.edit)"})}),"\n",(0,r.jsx)(n.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:"rows, err = LCC.db.edit(name, rows, timeout?)\n"})}),"\n",(0,r.jsx)(n.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["name",(0,r.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,r.jsxs)(n.li,{children:["rows",(0,r.jsx)(n.br,{}),"\n","\u8868\u7c7b\u578b\uff0c\u5305\u542b ",(0,r.jsx)(n.code,{children:"id"})," \u548c\u9700\u66f4\u65b0\u5b57\u6bb5\u7684\u5bf9\u8c61\u6570\u7ec4\uff1b\u6bcf\u4e00\u9879\u90fd\u5fc5\u987b\u5e26\u5927\u4e8e\u7b49\u4e8e 1 \u7684\u6574\u6570\u503c ",(0,r.jsx)(n.code,{children:"id"})]}),"\n",(0,r.jsxs)(n.li,{children:["timeout",(0,r.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,r.jsx)(n.code,{children:"60"})]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["rows",(0,r.jsx)(n.br,{}),"\n","\u8868\u7c7b\u578b\uff0c\u7f16\u8f91\u524d\u7684\u884c\u6570\u7ec4\uff1b\u5931\u8d25\u65f6\u4e3a ",(0,r.jsx)(n.code,{children:"nil"})]}),"\n",(0,r.jsxs)(n.li,{children:["err",(0,r.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,r.jsx)(n.code,{children:"nil"}),"\uff0c\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0\uff08\u5982 ",(0,r.jsx)(n.code,{children:"unknown table"}),"\u3001",(0,r.jsx)(n.code,{children:"unknown column"}),"\uff09"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["\u6309 ",(0,r.jsx)(n.code,{children:"id"})," \u6279\u91cf\u66f4\u65b0\u6307\u5b9a\u5217\uff0c\u8fd4\u56de\u66f4\u65b0\u524d\u7684\u884c\u6570\u636e\u3002",(0,r.jsx)(n.br,{}),"\n","\u67d0\u884c\u7f3a\u5c11 ",(0,r.jsx)(n.code,{children:"id"}),"\uff0c\u6216 ",(0,r.jsx)(n.code,{children:"id"})," \u4e0d\u662f\u5927\u4e8e\u7b49\u4e8e 1 \u7684\u6574\u6570\u503c\u65f6\uff0c\u4f1a\u89e6\u53d1 Lua \u53c2\u6570\u6821\u9a8c\u9519\u8bef\u3002\n",(0,r.jsx)(n.code,{children:"id"})," \u5217\u672c\u8eab\u4e0d\u53ef\u66f4\u65b0\u3002"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:'local before, err = LCC.db.edit("\u4efb\u52a1\u8868", {\n    { id = 5, \u72b6\u6001 = "\u5b8c\u6210" },\n    { id = 6, \u72b6\u6001 = "\u8fdb\u884c\u4e2d", \u5907\u6ce8 = "\u4eba\u5de5\u786e\u8ba4" }\n})\nif not before then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},8453:(e,n,d)=>{d.d(n,{R:()=>s,x:()=>t});var l=d(6540);const r={},i=l.createContext(r);function s(e){const n=l.useContext(i);return l.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),l.createElement(i.Provider,{value:n},e.children)}}}]);