如何处理 SQLite 的缺失功能:禁用触发器? [英] How to handle a missing feature of SQLite : disable triggers?

查看:30
本文介绍了如何处理 SQLite 的缺失功能:禁用触发器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理 SQLite 的缺失功能:禁用触发器?

How to handle a missing feature of SQLite: disable triggers?

我没有存储特定表的触发器名称.

I don't have it stored the name of triggers for a specific table.

例如,如何删除所有触发器?
你会怎么做?

For example how can I drop all triggers?
What would you do?

推荐答案

我编写了一个非常简单的扩展函数来将布尔值设置为 true 或 false.

I wrote a very simple extension function to set a boolean value to true or false.

还有一个函数来检索这个值 (GetAllTriggersOn()).

And a function to retrieve this value (GetAllTriggersOn()).

通过这个函数,我可以定义我所有的触发器,例如:

With this function I can define all my triggers like:

CREATE TRIGGER tr_table1_update AFTER UPDATE ON TABLE1 WHEN GetAllTriggersOn()
BEGIN
    -- ...
END

这篇关于如何处理 SQLite 的缺失功能:禁用触发器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆