Code Duplication    Length = 16-16 lines in 2 locations

Sources/Subs-Db-mysql.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 @mysqli_query($connection, 'BEGIN');
559
	elseif ($type == 'rollback')
560
		return @mysqli_query($connection, 'ROLLBACK');
561
	elseif ($type == 'commit')
562
		return @mysqli_query($connection, 'COMMIT');
563
564
	return false;
565
}
566
567
/**
568
 * Database error!

Sources/Subs-Db-postgresql.php 1 location

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