Get Started

Where Syntax

Query

Transaction

Advanced

PDO object

Debug

Information

version: 1.1.3

action

Start a transaction

action( $callback )
Return: void
Not every database or database engine supports transactions. You have to check before using it. All queries will be automatically committed inside the transaction wrap. You can also return false value to rollback the transactions.
$database->action(function($database) {
	$database->insert("account", [
		"name" => "foo",
		"email" => "bar@abc.com"
	]);

	$database->delete("account", [
		"user_id" => 2312
	]);

	// If you want to  find something wrong, just return false to rollback the whole transaction.
	if ($database->has("post", ["user_id" => 2312]))
	{
		return false;
	}
});