函数:cloud_db_delete 删除数据

方法名称:删除数据

方法功能:删除指定数据

调用方法

ok,err = ts_enterprise_lib:cloud_db_delete(table_id,where,timeout_seconds)

参数 类型 必填 说明 默认值
table_id string 云数据库表 ID,
点击云数据库中表后方的复制 ID 按钮即可复制粘贴
-
where table 删除条件,格式为键值对,
对应列名和数据可写多个条件
条件更多写法参考查询数据函数
-
timeout_seconds number 超时时间,单位秒。数据较大时,应适当延长 5
返回值 类型 说明
ok boolean 操作结果,成功返回 true,失败返回 false
err string 当 ok 等于 true,无返回值
当 ok 等于 false,返回错误原因

函数用例

--企业版库为企业版专用库请勿在除企业版外的产品使用,此库已内置,无需下载
--如果提示没有 ts_enterprise_lib 库请重启企业版客户端服务再试
ts_enterprise_lib = require("ts_enterprise_lib")
assert(ts_enterprise_lib,"无法引入企业专用库")
--删除数据
local table_id = '58b7968986d4e24f4a0cf4e5' --表 ID
local where = {a=3}                         --条件(可多个条件)
local timeout_seconds = 5                   --超时时间
local ok,err = ts_enterprise_lib:cloud_db_delete(table_id,where,timeout_seconds)
if ok then
    dialog("成功")
else
    dialog(err)
end

注意事项

  • 如果 err 返回 timeout 请增加 timeout_seconds 的时间,非 mSleep 时间。
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""