Sources/Subs-Db-mysql.php 1 location
|
@@ 930-944 (lines=15) @@
|
| 927 |
|
* @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards. |
| 928 |
|
* @return string The escaped string |
| 929 |
|
*/ |
| 930 |
|
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false) |
| 931 |
|
{ |
| 932 |
|
$replacements = array( |
| 933 |
|
'%' => '\%', |
| 934 |
|
'_' => '\_', |
| 935 |
|
'\\' => '\\\\', |
| 936 |
|
); |
| 937 |
|
|
| 938 |
|
if ($translate_human_wildcards) |
| 939 |
|
$replacements += array( |
| 940 |
|
'*' => '%', |
| 941 |
|
); |
| 942 |
|
|
| 943 |
|
return strtr($string, $replacements); |
| 944 |
|
} |
| 945 |
|
|
| 946 |
|
/** |
| 947 |
|
* Validates whether the resource is a valid mysqli instance. |
Sources/Subs-Db-postgresql.php 1 location
|
@@ 873-887 (lines=15) @@
|
| 870 |
|
* @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards. |
| 871 |
|
* @return string The escaped string |
| 872 |
|
*/ |
| 873 |
|
function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false) |
| 874 |
|
{ |
| 875 |
|
$replacements = array( |
| 876 |
|
'%' => '\%', |
| 877 |
|
'_' => '\_', |
| 878 |
|
'\\' => '\\\\', |
| 879 |
|
); |
| 880 |
|
|
| 881 |
|
if ($translate_human_wildcards) |
| 882 |
|
$replacements += array( |
| 883 |
|
'*' => '%', |
| 884 |
|
); |
| 885 |
|
|
| 886 |
|
return strtr($string, $replacements); |
| 887 |
|
} |
| 888 |
|
|
| 889 |
|
/** |
| 890 |
|
* Fetches all rows from a result as an array |