"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[6034],{6404:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"XXTLanControl.lua/tabledb/get","title":"Fetch Row By ID (LCC.db.get)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/tabledb/get.md","sourceDirName":"XXTLanControl.lua/tabledb","slug":"/XXTLanControl.lua/tabledb/get","permalink":"/docs/en/XXTLanControl.lua/tabledb/get","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":90,"frontMatter":{"sidebar_position":90},"sidebar":"tutorialSidebar","previous":{"title":"Atomically Fetch And Update A Row (LCC.db.fetch_one)","permalink":"/docs/en/XXTLanControl.lua/tabledb/fetch_one"}}');var s=t(4848),o=t(8453);const i={sidebar_position:90},l="Fetch Row By ID (LCC.db.get)",a={},d=[{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 c(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"fetch-row-by-id-lccdbget",children:"Fetch Row By ID (LCC.db.get)"})}),"\n",(0,s.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"row, err = LCC.db.get(name, id, timeout?)\n"})}),"\n",(0,s.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["name",(0,s.jsx)(n.br,{}),"\n","String. Table name. Must be non-empty and no longer than 256 bytes."]}),"\n",(0,s.jsxs)(n.li,{children:["id",(0,s.jsx)(n.br,{}),"\n","Number. Row ",(0,s.jsx)(n.code,{children:"id"})," to retrieve. Must be an integer value greater than or equal to ",(0,s.jsx)(n.code,{children:"1"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:["timeout",(0,s.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,s.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["row",(0,s.jsx)(n.br,{}),"\n","Table. Row that matches the ",(0,s.jsx)(n.code,{children:"id"}),"; ",(0,s.jsx)(n.code,{children:"nil"})," when not found."]}),"\n",(0,s.jsxs)(n.li,{children:["err",(0,s.jsx)(n.br,{}),"\n","String or ",(0,s.jsx)(n.code,{children:"nil"}),". Returns ",(0,s.jsx)(n.code,{children:"'not found'"})," if the row is missing, ",(0,s.jsx)(n.code,{children:"'unknown table'"})," when the table does not exist."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["Retrieves a single row by ",(0,s.jsx)(n.code,{children:"id"}),", typically for editing forms.",(0,s.jsx)(n.br,{}),"\n","User columns are returned as strings, while ",(0,s.jsx)(n.code,{children:"id"})," is returned as a number.",(0,s.jsx)(n.br,{}),"\n","An ",(0,s.jsx)(n.code,{children:"id"})," that is not an integer value greater than or equal to ",(0,s.jsx)(n.code,{children:"1"})," triggers a Lua parameter validation error."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:'local row, err = LCC.db.get("tasks", 42)\nif row then\n    print("Task", row.Name, row.Status)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>l});var r=t(6540);const s={},o=r.createContext(s);function i(e){const n=r.useContext(o);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]);