Final Class Yiisoft\Db\Pgsql\Column\BitColumnInternal
| Inheritance | Yiisoft\ |
|---|
Helper utilities for bit and varbit column handling.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| className() | Yiisoft\ |
|
| dbTypecast() | Yiisoft\ |
Method Details
| public static string className ( ?int $size ) | ||
| $size | ?int | |
public static function className(?int $size): string
{
return !empty($size) && ($size > 63 || PHP_INT_SIZE !== 8 && $size > 31)
? BigBitColumn::class
: BitColumn::class;
}
| public static string|\ | ||
| $value | mixed | |
| $size | ?int | |
public static function dbTypecast(mixed $value, ?int $size): string|ExpressionInterface|null
{
return match (gettype($value)) {
'integer', 'double' => self::addZero(decbin((int) $value), $size),
'NULL' => null,
'boolean' => self::addZero($value ? '1' : '0', $size),
'string' => $value === '' ? null : $value,
default => $value instanceof ExpressionInterface ? $value : (string) $value,
};
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.