--- trunk/lib/App/RoomReservation/Reservation.pm 2009/07/05 21:51:15 1174 +++ trunk/lib/App/RoomReservation/Reservation.pm 2009/07/06 20:27:57 1175 @@ -108,6 +108,25 @@ submit => 'PoĊĦalji', # submit button }} +sub form_value_len { + my $self = shift; + my $sth = $self->dbh->prepare(qq{ + select * from reservation limit 1 + }); + $sth->execute; + my @columns = $sth->fetchrow_array; + + $sth = $self->dbh->prepare(qq{ + select + } . join(',', map { "max(length($_)) as $_" } grep { !/^_/ && !/id/ } @{ $sth->{NAME} } ) . qq{ + from reservation + }); + $sth->execute; + my $max_len = $sth->fetchrow_hashref; + warn "# max_len = ", $self->dump( $max_len ); + return $max_len; +} + sub BUILD { my $self = shift; my $email = $self->email;