Code Duplication    Length = 16-16 lines in 2 locations

Sources/Subs-Db-postgresql.php 1 location

@@ 550-565 (lines=16) @@
547
 * @param resource $connection The connection to use (if null, $db_connection is used)
548
 * @return bool True if successful, false otherwise
549
 */
550
function smf_db_transaction($type = 'commit', $connection = null)
551
{
552
	global $db_connection;
553
554
	// Decide which connection to use
555
	$connection = $connection === null ? $db_connection : $connection;
556
557
	if ($type == 'begin')
558
		return @pg_query($connection, 'BEGIN');
559
	elseif ($type == 'rollback')
560
		return @pg_query($connection, 'ROLLBACK');
561
	elseif ($type == 'commit')
562
		return @pg_query($connection, 'COMMIT');
563
564
	return false;
565
}
566
567
/**
568
 * Database error!

Sources/Subs-Db-mysql.php 1 location

@@ 551-566 (lines=16) @@
548
 * @param resource $connection The connection to use (if null, $db_connection is used)
549
 * @return bool True if successful, false otherwise
550
 */
551
function smf_db_transaction($type = 'commit', $connection = null)
552
{
553
	global $db_connection;
554
555
	// Decide which connection to use
556
	$connection = $connection === null ? $db_connection : $connection;
557
558
	if ($type == 'begin')
559
		return @mysqli_query($connection, 'BEGIN');
560
	elseif ($type == 'rollback')
561
		return @mysqli_query($connection, 'ROLLBACK');
562
	elseif ($type == 'commit')
563
		return @mysqli_query($connection, 'COMMIT');
564
565
	return false;
566
}
567
568
/**
569
 * Database error!