karlgoethebier has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
in some older code i found something like this:
do { my @row; while (@row = $sth->fetchrow_array()) { # do stuff here } } while ( defined( $sth->{odbc_more_results}) );
This one throws an "out of memory" exception. I don"t know who wrote it ;-)
According to the manual of DBD::ODBC the code should be:
do { my @row; while (@row = $sth->fetchrow_array()) { # do stuff here } } while ( $sth->{odbc_more_results} );
This one works as expected. No need to worry - i use this code.
But i wonder why the first example fails.
Update: defined for ever?
#!/usr/bin/env perl + use feature qw (say); use strict; use warnings; my $foo; ( defined $foo ) ? say qq(D'oh!) : say qq(No!); $foo = 0; ( defined $foo ) ? say qq(D'oh!) : say qq(No!);
Thank you very much for any hint and best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::ODBC - Why do i get an "out of memory" exception?
by Laurent_R (Canon) on Apr 18, 2014 at 13:17 UTC | |
by karlgoethebier (Abbot) on Apr 18, 2014 at 14:22 UTC | |
|
Re: DBD::ODBC - Why do i get an "out of memory" exception?
by mje (Curate) on Apr 22, 2014 at 17:15 UTC | |
by karlgoethebier (Abbot) on Apr 22, 2014 at 17:47 UTC | |
|
Re: DBD::ODBC - Why do i get an "out of memory" exception?
by locked_user sundialsvc4 (Abbot) on Apr 18, 2014 at 12:57 UTC | |
by karlgoethebier (Abbot) on Apr 18, 2014 at 14:05 UTC |