public function execute($array = array()) { $connection = $this->__connection; if (count($this->__boundParams) > 0) { $array =& $this->__boundParams; } $__query = $this->__query; if (count($array) > 0) { foreach ($array as $k => $v) { if (!is_int($k) && substr($k, 0, 1) === ':') { if (!isset($tempf)) { $tempf = $tempr = array(); } array_push($tempf, $k); array_push($tempr, "'" . sasql_escape_string($connection, $v) . "'"); } else { if (!is_int($k)) { if (!isset($tempf)) { $tempf = $tempr = array(); } array_push($tempf, ':' . $k); array_push($tempr, "'" . sasql_escape_string($connection, $v) . "'"); } else { $parse = function ($matchs) use($connection, $array, $k) { static $i = 0; if (empty($array[$i])) { $i++; return 'NULL'; } return "'" . sasql_escape_string($connection, $array[$i++]) . "'"; }; $__query = preg_replace_callback("(\\?)is", $parse, $__query); break; } } } if (isset($tempf)) { $__query = str_replace($tempf, $tempr, $__query); } } $this->__result = $this->__uquery($__query); $this->__boundParams = array(); return $this->__result; }
/** * 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('sasql_real_escape_string') and is_resource($this->conn_id)) { $str = sasql_real_escape_string($this->conn_id, $str); } elseif (function_exists('sasql_escape_string')) { $str = sasql_escape_string($str); } else { $str = addslashes($str); } // escape LIKE condition wildcards if ($like === TRUE) { $str = str_replace(array($this->_like_escape_chr, '%', '_'), array($this->_like_escape_chr . $this->_like_escape_chr, $this->_like_escape_chr . '%', $this->_like_escape_chr . '_'), $str); } return $str; }
/** * {@inheritdoc} */ public function quote($input, $type = \PDO::PARAM_STR) { if (is_int($input) || is_float($input)) { return $input; } return "'" . sasql_escape_string($this->connection, $input) . "'"; }
public function escape($data) { return sasql_escape_string($this->connection, $data); }
/** * 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; } $str = sasql_escape_string($this->conn_id, $str); // escape LIKE condition wildcards if ($like === TRUE) { $str = str_replace(array('%', '_', $this->_like_escape_chr), array($this->_like_escape_chr . '%', $this->_like_escape_chr . '_', $this->_like_escape_chr . $this->_like_escape_chr), $str); } return $str; }