public function quote($var)
    {
        if(is_null($var) || strtoupper($var) == 'NULL')
            return 'NULL';

        if ($var instanceof Date)
            $var = $this->DateFactory->toStorageDate($var)->toMySQLDate();

        return $this->getConnection()->quote($var);
    }