if ($type == TYPE_NOCLEAN OR $type == TYPE_STR OR $type == TYPE_STRUN)
{
- return "'" . $this->registry->escape($this->values["$name"]) . "'";
+ return "'" . $this->registry->db->escape_string($this->values["$name"]) . "'";
}
else if ($type == TYPE_BOOL)
{
return ($this->values["$name"] == true ? "'1'" : "'0'");
}
+ else if ($type == TYPE_BIN)
+ {
+ return "'" . $this->registry->db->escape_binary($this->values["$name"]) . "'";
+ }
else
{
return $this->values["$name"];
'error_num' => 'mysql_errno',
'error_str' => 'mysql_error',
'escape_string' => '$this->command_mysql_escape_string',
+ 'escape_binary' => '$this->escape_binary',
'fetch_assoc' => 'mysql_fetch_assoc',
'fetch_row' => 'mysql_fetch_row',
'fetch_object' => 'mysql_fetch_object',
return mysql_query($string, $link);
}
+ // ###################################################################
+ /**
+ * Escapes a binary string for insertion into the database
+ *
+ * @access public
+ *
+ * @param string Unescaped data
+ *
+ * @return string Escaped binary data
+ */
+ function escape_binary($binary)
+ {
+ return mysql_escape_string($binary);
+ }
+
// ###################################################################
/**
* Wrapper: mysql(_real)_escape_string
2.0.1
===============
-- Add TYPE_NONE as an alias for TYPE_NOCLEAN
+- Added TYPE_NONE as an alias for TYPE_NOCLEAN
+- Added TYPE_BIN to create a macro in the API that will escape the string as binary, instead of a string
+- DB_MySQL can now properly escape binary
2.0.0
===============
* Duplicate of TYPE_NOCLEAN, but shorter
*/
define('TYPE_NONE', TYPE_NOCLEAN);
+
+/**
+* Macro for using DB->escape_binary() without cleaning - used in API
+*/
+define('TYPE_BIN', 128);
/**#@-*/
/**
$value = $value;
}
}
+ else if ($type == TYPE_BIN)
+ {
+ $value = $value;
+ }
else
{
trigger_error('Invalid clean type `' . $type . '` specified', E_USER_ERROR);