fix for ADOdb's missing BlobEncode function for mysql, that caused a lot SQL-errors in email

This commit is contained in:
Ralf Becker 2004-04-14 09:28:18 +00:00
parent 167efc7cf5
commit b7890a9ba4

View File

@ -275,6 +275,7 @@
{ {
return False; return False;
} }
if (is_array($str)) $this->halt('db::db_addslashes('.print_r($str,True).",'$type') 1. arguments is an array!!!");
// the substring is needed as the string is already in quotes // the substring is needed as the string is already in quotes
return substr($this->Link_ID->quote($str),1,-1); return substr($this->Link_ID->quote($str),1,-1);
} }
@ -849,6 +850,8 @@
*/ */
function quote($value,$type=False) function quote($value,$type=False)
{ {
if ($this->Debug) echo "<p>db::quote('$value','$type')</p>\n";
switch($type) switch($type)
{ {
case 'int': case 'int':
@ -868,6 +871,10 @@
switch($type) switch($type)
{ {
case 'blob': case 'blob':
if ($this->Type == 'mysql')
{
break; // ADOdb has no BlobEncode for mysql and returns an unquoted string !!!
}
return "'" . $this->Link_ID->BlobEncode($value) . "'"; return "'" . $this->Link_ID->BlobEncode($value) . "'";
} }
return $this->Link_ID->quote($value); return $this->Link_ID->quote($value);
@ -896,6 +903,8 @@
{ {
$column_definitions = $this->column_definitions; $column_definitions = $this->column_definitions;
} }
if ($this->Debug) echo "<p>db::column_data_implode('$glue',".print_r($array,True).",'$use_key',".print_r($only,True).",<pre>".print_r($column_definitions,True)."</pre>\n";
$keys = $values = array(); $keys = $values = array();
foreach($array as $key => $data) foreach($array as $key => $data)
{ {