fuel/fuel/core/classes/database/connection.php
public function quote($value)
	{
		if ($value === null)
		{
			return 'null';
		}
		elseif ($value === true)
		{
			return "'1'";
		}
		elseif ($value === false)
		{
			return "'0'";
		}
		elseif (is_object($value))
		{
			if ($value instanceof Database_Query)
			{
				// Create a sub-query
				return '('.$value->compile($this).')';
			}
			elseif ($value instanceof Database_Expression)
			{
				// Use a raw expression
				return $value->value();
			}
			else
			{
				// Convert the object to a string
				return $this->quote((string) $value);
			}
		}
		elseif (is_array($value))
		{
			return '('.implode(', ', array_map(array($this, __FUNCTION__), $value)).')';
		}
		elseif (is_int($value))
		{
			return (int) $value;
		}
		elseif (is_float($value))
		{
			// Convert to non-locale aware float to prevent possible commas
			return sprintf('%F', $value);
		}

		return $this->escape($value);
	}
public function quote($value)
	{
		if ($value === null)
		{
			return 'null';
		}
		elseif ($value === true)
		{
			return "'1'";
		}
		elseif ($value === false)
		{
			return "'0'";
		}
		elseif (is_object($value))
		{
			if ($value instanceof Database_Query)
			{
				// Create a sub-query
				return '('.$value->compile($this).')';
			}
			elseif ($value instanceof Database_Expression)
			{
				// Use a raw expression
				return $value->value();
			}
			else
			{
				// Convert the object to a string
				return $this->quote((string) $value);
			}
		}
		elseif (is_array($value))
		{
			return '('.implode(', ', array_map(array($this, __FUNCTION__), $value)).')';
		}
		elseif (is_int($value))
		{
			return (int) $value;
		}
		elseif (is_float($value))
		{
			// Convert to non-locale aware float to prevent possible commas
			return sprintf('%F', $value);
		}

		return $this->escape($value);
	}
public function quote ( $ value ) { if ( $ value === null ) { return 'null' ; } elseif ( $ value === true ) { return "'1'" ; } elseif ( $ value === false ) { return "'0'" ; } elseif ( is_object ( $ value ) ) { if ( $ value instanceof Database_Query ) { // Create a sub-query return '(' . $ value -> compile ( $ this ) . ')' ; } elseif ( $ value instanceof Database_Expression ) { // Use a raw expression return $ value -> value ( ) ; } else { // Convert the object to a string return $ this -> quote ( ( string ) $ value ) ; } } elseif ( is_array ( $ value ) ) { return '(' . implode ( ', ' , array_map ( array ( $ this , __FUNCTION__ ) , $ value ) ) . ')' ; } elseif ( is_int ( $ value ) ) { return ( int ) $ value ; } elseif ( is_float ( $ value ) ) { // Convert to non-locale aware float to prevent possible commas return sprintf ( '%F' , $ value ) ; } return $ this -> escape ( $ value ) ; }
Quote a value for an SQL query.

$db->quote(null);   // 'null'
$db->quote(10);     // 10
$db->quote('fred'); // 'fred'

Objects passed to this function will be converted to strings.
[Database_Expression] objects will use the value of the expression.
[Database_Query] objects will be compiled and converted to a sub-query.
All other objects will be converted using the `__toString` method.

@param   mixed $value any value to quote

@return  string

@uses    static::escape
Quote a value for an SQL query .