Code Duplication    Length = 16-16 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

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

Sources/Subs-Db-postgresql.php 1 location

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