PDO::quote always seems to slap on two single quotes regardless of the type of value I pass it, or the parameter type I set.
e.g.,
$x = null;
echo $pdo->quote($x,PDO::PARAM_NULL); // ''
Thus I've extended the PDO class with my own function,
public function quote($value, $parameter_type=PDO::PARAM_STR) {
if(is_null($value)) return 'NULL';
elseif(is_bool($value)) return $value ? 'TRUE' : 'FALSE';
elseif(is_int($value)||is_float($value)) return $value;
return parent::quote($value, $parameter_type);
}
Have I missed any cases? Is there any harm in doing this?
Do the different parameter types ever do anything?