List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:October 7 2008 1:35pm
Subject:Re: C api - mysql_list_fields
View as plain text  
Mike, all,


Mike Aubury wrote:
> [[...]]
> 
> So - the next question is...
> Is there anyway in code I can find the 'fiddle' factor (1,3,or now possibly 4) 
> that I need to use to divide by to get back to the character width specified 
> in the CREATE TABLE ? 

In the "information_schema" database, which you can use to access schema
information, MySQL differs between "CHARACTER_MAXIMUM_LENGTH" (the
number of characters) and "CHARACTER_OCTET_LENGTH" (number of bytes).

But this need not be the same factor for all columns:
If you specify one with "charset latin1", it is one octet (byte) per
character.

So I don't see any use in such a constant factor.
And sorry, no, off-hand I don't know a way to programmatically ask the
server for this factor.

If you need to know the number of characters specified for some column,
you should access the "information_schema" database and get all those
details, including character set and collation.


HTH,
Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  joerg@stripped   (+49 30) 417 01 487
Sun Microsystems GmbH,   Sonnenallee 1,   D-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering     Muenchen: HRB161028

Thread
C api - mysql_list_fieldsMike Aubury6 Oct
  • Re: C api - mysql_list_fieldsDoug Bridgens7 Oct
  • Re: C api - mysql_list_fieldsSimon J Mudd7 Oct
  • Re: C api - mysql_list_fieldsJoerg Bruehe7 Oct
    • Re: C api - mysql_list_fieldsMike Aubury7 Oct
      • Re: C api - mysql_list_fieldswalter harms7 Oct
        • Re: C api - mysql_list_fieldsMike Aubury7 Oct
      • Re: C api - mysql_list_fieldsJoerg Bruehe7 Oct