in reply to Magical SQL

One of the tradeoffs this scheme makes is simplicity against database overhead, in the form of an extra query to get table descriptions. There are some environments where this won't fly. Those environments are characterized by being sufficiently database intensive that they have a separate database group responsible for physical layout and performance. If load on the DB is getting critical oversight, deploying a scheme that uses an extra table description query per CGI invocation will sooner or later get you a visit from the DB police.

Your example suggests that you're running your own MySQL, so you're probably O.K.

Replies are listed 'Best First'.
Extra queries
by powerman (Friar) on Apr 26, 2002 at 18:51 UTC
    Yes, we know about this. And current solution is create file with current database structure and use this file instead of DESC queries. Database structure seldom changed when project is ready, and after these seldom changes recreate file with database structure is not very difficult.
      Yeap, Alzabo does this too.

      Wheels ... reinventing ...

      But hey, it's your choice. You can write your own tool which may or may not get used by others, to which you'll have to add all your own new features, which you'll have to debug. And you _will_ add more features. I guarantee it. When I first started Alzabo, I didn't need feature X. Then later I did, and I added it. Or someone else asked for it. It's a better tool for it, but it is big. But it's closer to _complete_ than anything anyone could whip up from scratch (unless scratch means 2.5 years of development!).

      Or you can use an existing, supported tool which has other users and for which you can simply submit bug reports, like say Alzabo, SPOPS, or Class::DBI.