Documentation Home
MySQL 5.6 リファレンスマニュアル
Download this Manual
PDF (US Ltr) - 27.1Mb
PDF (A4) - 27.1Mb
HTML Download (TGZ) - 7.2Mb
HTML Download (Zip) - 7.2Mb


23.8.7.26 mysql_get_character_set_info()

void mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs)

説明

この関数はデフォルトのクライアント文字セットに関する情報を提供します。デフォルトの文字セットは mysql_set_character_set() 関数で変更できます。

この例に、MY_CHARSET_INFO 構造の使用可能なフィールドを示します。

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("character set name: %s\n", cs.name);
    printf("collation 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);
}

User Comments
  Posted by Andy Dustman on March 3, 2006
Some of the string members of MY_CHARSET_INFO can be NULL, particularly dir.

csname and name seem to be reversed from what the documentation and mysql.h say: In my tests, csname has the character set name and name has the collation.
Sign Up Login You must be logged in to post a comment.