1 package DBIx::Class::Storage::DBI::DBM;
3 use base 'DBIx::Class::Storage::DBI::DBDFile';
8 my ($self, $source, $to_insert) = @_;
10 my $col_infos = $source->columns_info;
12 foreach my $col (keys %$col_infos) {
13 # this will naturally fall into undef/NULL if default_value doesn't exist
14 $to_insert->{$col} = $col_infos->{$col}{default_value}
15 unless (exists $to_insert->{$col});
18 $self->next::method($source, $to_insert);
22 my ($self, $source, $cols, $data) = @_;
24 my $col_infos = $source->columns_info;
26 foreach my $col (keys %$col_infos) {
27 unless (grep { $_ eq $col } @$cols) {
29 for my $r (0 .. $#$data) {
30 # this will naturally fall into undef/NULL if default_value doesn't exist
31 $data->[$r][$#$cols] = $col_infos->{$col}{default_value};
36 $self->next::method($source, $cols, $data);
43 DBIx::Class::Storage::DBI::DBM - Support for DBM & MLDBM files via DBD::DBM
47 This subclass supports DBM & MLDBM files via L<DBD::DBM>.
51 This subclass is essentially just a stub that uses the super class
52 L<DBIx::Class::Storage::DBI::DBDFile>.
54 =head1 IMPLEMENTATION NOTES
56 =head2 Missing fields on INSERTs
58 L<DBD::DBM> will balk at missing columns on INSERTs. This storage engine will
59 add them in with either the default_value attribute or NULL.
63 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
67 You may distribute this code under the same terms as Perl itself.