From: Ray Z. <rz...@co...> - 2002-10-03 17:43:26
|
At 11:19 AM -0400 10/3/02, Chris Winters wrote: >But when we do an insert/update we want to match up the fields with >their types, so we do something like: > > my $fields = $class->field_list; > # $fields = [ 'FOO', 'BAR', 'BAZ' ] > my $dbi_types = $class->db_discover_types; > # keys \%dbi_types = ( 'foo', 'bar', 'baz' ) > foreach my $field ( @{ $fields } ) { > my $field_type = $dbi_types->{ $field }; # uh oh, type not found! > } So that last line currently needs to be ... my $field_type = $dbi_types->{ lc $field }; ... in order to find the type, right? >As a result, I don't know if we can change the return value of >'db_discover_types', but I think we can change the return value of 'keys >%{ $obj }' without too much difficulty. > >Well now that I think about it... maybe we can make the return of >'db_discover_types' a tied hash as well. Unless, of course, you've got >something else up your sleeve :-) Well, I suppose that would "fix" it. The reason it appeared as a "bug" to me is that I always use consistent case between the SPOPS config and the names in the database (which I thought should be as safe as you can get), but we ran into problems with the db_discover_types because it was returning a hash with lc'd keys. I would prefer things being case sensitive everywhere, like a regular Perl hash, but since SQL (or at least mysql) has case-insensitive column names, I guess that's not a reasonable option. -- Ray Zimmerman / e-mail: rz...@co... / 428-B Phillips Hall Sr Research / phone: (607) 255-9645 / Cornell University Associate / FAX: (815) 377-3932 / Ithaca, NY 14853 |