public function quote($value) { $this->getContext(); //context must be available if (null === $value) { return 'NULL'; } if (is_array($value)) { // (a, b) IN ((1, 2), (3, 4)) return '(' . implode(', ', array_map(array($this, 'quote'), $value)) . ')'; } if ($value instanceof DateTime) { return $this->context->getDriver()->formatDateTime($value); } if (is_float($value)) { return sprintf('%F', $value); // otherwise depends on setlocale() } if (is_bool($value)) { return $this->context->getDriver()->formatBool($value); } if (is_int($value) || $value instanceof SqlLiteral) { // number or SQL code - for example "NOW()" return (string) $value; } return $this->context->getPreprocessor()->quote($value); }