-
Notifications
You must be signed in to change notification settings - Fork 144
/
Copy pathRealEscapeString.php
50 lines (41 loc) · 1.6 KB
/
RealEscapeString.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
require_once 'Generic.php';
/**
* Converter: mysql_real_escape_string.
*
* @category Functions
*
* @author Andrey Hristov <andrey@php.net>, Ulf Wendel <ulf.wendel@phpdoc.de>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
*
* @version CVS: $Id:$, Release: @package_version@
*
* @link http://www.mysql.com
* @since Class available since Release 1.0
*/
class MySQLConverterTool_Function_RealEscapeString extends MySQLConverterTool_Function_Generic
{
public function handle(array $params = array())
{
// string mysql_real_escape_string ( string unescaped_string [, resource link_identifier] )
// string mysqli_real_escape_string ( mysqli link, string escapestr )
if (count($params) == 1) {
list($string) = $this->extractParamValues($params);
$conn = $this->ston_name;
$warning = null;
$ret = sprintf('%s(%s, %s)', $this->new_name, $conn, $string);
} else if (count($params) == 2) {
list($string, $conn) = @$this->extractParamValues($params);
$warning = null;
$ret = sprintf('%s(%s, %s)', $this->new_name, $conn, $string);
} else {
$warning = self::PARSE_ERROR_WRONG_PARAMS;
$ret = null;
}
return array($warning, $ret);
}
function getConversionHint() {
return 'Emulated using mysqli_real_escape_string and the default connection if no connection is given. A default connection has to be made before.';
}
}