"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[4383],{6751:(n,e,t)=>{t.r(e),t.d(e,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>d});const l=JSON.parse('{"id":"XXTLanControl.lua/tabledb/count","title":"\u7edf\u8ba1\u884c\u6570 (LCC.db.count)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/tabledb/count.md","sourceDirName":"XXTLanControl.lua/tabledb","slug":"/XXTLanControl.lua/tabledb/count","permalink":"/docs/XXTLanControl.lua/tabledb/count","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":70,"frontMatter":{"sidebar_position":70},"sidebar":"tutorialSidebar","previous":{"title":"\u6761\u4ef6\u67e5\u8be2\u884c\u5217\u8868 (LCC.db.list)","permalink":"/docs/XXTLanControl.lua/tabledb/list"},"next":{"title":"\u539f\u5b50\u83b7\u53d6\u5e76\u66f4\u65b0\u4e00\u884c (LCC.db.fetch_one)","permalink":"/docs/XXTLanControl.lua/tabledb/fetch_one"}}');var o=t(4848),s=t(8453);const r={sidebar_position:70},i="\u7edf\u8ba1\u884c\u6570 (LCC.db.count)",c={},d=[{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(n){const e={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...n.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.header,{children:(0,o.jsx)(e.h1,{id:"\u7edf\u8ba1\u884c\u6570-lccdbcount",children:"\u7edf\u8ba1\u884c\u6570 (LCC.db.count)"})}),"\n",(0,o.jsx)(e.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-lua",children:"count, err = LCC.db.count(name, conditions?, timeout?)\n"})}),"\n",(0,o.jsx)(e.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,o.jsxs)(e.ul,{children:["\n",(0,o.jsxs)(e.li,{children:["name",(0,o.jsx)(e.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u8868\u540d\u79f0\uff0c\u5fc5\u987b\u975e\u7a7a\u4e14\u4e0d\u8d85\u8fc7 256 \u5b57\u8282"]}),"\n",(0,o.jsxs)(e.li,{children:["conditions",(0,o.jsx)(e.br,{}),"\n","\u8868\u7c7b\u578b\uff0c\u53ef\u9009\uff1b\u7b49\u503c\u6761\u4ef6\uff08AND \u7ec4\u5408\uff09\uff0c\u9ed8\u8ba4\u7edf\u8ba1\u5168\u90e8\u884c"]}),"\n",(0,o.jsxs)(e.li,{children:["timeout",(0,o.jsx)(e.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,o.jsx)(e.code,{children:"60"})]}),"\n"]}),"\n",(0,o.jsx)(e.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,o.jsxs)(e.ul,{children:["\n",(0,o.jsxs)(e.li,{children:["count",(0,o.jsx)(e.br,{}),"\n","\u6570\u503c\u578b\uff0c\u7b26\u5408\u6761\u4ef6\u7684\u884c\u6570\uff1b\u5931\u8d25\u65f6\u4e3a ",(0,o.jsx)(e.code,{children:"nil"})]}),"\n",(0,o.jsxs)(e.li,{children:["err",(0,o.jsx)(e.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,o.jsx)(e.code,{children:"nil"}),"\uff0c\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0"]}),"\n"]}),"\n",(0,o.jsx)(e.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,o.jsxs)(e.blockquote,{children:["\n",(0,o.jsxs)(e.p,{children:["\u83b7\u53d6\u7b26\u5408\u6761\u4ef6\u7684\u884c\u6570\uff0c\u6761\u4ef6\u8bed\u4e49\u4e0e ",(0,o.jsx)(e.code,{children:"list"})," \u7684 ",(0,o.jsx)(e.code,{children:"conditions"})," \u4e00\u81f4\u3002",(0,o.jsx)(e.br,{}),"\n","\u8868\u4e0d\u5b58\u5728\u6216\u6761\u4ef6\u5305\u542b\u672a\u77e5\u5217\u65f6\u4f1a\u8fd4\u56de\u9519\u8bef\u3002"]}),"\n"]}),"\n",(0,o.jsx)(e.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,o.jsx)(e.pre,{children:(0,o.jsx)(e.code,{className:"language-lua",children:'local total, err = LCC.db.count("\u4efb\u52a1\u8868", { \u72b6\u6001 = "\u7a7a\u95f2" })\nif total then\n    LCC.log(1, "\u7a7a\u95f2\u4efb\u52a1", total)\nend\n'})})]})}function u(n={}){const{wrapper:e}={...(0,s.R)(),...n.components};return e?(0,o.jsx)(e,{...n,children:(0,o.jsx)(a,{...n})}):a(n)}},8453:(n,e,t)=>{t.d(e,{R:()=>r,x:()=>i});var l=t(6540);const o={},s=l.createContext(o);function r(n){const e=l.useContext(s);return l.useMemo(function(){return"function"==typeof n?n(e):{...e,...n}},[e,n])}function i(n){let e;return e=n.disableParentContext?"function"==typeof n.components?n.components(o):n.components||o:r(n.components),l.createElement(s.Provider,{value:e},n.children)}}}]);