From 55a280aa8ea89d74e3386750cd5708127d048bbf Mon Sep 17 00:00:00 2001 From: Wazabii Date: Tue, 5 Dec 2023 22:20:58 +0100 Subject: [PATCH] Transaction --- DB.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/DB.php b/DB.php index 5b39eba..b00a3af 100755 --- a/DB.php +++ b/DB.php @@ -763,6 +763,41 @@ public function sql(): string return $this->sql; } + /** + * Start Transaction + * @return mysqli + */ + public static function beginTransaction() + { + Connect::DB()->begin_transaction(); + return Connect::DB(); + } + + + // Same as @beginTransaction + public static function transaction() + { + return self::beginTransaction(); + } + + /** + * Commit transaction + * @return void + */ + public static function commit(): void + { + Connect::DB()->commit(); + } + + /** + * Rollback transaction + * @return void + */ + public static function rollback(): void + { + Connect::DB()->rollback(); + } + /** * Get return a new generated UUID * DEPRECATED: Will be moved to Connect for starter