CGI-CRUD

 view release on metacpan or  search on metacpan

lib/CGI/CRUD/TableIO.pm  view on Meta::CPAN


# Perform update operation

# special value of NULL still recognized, however its sufficient to have an empty new value
# where the existing value is not empty, this will update the value to NULL a little more risky but much more
# convenient because values of length < 4 (e.g. YORN and date elements) will have to be expanded to 4
# losing some ability to constrain the values
# THIS MEANS IT IS UP TO YOU TO REPRESENT ALL VALUES IN AN UPDATE, OTHERWISE THEY **WILL BE SET TO NULL**
# e.g. submit a full record to form->add_record and make sure field_template has *all* fields, either by
# completely relying on the data dictionary or inserting a record for all fields in UI_TABLE_COLUMN
sub update_data
{
    my ($self,$r) = @_;
    my $form = $self->update_form($r) || return undef;
    my $q = $r->query();
    my %vq = %$q;
    map { $vq{$_} =~ s/^NULL$// } keys(%vq);
    unless ($form->validate_query(\%vq,$self->{verify_input}))
    {
        $r->output($form->prepare($q));
        return OK;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.912 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )