in reply to out of memory!
(Maybe it's just because I've never used odbc stuff -- but it looks like you're telling perl to execute something as code when it comes from a database. I'd be worried about that.)# Retrieve answerset. while($odbc_session->FetchRow()) { # Stores the hash variable. eval $odbc_session->Data(); }
Also, maybe this is just a nit-pick, but I'd change this:
(Of course, it's not clear to me why you're doing this anyway -- maybe you really should be doing something completely different in the first place.)while($odbc_session->FetchRow()) { # Stores the hash variable. my %pmsr = $odbc_session->DataHash(); ## push @pmsr, \%pmsr; # Pushes each value in the DWH_PrfMsr column i +nto the @pmsr. push @pmsr, {%pmsr}; # Pushes an anon.hash-ref copy of %pmsr onto + @pmsr. }
As for nit-picks that have nothing to do with your question, there's probably a lot in the "Datetime" sub that could be done better; e.g. this:
could just be this:my @datetime = ((localtime)[0,1,2,3,4,5]); foreach(@datetime) { if($count == 4) { $_ += 1 } elsif($count == 5) { $_ += 1900 } if(length $_ == 1) { $_ = "0$_"; } $count++; } my($sec,$min,$hour,$day,$month,$year) = @datetime;
But there are probably a lot of other simplifications possible here -- including how this function is being used in the main part of the code (what you have is rather ugly and confusing).my($sec,$min,$hour,$day,$month,$year) = map {sprintf("%02d",$_)} (loca +ltime)[0..5]; $month++; $year += 1900;
BTW, it would be nice if your indentation style were consistent (and more conventional -- cf. perldoc perlstyle).
Oh, and did you notice that you have two different exit statements? And that the line to "Close ODBC session" comes after the first "exit" (hence is never reached)?
|
|---|