| Bug #8548 | Request for a means to get the length of a field in chars instead of bytes | ||
|---|---|---|---|
| Submitted: | 16 Feb 2005 15:39 | Modified: | 11 Apr 2018 10:53 |
| Reporter: | Matthew Lord | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Charsets | Severity: | S4 (Feature request) |
| Version: | all | OS: | Any (all) |
| Assigned to: | Geir Høydalsvik | CPU Architecture: | Any |
[16 Feb 2005 15:39]
Matthew Lord
[29 Mar 2011 8:42]
Alexander Barkov
I don't think we really need a separate new field in the MYSQL_FIELD structure.
This simple function returns length of MYSQL_FIELD in characters:
/*
Convert byte length to character length
*/
unsigned long
mysql_field_character_length(MYSQL_FIELD *field)
{
CHARSET_INFO *cs;
return (cs= get_charset(fied->charsetnr)) ? field->length / cs->mbmaxlen : field->length;
}
Perhaps, instead of a new field in MYSQL_FIELD,
we should add this function into MySQL client library.
[11 Apr 2018 10:53]
Erlend Dahl
Fixed in 5.5+
