Code Duplication    Length = 15-15 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

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

Sources/Subs-Db-postgresql.php 1 location

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