[ic] DatabaseAuto and auto_increment
mike at perusion.com
Wed Nov 2 20:20:15 EST 2005
Quoting JT Justman (jt at airdelights.com):
> Mike Heins wrote:
> > Quoting Jon Jensen (jon at endpoint.com):
> >>On Wed, 2 Nov 2005, JT Justman wrote:
> >>>I've recently set up DatabaseAuto on first my testing and now production
> >>>servers. I neglected to notice, however, that for tables with
> >>>auto_incriment set, IC still tries to set an index in the UI. If I set
> >>>like this:
> >>>Database table_name AUTO_SEQUENCE 1
> >>>in catalog/db config, as I had before, it seems to work. But, the point
> >>>of using DatabaseAuto was to avoid having to specify such things for
> >>>each table, and I've got tons of custom tables.
> >>Does that really work with MySQL? Does MySQL 4.1 have sequences?
> > It doesn't have sequences, but we emulate the behavior with
> > AUTO_INCREMENT.
> I confess that I have been using such directives in my dbconf's for a
> while. It has appeared to work thusfar. Should I be changing it?
I don't know why -- I use AUTO_SEQUENCE on MySQL constantly. It is a
convenient way to set an integer AUTO_INCREMENT field.
> >>>I was looking at the DatabaseDefault code and it's a tad over my head. I
> >>>can only imagine that there is some kind of magic going on that pulls
> >>>the hash of the table info from DBI. Is there an existing mechanism that
> >>>can help me out here?
> >>I'm not aware of any. It would be nice to have. Still, using DatabaseAuto
> >>saves you a fair amount of manual configuration even if you still need to
> >>specify sequences separately ...
> > If the OP could explain precisely how we might intuit the AUTO_SEQUENCE
> > behavior from the SQL configuration perhaps we would. But I think we are
> > waiting on the Mind::Read module for Perl....
> The only solution I can see is to parse the output of DESCRIBE. Which I
> suppose is somewhat less than elegant.
It also is far from sure, as I see it, that you can reliably divine the
I suppose you could automatically set AUTO_SEQUENCE if you found an
AUTO_INCREMENT in a primary key field, but I wouldn't say my SQL experience
is comprehensive enough to be sure there was no other way to set it.
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.647.1295 tollfree 800-949-1889 <mike at perusion.com>
For a successful technology, reality must take precedence over public
relations, for Nature cannot be fooled. -- Dick Feynman
More information about the interchange-users