lithium\data\source\Database::_introspectType PHP 메소드

_introspectType() 보호된 메소드

Attempts to automatically determine the column type of a value. Used by the value() method of various database adapters to determine how to prepare a value if the schema is not specified.
protected _introspectType ( mixed $value ) : string
$value mixed The value to be prepared for an SQL query.
리턴 string Returns the name of the column type which `$value` most likely belongs to.
    protected function _introspectType($value)
    {
        switch (true) {
            case is_bool($value):
                return 'boolean';
            case is_float($value) || preg_match('/^\\d+\\.\\d+$/', $value):
                return 'float';
            case is_int($value) || preg_match('/^\\d+$/', $value):
                return 'integer';
            case is_string($value) && strlen($value) <= $this->_columns['string']['length']:
                return 'string';
            default:
                return 'text';
        }
    }