rspec/rules/S1746/rule.adoc
2022-02-04 16:28:24 +00:00

34 lines
838 B
Plaintext

In most databases, the SQL ``++TRUNCATE++`` statement has the following side effects:
* The table being truncated is locked during the operation
* The transaction log is not updated during the operation, which means that a TRUNCATE operation can't be part of a transaction.
* ``++DELETE++`` triggers are not fired during truncation
For these reasons use of the ``++TRUNCATE++`` statement may not be permitted in some environments. This rule flags all uses of the ``++TRUNCATE++`` statement.
== Noncompliant Code Example
[source,text]
----
EXEC SQL TRUNCATE MY_TABLE END-EXEC.
----
== Compliant Solution
[source,text]
----
EXEC SQL DELETE FROM MY_TABLE END-EXEC.
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]