Sources/Subs-Db-postgresql.php 1 location
|
@@ 953-967 (lines=15) @@
|
950 |
|
* @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards. |
951 |
|
* @return string The escaped string |
952 |
|
*/ |
953 |
|
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false) |
954 |
|
{ |
955 |
|
$replacements = array( |
956 |
|
'%' => '\%', |
957 |
|
'_' => '\_', |
958 |
|
'\\' => '\\\\', |
959 |
|
); |
960 |
|
|
961 |
|
if ($translate_human_wildcards) |
962 |
|
$replacements += array( |
963 |
|
'*' => '%', |
964 |
|
); |
965 |
|
|
966 |
|
return strtr($string, $replacements); |
967 |
|
} |
968 |
|
|
969 |
|
/** |
970 |
|
* Fetches all rows from a result as an array |
Sources/Subs-Db-mysql.php 1 location
|
@@ 972-986 (lines=15) @@
|
969 |
|
* @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards. |
970 |
|
* @return string The escaped string |
971 |
|
*/ |
972 |
|
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false) |
973 |
|
{ |
974 |
|
$replacements = array( |
975 |
|
'%' => '\%', |
976 |
|
'_' => '\_', |
977 |
|
'\\' => '\\\\', |
978 |
|
); |
979 |
|
|
980 |
|
if ($translate_human_wildcards) |
981 |
|
$replacements += array( |
982 |
|
'*' => '%', |
983 |
|
); |
984 |
|
|
985 |
|
return strtr($string, $replacements); |
986 |
|
} |
987 |
|
|
988 |
|
/** |
989 |
|
* Validates whether the resource is a valid mysqli instance. |