Skip to content

Commit 55a280a

Browse files
author
Wazabii
committed
Transaction
1 parent 1e207c7 commit 55a280a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

DB.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,41 @@ public function sql(): string
763763
return $this->sql;
764764
}
765765

766+
/**
767+
* Start Transaction
768+
* @return mysqli
769+
*/
770+
public static function beginTransaction()
771+
{
772+
Connect::DB()->begin_transaction();
773+
return Connect::DB();
774+
}
775+
776+
777+
// Same as @beginTransaction
778+
public static function transaction()
779+
{
780+
return self::beginTransaction();
781+
}
782+
783+
/**
784+
* Commit transaction
785+
* @return void
786+
*/
787+
public static function commit(): void
788+
{
789+
Connect::DB()->commit();
790+
}
791+
792+
/**
793+
* Rollback transaction
794+
* @return void
795+
*/
796+
public static function rollback(): void
797+
{
798+
Connect::DB()->rollback();
799+
}
800+
766801
/**
767802
* Get return a new generated UUID
768803
* DEPRECATED: Will be moved to Connect for starter

0 commit comments

Comments
 (0)