"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[8326],{1769:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>o,toc:()=>c});const o=JSON.parse('{"id":"XXTLanControl.lua/tabledb/count","title":"Count Rows (LCC.db.count)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/tabledb/count.md","sourceDirName":"XXTLanControl.lua/tabledb","slug":"/XXTLanControl.lua/tabledb/count","permalink":"/docs/en/XXTLanControl.lua/tabledb/count","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":70,"frontMatter":{"sidebar_position":70},"sidebar":"tutorialSidebar","previous":{"title":"Query Rows With Conditions (LCC.db.list)","permalink":"/docs/en/XXTLanControl.lua/tabledb/list"},"next":{"title":"Atomically Fetch And Update A Row (LCC.db.fetch_one)","permalink":"/docs/en/XXTLanControl.lua/tabledb/fetch_one"}}');var r=t(4848),s=t(8453);const l={sidebar_position:70},i="Count Rows (LCC.db.count)",a={},c=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(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,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"count-rows-lccdbcount",children:"Count Rows (LCC.db.count)"})}),"\n",(0,r.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:"count, err = LCC.db.count(name, conditions?, timeout?)\n"})}),"\n",(0,r.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["name",(0,r.jsx)(n.br,{}),"\n","String. Table name. Must be non-empty and no longer than 256 bytes."]}),"\n",(0,r.jsxs)(n.li,{children:["conditions",(0,r.jsx)(n.br,{}),"\n","Table, optional. Equality conditions combined with AND; counts all rows when omitted."]}),"\n",(0,r.jsxs)(n.li,{children:["timeout",(0,r.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,r.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["count",(0,r.jsx)(n.br,{}),"\n","Number. Number of matching rows; ",(0,r.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,r.jsxs)(n.li,{children:["err",(0,r.jsx)(n.br,{}),"\n","String or ",(0,r.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["Returns the number of matching rows, using the same condition semantics as ",(0,r.jsx)(n.code,{children:"list"}),".",(0,r.jsx)(n.br,{}),"\n","Unknown tables or columns produce errors that are returned to the caller."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:'local total, err = LCC.db.count("tasks", { Status = "Idle" })\nif total then\n    LCC.log(1, "Idle tasks", total)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>i});var o=t(6540);const r={},s=o.createContext(r);function l(e){const n=o.useContext(s);return o.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),o.createElement(s.Provider,{value:n},e.children)}}}]);