Forum OpenACS Development: Response to A query writing tool.

Collapse
Posted by Tom Jackson on

I noticed when I posted the above querytext example, the bboard removed the backslashes that terminated the lines. The backslashes are not that great to have to include. I rewrote the proc so that it can be called (without backslashes) like this:

 select [qd_write_query pb_acs_pkg__new {
     package_name => :package_name 
     owner_id => :user_id 
     context_id => :user_id 
     title => "'This is an example title'" } ]

I also looked in using pg metadata to write the kb_add_function calls. I don't think it will be possible in all cases. There are several reasons. My procedures require default values, which pg doesn't maintain. The defaults in the metadata used in constructing tables do not generally apply to function defaults. One example is the primary key is not nullable, whereas in the new function it is usually null. In the set_attrs function, the primary key is required. Maybe Steve Woodcock has a different way of figuring this out. Where is the stuff he is working on?