Forum OpenACS Q&A: Re: New content repository documentation

Posted by Jon Griffin on
A couple of comments now that I have dug into CR also.
1. If you autogenerate your tables, you lose constraints and etc. so this isn't really a good solution yet.
2. If your table already exists there appears to be a bug that doesn't create the views. I have tested this under Oracle only at the moment.

Related to that is that if you name your id_column revision_id, it also appears to not create the views. I haven't seen anything in the code that should cause that, but I have verified by naming the id_column a different name and it works as expected,(except if your table exists).

Has anyone used CR with already existing tables and had the tablenamex and tablenamei be autocreated. Also the triggers don't get created.

I ran the plsql by hand and no errors but also no views or triggers.

Posted by Tom Jackson on

I think you loose too much with autogenerated tables, the sql for a table is really the best way to document the data model. The same thing happens with the plsql code: it is all autogenerated and never written down anywhere. But that is the requirement for having a dynamic typing system I guess.

I am working on some improvements to the query-writer package which generates the pl for the new/update/delete functions. The improvements include removing all pl, except that necessary to createupdate/delete the parent acs_object. Even this pl is wrapped in a tcl proc acs_object::new/update/delete.

Also there was a tedious process once the datamodel had been created to reenter all this information into the query-writer package. This has been replaced with a wizard which requires you to create the object which is related to the table for the data model, the wizard takes the table and traces the primary key back to the acs_objects table. There are no 16 param limits with this method.

Although the query-writer handles all the dml/pl dynamically, I think I will put in the code for writing out standard tcl procs similar to the acs_object procs. Then using the query-writer for a few minutes would allow the developer to get a set of functions they could use in their application independent of the query-writer.

Anyway my point here is if you are autogenerating code, why not make it tcl code!

Posted by Jeff Davis on
Jon, the images table is created first and then the type and attributes are created and the imagesx and imagesi views are created so I am not sure why a preexisting table would be a problem. (look at acs-content-repository/sql/oracle/content-image.sql to see whats done).

As for naming the column revision_id, the views include all the columns of the child tables so if there are names that collide generally the views can't be created.