跳至主要內容

統計資料列數 (LCC.db.count)

聲明​

count, err = LCC.db.count(name, conditions?, timeout?)

參數​

  • name
    字串型,表名稱,必須非空且不超過 256 位元組
  • conditions
    表格型,可選;等值條件(AND 組合),預設統計全部資料列
  • timeout
    數值型,可選;請求逾時時間(秒),預設 60

回傳值​

  • count
    數值型,符合條件的資料列數;失敗時為 nil
  • err
    字串型或 nil,失敗時的錯誤描述

說明​

取得符合條件的資料列數,條件語義與 list 的 conditions 一致。
表不存在或條件包含未知列時會傳回錯誤。

範例​

local total, err = LCC.db.count("任務表", { 狀態 = "閒置" })
if total then
LCC.log(1, "閒置任務", total)
end