identifying auto-increment columns

Hi,

I am developing a database management package for mysql. I want to be able to provide a sql dump facility, which will produce the sql code for creating a table and populating it.

I do not seem to be able to find a function for identifying if a field is auto-incrementing?

The only thing that I could find it the DatabaseMetaData.getTypeInfo() will let you know if a field can used for an auto-increment value, not if it is actually auto-incrementing.

Please help!

[505 byte] By [langers] at [2007-9-26 3:49:20]
# 1

If you do a query of this table and then have a look at

the ResultSetMetaData you can use the methode:

booleanisAutoIncrement(int column)

Indicates whether the designated column is

automatically numbered, thus read-only.

Or you can use the MYSQL-command :

show columns from table to get all the info of each

column.

mysql> show columns from table;

+--++-+-+--+--+

| Field | Type| Null | Key | Default | Extra|

+--++-+-+--+--+

where the Extra column contains 'auto_increment ' if it is...

...what in fact is not that DB-independent.....

Regards

Fredy

FredyF at 2007-6-29 12:33:50 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...