Michael Lackhoff wrote: > Hi, > > I just started a new project and because it might grow more complex than > those I did before, > I switched to Template Toolkit and Class::DBI. The advantages really look > promising but of > course I also found some problems/questens. > > - how to effectively update records with Class::DBI? If I see it right I have > first to retrieve an > object to be able to do an update. I didn't find an equivalent to te sql > "update ... where id = ?" > that is all in one shot.
You can't do this with the object interface for Class::DBI since the objects directly correspond with a row in the database and don't exist unless fetched. But, one of the things I like the most about C::DBI is that you can use straight SQL anytime you want. > - how can I use 0-values (not NULL!) as primary key? When I try to add a > record with the > primary key = 0 a record is created with the next increment of the primary > key. That looks like > a bug to me (check on truth instead of definedness somewhere). I would like > to use the 0- > record as default (the other records in these tables are just copies of the > default with some > minor adjustments). Yeah, that seems to be a bug in C::DBI. I'd bring it up on their list. > - what is a "best practice" to use error variables generated by > CAP::ValidateRM in TT? Now I > have something like this: First I pass $errs to the template then in the > template (with "col" > being a template variable holding the actual field name): > <td>[% col_e = "err_$col"; errs.$col_e %]</td> > This looks more complicated than necessary to me but I didn't find a better > solution. Well, if you dynamically create your table with your fields, etc then that's probably the way to do. My templates are usually a little more static than that, so I like to put my error messages in the templates themselves and just the errors as flags instead of full messages. -- Michael Peters Developer Plus Three, LP --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[email protected]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
