protected function _escape_str($str) { // Escape the string $str = $this->conn_id->quote($str); // If there are duplicated quotes, trim them away return $str[0] === "'" ? substr($str, 1, -1) : $str; }