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';
}
}