本文整理汇总了PHP中cubrid_real_escape_string函数的典型用法代码示例。如果您正苦于以下问题:PHP cubrid_real_escape_string函数的具体用法?PHP cubrid_real_escape_string怎么用?PHP cubrid_real_escape_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cubrid_real_escape_string函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _escape_str
/**
* Platform-dependant string escape
*
* @param string
* @return string
*/
protected function _escape_str($str)
{
if (function_exists('cubrid_real_escape_string') && (is_resource($this->conn_id) or get_resource_type($this->conn_id) === 'Unknown' && preg_match('/Resource id #/', strval($this->conn_id)))) {
return cubrid_real_escape_string($str, $this->conn_id);
}
return addslashes($str);
}
示例2: escape_str
/**
* Escape String
*
* @access public
* @param string
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
function escape_str($str, $like = FALSE)
{
if (is_array($str)) {
foreach ($str as $key => $val) {
$str[$key] = $this->escape_str($val, $like);
}
return $str;
}
if (function_exists('cubrid_real_escape_string') and is_resource($this->conn_id)) {
$str = cubrid_real_escape_string($str, $this->conn_id);
} else {
$str = addslashes($str);
}
// escape LIKE condition wildcards
if ($like === TRUE) {
$str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
}
return $str;
}
示例3: _escape_str
/**
* Platform-dependant string escape
*
* @param string
* @return string
*/
protected function _escape_str($str)
{
return cubrid_real_escape_string($str, $this->conn_id);
}
示例4: realEscapeString
public function realEscapeString($data = '')
{
if (empty($this->connect)) {
return false;
}
return cubrid_real_escape_string($data, $this->connect);
}
示例5: escape_str
/**
* Escape String
*
* @param string
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
public function escape_str($str, $like = FALSE)
{
if (is_array($str)) {
foreach ($str as $key => $val) {
$str[$key] = $this->escape_str($val, $like);
}
return $str;
}
if (function_exists('cubrid_real_escape_string') && (is_resource($this->conn_id) or get_resource_type($this->conn_id) === 'Unknown' && preg_match('/Resource id #/', strval($this->conn_id)))) {
$str = cubrid_real_escape_string($str, $this->conn_id);
} else {
$str = addslashes($str);
}
// escape LIKE condition wildcards
if ($like === TRUE) {
return str_replace(array('%', '_'), array('\\%', '\\_'), $str);
}
return $str;
}
示例6: escape
/**
* Escape all unescaped string
*
* @param string $string
* @return void
*/
public function escape($string)
{
if (is_null($this->link)) {
$this->init();
}
if (function_exists('cubrid_real_escape_string')) {
$string = cubrid_real_escape_string($string, $this->link);
} else {
$string = addslashes($string);
}
return $string;
}
示例7: escape
function escape($str)
{
// If there is no existing database connection then try to connect
if (!isset($this->dbh) || !$this->dbh) {
$this->connect($this->dbuser, $this->dbpassword, $this->dbhost);
}
return cubrid_real_escape_string(stripslashes($str));
}
示例8: testCubridRealEscapeString2
/**
* @group arnia-wrong-parameters-count
*/
public function testCubridRealEscapeString2()
{
if (OUTPUT_FUNCTION_NAME == true) {
echo "\r\nRunning: " . __FUNCTION__ . " = ";
}
try {
$this->sql = "SELECT \\abc\\, 'ds' FROM db_root";
$escaped_sql = cubrid_real_escape_string();
$this->assertTrue(FALSE, "Expected Exception not thrown.");
} catch (Exception $e) {
//echo $e->getMessage();
$this->assertEquals(0, cubrid_error_code());
$this->assertEquals(0, cubrid_error_code_facility());
$this->assertEquals('', cubrid_error_msg());
}
}
示例9: sql_escape_string
function sql_escape_string($string, $link = null)
{
if (isset($link)) {
$string = cubrid_real_escape_string($string, $link);
}
if (!isset($link)) {
$string = cubrid_real_escape_string($string);
}
if ($string === false) {
output_error("SQL Error: " . sql_error(), E_USER_ERROR);
return false;
}
return $string;
}