Code Duplication    Length = 16-16 lines in 2 locations

Sources/Subs-Db-postgresql.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 @pg_query($connection, 'BEGIN');
532
	elseif ($type == 'rollback')
533
		return @pg_query($connection, 'ROLLBACK');
534
	elseif ($type == 'commit')
535
		return @pg_query($connection, 'COMMIT');
536
537
	return false;
538
}
539
540
/**
541
 * Database error!

Sources/Subs-Db-mysql.php 1 location

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