跳到主要内容

统计行数 (LCC.db.count)

声明

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

参数

  • name
    字符串型,表名称,必须非空且不超过 256 字节
  • conditions
    表类型,可选;等值条件(AND 组合),默认统计全部行
  • timeout
    数值型,可选;请求超时时间(秒),默认 60

返回值

  • count
    数值型,符合条件的行数;失败时为 nil
  • err
    字符串型或 nil,失败时的错误描述

说明

获取符合条件的行数,条件语义与 listconditions 一致。
表不存在或条件包含未知列时会返回错误。

示例

local total, err = LCC.db.count("任务表", { 状态 = "空闲" })
if total then
LCC.log(1, "空闲任务", total)
end