[ic] Redundant code in DBI.pm?

Peter peter at pajamian.dhs.org
Fri Mar 13 13:33:15 UTC 2015


On 03/14/2015 01:58 AM, Mike Heins wrote:
>>>>   for (my $i = 0;  $i < @$columns;  $i++) {
>>>>       $cols[$i] = $$columns[$i];
>>>> #::logDebug("checking column '$cols[$i]'");
>>>>               if(defined $key) {
>>>>                       $keycol = $i if $cols[$i] eq $key;
>>>>               }
>>>>               if(defined $config->{COLUMN_DEF}->{$cols[$i]}) {
>>>>                       $cols[$i] .= " " .
>>>> $config->{COLUMN_DEF}->{$cols[$i]};
>>>>               }
>>>>               else {
>>>>                       $cols[$i] .= " $def_type";
>>>>               }
>>>>               $$columns[$i] = $cols[$i];
>>>>               $$columns[$i] =~ s/\s+.*//;
>>>>   }
>>
>> The reason is that at you can define the type in the column
>> label of the table, i.e.
>>
>> code	price decimal(12)	description varchar(200)	image

Oh, I see, it looks like the first of those two lines is still
redundant, though.  I think if we were to remove the $$columns[$i] =
$cols[$i] line and leave the next one in then the code would still work,
the column type could be defined in the column and just the name would
be left in @$columns.

> Just tested that out of curiosity:

Just to satisfy my own curiosity, can you comment out the $$columns[$i]
= $cols[$i]; line and see if your test still works?


Peter



More information about the interchange-users mailing list