Code Duplication    Length = 16-16 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

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

Sources/Subs-Db-postgresql.php 1 location

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