Code Duplication    Length = 16-16 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

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

Sources/Subs-Db-postgresql.php 1 location

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