Sources/Subs-Db-postgresql.php 1 location
|
@@ 918-932 (lines=15) @@
|
| 915 |
|
* @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards. |
| 916 |
|
* @return string The escaped string |
| 917 |
|
*/ |
| 918 |
|
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false) |
| 919 |
|
{ |
| 920 |
|
$replacements = array( |
| 921 |
|
'%' => '\%', |
| 922 |
|
'_' => '\_', |
| 923 |
|
'\\' => '\\\\', |
| 924 |
|
); |
| 925 |
|
|
| 926 |
|
if ($translate_human_wildcards) |
| 927 |
|
$replacements += array( |
| 928 |
|
'*' => '%', |
| 929 |
|
); |
| 930 |
|
|
| 931 |
|
return strtr($string, $replacements); |
| 932 |
|
} |
| 933 |
|
|
| 934 |
|
?> |
Sources/Subs-Db-mysql.php 1 location
|
@@ 904-918 (lines=15) @@
|
| 901 |
|
* @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards. |
| 902 |
|
* @return string The escaped string |
| 903 |
|
*/ |
| 904 |
|
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false) |
| 905 |
|
{ |
| 906 |
|
$replacements = array( |
| 907 |
|
'%' => '\%', |
| 908 |
|
'_' => '\_', |
| 909 |
|
'\\' => '\\\\', |
| 910 |
|
); |
| 911 |
|
|
| 912 |
|
if ($translate_human_wildcards) |
| 913 |
|
$replacements += array( |
| 914 |
|
'*' => '%', |
| 915 |
|
); |
| 916 |
|
|
| 917 |
|
return strtr($string, $replacements); |
| 918 |
|
} |
| 919 |
|
|
| 920 |
|
/** |
| 921 |
|
* Validates whether the resource is a valid mysqli instance. |