Go to the source code of this file.
Enumerations | |
enum | ESC_NONE |
Escape/prepare variables for string SQL queries. More... | |
enum | ESC_LAST |
enum | ESC_FIRST |
enum | ESC_BOTH |
Functions | |
& | escN (&$value) |
Escape/prepare variables for numeric SQL queries. | |
& | escS (&$value, $tkn= '', $type=ESC_LAST) |
Definition in file Db.php.
enum ESC_NONE |
Escape/prepare variables for string SQL queries.
Example:
& escN | ( | &$ | value | ) |
Escape/prepare variables for numeric SQL queries.
Example:
// Will create UPDATE user SET login_count = NULL; $loginCount = NULL; $sql = 'UPDATE user SET login_count = ' . $escN($loginCount;
Definition at line 21 of file Db.php.
References emptyString().
00022 { 00023 if (emptyString($value)) 00024 { 00025 return 'NULL'; 00026 } 00027 else 00028 { 00029 return $value; 00030 } 00031 };
& escS | ( | &$ | value, | |
$ | tkn = '' , |
|||
$ | type = ESC_LAST | |||
) |
Definition at line 52 of file Db.php.
References emptyString().
00053 { 00054 if (is_array($value) || is_object($value)) 00055 { 00056 $v = serialize($value); 00057 } 00058 else 00059 { 00060 $v =& $value; 00061 } 00062 00063 if (emptyString($v)) 00064 { 00065 $ret = 'NULL'; 00066 } 00067 else 00068 { 00069 switch ($type) 00070 { 00071 case ESC_LAST: 00072 $ret = '\'' . mysql_real_escape_string($v) . $tkn.'\''; 00073 break; 00074 00075 case ESC_FIRST: 00076 $ret = '\'' . $tkn . mysql_real_escape_string($v).'\''; 00077 break; 00078 00079 case ESC_BOTH: 00080 $ret = '\'' . $tkn . mysql_real_escape_string($v) . $tkn.'\''; 00081 break; 00082 00083 case ESC_NONE: 00084 $ret = '\'' . mysql_real_escape_string($v).'\''; 00085 break; 00086 00087 default: 00088 ASSERTLOG(TRUE, LOG_SYSTEMERROR, 'ecsS: Invalid type', EL_LEVEL_3, ECAT_SYSTEM_CORE); 00089 exit; 00090 } 00091 } 00092 00093 return $ret; 00094 }