文档首页
MySQL 9.0 C API 开发指南
下载本手册
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb


MySQL 9.0 C API 开发指南  /  ...  /  mysql_get_character_set_info()

5.4.28 mysql_get_character_set_info()

Press CTRL+C to copy
void mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs)

说明

此函数提供有关默认客户端字符集的信息。可以使用 mysql_set_character_set() 函数更改默认字符集。

示例

此示例显示了 MY_CHARSET_INFO 结构中可用的字段

Press CTRL+C to copy
if (!mysql_set_character_set(&mysql, "utf8")) { MY_CHARSET_INFO cs; mysql_get_character_set_info(&mysql, &cs); printf("character set information:\n"); printf("character set+collation number: %d\n", cs.number); printf("collation name: %s\n", cs.name); printf("character set name: %s\n", cs.csname); printf("comment: %s\n", cs.comment); printf("directory: %s\n", cs.dir); printf("multi byte character min. length: %d\n", cs.mbminlen); printf("multi byte character max. length: %d\n", cs.mbmaxlen); }