Code Duplication    Length = 16-16 lines in 2 locations

Sources/Subs-Db-postgresql.php 1 location

@@ 514-529 (lines=16) @@
511
 * @param resource $connection The connection to use (if null, $db_connection is used)
512
 * @return bool True if successful, false otherwise
513
 */
514
function smf_db_transaction($type = 'commit', $connection = null)
515
{
516
	global $db_connection;
517
518
	// Decide which connection to use
519
	$connection = $connection === null ? $db_connection : $connection;
520
521
	if ($type == 'begin')
522
		return @pg_query($connection, 'BEGIN');
523
	elseif ($type == 'rollback')
524
		return @pg_query($connection, 'ROLLBACK');
525
	elseif ($type == 'commit')
526
		return @pg_query($connection, 'COMMIT');
527
528
	return false;
529
}
530
531
/**
532
 * Database error!

Sources/Subs-Db-mysql.php 1 location

@@ 544-559 (lines=16) @@
541
 * @param resource $connection The connection to use (if null, $db_connection is used)
542
 * @return bool True if successful, false otherwise
543
 */
544
function smf_db_transaction($type = 'commit', $connection = null)
545
{
546
	global $db_connection;
547
548
	// Decide which connection to use
549
	$connection = $connection === null ? $db_connection : $connection;
550
551
	if ($type == 'begin')
552
		return @mysqli_query($connection, 'BEGIN');
553
	elseif ($type == 'rollback')
554
		return @mysqli_query($connection, 'ROLLBACK');
555
	elseif ($type == 'commit')
556
		return @mysqli_query($connection, 'COMMIT');
557
558
	return false;
559
}
560
561
/**
562
 * Database error!