List:General Discussion« Previous MessageNext Message »
From:Mike Aubury Date:October 7 2008 1:16pm
Subject:Re: C api - mysql_list_fields
View as plain text  
Basically - so I can display it in the same form as the orginal table..

Or - if you want the longer version....
I work with an Opensource project called 'Aubit4GL' (its a clone of 
Informix4GL - which allows you to write really nice screen based database 
oriented programs + reports), see http://sourceforge.net/projects/aubit4gl

Anyway - part of that project is a tool called 'asql' (which is a replacement 
for the Informix 'isql' tool..), this tool is itself written using Aubit4GL.


You can think of asql as an easy to use screen based (ncurses) equivilent of 
the mysql tool..
One of the options is a 'Table Info' - where you get a list of the columns and 
the datatypes etc.
When you create a table with a char(20) - you dont want to see it appear as a 
char(60)!

I have a workaround atm - but its really clunky - I do a separate select for 
each column in the form : "SHOW COLUMNS FROM table LIKE 'column'" for each 
column returned from mysql_list_fields



BTW - I'll need some help with some of the other displays (indexes, status 
etc) - if anyone fancies lending a hand - we always welcome new volunteers!
(The 'mysql' driver for Aubit4GL could probably do with some attention from 
someone who knows their way around....)




On Tuesday 07 October 2008 13:10:18 walter harms wrote:
> Mike Aubury schrieb:
> > Excellent - this seems to be the issue - the show create table shows :
> >
> >  mysql> show create table a\g
> > +-------+----------------------------------------------------------------
> >------------------------+
> >
> > | Table | Create
> >
> > Table                                                                    
> >       |
> > +-------+----------------------------------------------------------------
> >------------------------+
> >
> > | a     | CREATE TABLE `a` (
> >
> >   `blah` char(20) default NULL
> > ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
> > +-------+-----------
> >
> >
> > So - its utf8 (which I understand enough about to understand why its
> > doing what its doing!)
> >
> > 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 ?
>
> why do you want to do that ?
> i would expect that mysql uses wchar_t for char() if utf8 is selected.
>
> re,
>  wh


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