fix(sqlite): don't consider implicit commit for begin for now
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
5d566d03a0
commit
50fae37072
1 changed files with 5 additions and 2 deletions
|
|
@ -6,16 +6,15 @@ from pathlib import Path
|
|||
|
||||
import frappe
|
||||
from frappe.database.database import (
|
||||
IMPLICIT_COMMIT_QUERY_TYPES,
|
||||
TRANSACTION_DISABLED_MSG,
|
||||
Database,
|
||||
ImplicitCommitError,
|
||||
is_query_type,
|
||||
)
|
||||
from frappe.database.sqlite.schema import SQLiteTable
|
||||
from frappe.utils import get_datetime, get_table_name
|
||||
|
||||
_PARAM_COMP = re.compile(r"%\([\w]*\)s")
|
||||
IMPLICIT_COMMIT_QUERY_TYPES = frozenset(("start", "alter", "drop", "create", "truncate"))
|
||||
|
||||
|
||||
class SQLiteExceptionUtil:
|
||||
|
|
@ -510,6 +509,10 @@ class SQLiteDatabase(SQLiteExceptionUtil, Database):
|
|||
self.sql_ddl(f"DELETE FROM `{table}`")
|
||||
self.sql_ddl(f"DELETE FROM sqlite_sequence WHERE name='{table}'")
|
||||
|
||||
def check_implicit_commit(self, query: str, query_type: str):
|
||||
if query_type in IMPLICIT_COMMIT_QUERY_TYPES and self.transaction_writes:
|
||||
raise ImplicitCommitError("This statement can cause implicit commit", query)
|
||||
|
||||
|
||||
def modify_query(query):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue