Code Duplication    Length = 15-15 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

@@ 925-939 (lines=15) @@
922
 * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
923
 * @return string The escaped string
924
 */
925
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false)
926
{
927
	$replacements = array(
928
		'%' => '\%',
929
		'_' => '\_',
930
		'\\' => '\\\\',
931
	);
932
933
	if ($translate_human_wildcards)
934
		$replacements += array(
935
			'*' => '%',
936
		);
937
938
	return strtr($string, $replacements);
939
}
940
941
/**
942
 * Validates whether the resource is a valid mysqli instance.

Sources/Subs-Db-postgresql.php 1 location

@@ 928-942 (lines=15) @@
925
 * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
926
 * @return string The escaped string
927
 */
928
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false)
929
{
930
	$replacements = array(
931
		'%' => '\%',
932
		'_' => '\_',
933
		'\\' => '\\\\',
934
	);
935
936
	if ($translate_human_wildcards)
937
		$replacements += array(
938
			'*' => '%',
939
		);
940
941
	return strtr($string, $replacements);
942
}
943
944
/**
945
 * Fetches all rows from a result as an array