Jim Gallacher
jpg at jgassociates.ca
Wed Feb 1 11:52:08 EST 2006
You can include _rowid in your query and use it instead of a primary key. It's not likely portable, and I don't see it in the mysql docs, but it does work. Jim Luis M. Gonzalez wrote: > Hi folks, > > First of all, let me apologize for asking a question that is not specific to mod_python, > but I think that it could be of interest to many of you: > > I wrote a script that creates authomatic administration pages for databases. > For a given database, whose name is pased as parameter to the script, a fully functional administration interface is created. > This interface allows me to insert, update or delete records in any table of the database, and all these actions are accessed through a web page with links > to each of the database's tables. > > There's only one problem with it. > The script assumes that the first field of each table is a primary key, and this is necessary for performing updates on the table. > In those cases where the tables don't have a primary key, or when the primary key is composed of two fields, the update cannot be performed correctly. > > The question is: > Is there any way to figure out the primary key of a table? > Perhaps through a special type of query or function? > I've been reading the mysql documentation but I couldn't find any solution, although I'm sure there might be a simple way to do it... > > Any hint would be highly appreciated... > If anyone wants to check the script, I'd be glad to send it by email. > > Regards, > Luis > > > ------------------------------------------------------------------------ > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|