开发者

update and delete syntax in lua program

开发者 https://www.devze.com 2023-03-13 06:44 出处:网络
I am getting nil value when I tried to update the data for below code : local update_statement =db:prepare[[ UPDATE list SET :name :icon WHERE :id]]

I am getting nil value when I tried to update the data for below code :

    local update_statement =db:prepare[[ UPDATE list SET :name :icon WHERE :id]]

    update_statement:bind_names{  name = aName,  开发者_StackOverflow中文版 icon = aIcon,  id = aId }

    update_statement:step()

    update_statement:reset()

And also I need the syntax for delete operation in lua program.

Please help me

Thank you, Madan mohan.


You need to learn SQL's syntax.

Basically, you're not telling which columns you want to update, you're only giving their values.

local update_statement = db:prepare[[ UPDATE list SET name = :name, icon = :icon WHERE id = :id]]

Here's the syntax for the DELETE statement:

local delete_statement = db:prepare[[ DELETE FROM list WHERE id = :id]]
0

精彩评论

暂无评论...
验证码 换一张
取 消