选择后触发
我有一个 sqlite3 数据库。有一张桌子,上面有一些日志。 这些日志由工具读取并写入文本文件(或其他文件)。
此后,可以删除日志。是否可以在选择后在 sqlite3 中创建触发器,自动删除日志?
就像这样:
CREATE TRIGGER after_select_x
AFTER SELECT ON x
BEGIN
DELETE FROM x WHERE id = selected.id;
END;
但这不起作用。
谢谢
最诚挚的问候
I have a sqlite3-database. There's a table with some logs.
These logs are readed by a tool and were writed to a text-file (or something else) by it.
After this, the logs can be deleted. Is it possible to create a trigger in sqlite3 after a select, which automaticly deletes the logs?
Like this:
CREATE TRIGGER after_select_x
AFTER SELECT ON x
BEGIN
DELETE FROM x WHERE id = selected.id;
END;
But this doesn't work.
Thanks
Best regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不存在“选择后触发”这样的事情。查看触发器语法参考。
我建议您使用包装函数来执行应用程序中的每个 select 语句,并处理该函数中的日志。
There is no such a thing as "Trigger after select". Check out the Trigger syntax reference.
I suggest you use a wrapper function to perform every select statement in your application, and handle the logs in that function.