public static function trans_test1()
{
try
{
DB::start_transaction();
$query1 = DB::query("INSERT INTO users (`login`, `password`) VALUES ('test', '123')")->execute();
$query2 = self::trans_test2();
DB::commit_transaction();
return $query1;
}
catch (Exception $e)
{
DB::rollback_transaction();
throw $e;
}
}
public static function trans_test2()
{
try
{
DB::start_transaction();
$query2 = DB::query('SELECT * FROM `users`')->execute();
DB::commit_transaction();
return $query2;
}
catch (Exception $e)
{
DB::rollback_transaction();
throw $e;
}
}
PDOException [ Error ]:
There is no active transaction
COREPATH/classes/database/pdo/connection.php @ line 474
It looks like you're new here. If you want to get involved, click one of these buttons!