List:General Discussion« Previous MessageNext Message »
From:Jim O'Quinn Date:October 7 1999 6:06pm
Subject:Re: finding AUTO_INCREMENT type from client side
View as plain text  
> > Is there any way to programmatically figure out
> > if a field is AUTO_INCREMENT?  I can do something
> > like:
> >
> >   for ($x=0; $x < $sth->numfields; $x++) {
> >     $colname  = $sth->name->[$x];
> >     $size     = $sth->length->[$x];
> >     $maxlen   = $sth->length->[$x];
> >     $type     = $sth->type->[$x];
> >   }
> >
> > But from what I can tell, 'type' is a INT and
> > there is no way to tell if it is AUTO_INCREMENT
> > or not?
> >
> > Does anyone know of a way to figure out if a
> > field is AUTO_INCREMENT?
> >
> 
> Take a look at mysqlshow.c


I did, and it looks like I have to re-query
the database to figure out if the field
is AUTO_INCREMENT or not ('show fields from 
SOME_TABLE_NAME') and then parse the resulting
data, but I was hoping to get the info back 
somewhere in the meta-data from the original
query and not have to re-query.  

Any thoughts?

Jim



> 
>   jim...
Thread
finding AUTO_INCREMENT type from client sideJim O'Quinn7 Oct
  • Re: finding AUTO_INCREMENT type from client sideThimble Smith7 Oct
  • Re: finding AUTO_INCREMENT type from client sideJim O'Quinn7 Oct
    • Re: finding AUTO_INCREMENT type from client sideMichael Widenius8 Oct
  • Re: finding AUTO_INCREMENT type from client sideJim O'Quinn8 Oct
    • Re: finding AUTO_INCREMENT type from client sideThimble Smith8 Oct
  • Re: finding AUTO_INCREMENT type from client sideJim O'Quinn8 Oct
    • Re: finding AUTO_INCREMENT type from client sideThimble Smith8 Oct
    • Re: finding AUTO_INCREMENT type from client sideMichael Widenius10 Oct