select($query->castAsChar('a')); * $query->select($query->castAsChar('a', 40)); * * @param string $value The value to cast as a char. * @param string $length The length of the char. * * @return string Returns the cast value. * * @since 1.8.0 */ public function castAsChar($value, $length = null) { if ((int) $length < 1) { return $value . '::text'; } return 'CAST(' . $value . ' AS CHAR(' . $length . '))'; } }