Mask has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks. I have a question related to Class::DBI package. Is it usefull to declare all fields in __PACKAGE__->columns? I've declared primary keys and essential fields, that I am using.
__PACKAGE__->columns( Primary => qw{pk1}); __PACKAGE__->columns( Essential => qw{f1 f2 f3});
Do I need to declare the rest of fields. Is it usefull if i am not using them for anything?
__PACKAGE__->columns( Others => qw{of1 of2 of3});

Replies are listed 'Best First'.
Re: Class::DBI --> usage of group Others in __PACKAGE__->columns
by davidrw (Prior) on Aug 25, 2005 at 15:04 UTC
    Shouldn't need to declare them at all if never used. The one caveat though would be to make sure that an INSERT statement can succeed without them -- e.g. if of1 is a NOT NULL column and does not have a default, then __PACKAGE__->create() statements are going to bomb.
      Thank you, davidrw. I am only reading from the database, no inserts or updates. Anyway, in case of some unexpected behaviour, I'll know where the problem can be. Thank you.