Code Duplication    Length = 16-16 lines in 3 locations

Sources/Subs-Db-mysql.php 1 location

@@ 488-503 (lines=16) @@
485
 * @param resource $connection The connection to use (if null, $db_connection is used)
486
 * @return bool True if successful, false otherwise
487
 */
488
function smf_db_transaction($type = 'commit', $connection = null)
489
{
490
	global $db_connection;
491
492
	// Decide which connection to use
493
	$connection = $connection === null ? $db_connection : $connection;
494
495
	if ($type == 'begin')
496
		return @mysql_query('BEGIN', $connection);
497
	elseif ($type == 'rollback')
498
		return @mysql_query('ROLLBACK', $connection);
499
	elseif ($type == 'commit')
500
		return @mysql_query('COMMIT', $connection);
501
502
	return false;
503
}
504
505
/**
506
 * Database error!

Sources/Subs-Db-mysqli.php 1 location

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

Sources/Subs-Db-postgresql.php 1 location

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