Code Duplication    Length = 16-16 lines in 2 locations

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

Sources/Subs-Db-mysql.php 1 location

@@ 523-538 (lines=16) @@
520
 * @param resource $connection The connection to use (if null, $db_connection is used)
521
 * @return bool True if successful, false otherwise
522
 */
523
function smf_db_transaction($type = 'commit', $connection = null)
524
{
525
	global $db_connection;
526
527
	// Decide which connection to use
528
	$connection = $connection === null ? $db_connection : $connection;
529
530
	if ($type == 'begin')
531
		return @mysqli_query($connection, 'BEGIN');
532
	elseif ($type == 'rollback')
533
		return @mysqli_query($connection, 'ROLLBACK');
534
	elseif ($type == 'commit')
535
		return @mysqli_query($connection, 'COMMIT');
536
537
	return false;
538
}
539
540
/**
541
 * Database error!