Code Duplication    Length = 16-16 lines in 2 locations

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!

Sources/Subs-Db-mysql.php 1 location

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