in reply to fetchall_arrayref({}) call freezing

Okay, it gets more interesting. Changing the query from:
my $sql = 'SELECT DP1,DP2 FROM Table1'; my $sth = $dbh->prepare($sql); my $rc = $sth->execute || &pl_fatalSQLError($sql,$DBI::errstr); my $resultsArrayRef = $sth->fetchall_arrayref({});# <-- nothing ha +ppens past here $sth->finish();

To:

my $sql = 'SELECT * FROM Table1'; my $sth = $dbh->prepare($sql); my $rc = $sth->execute || &pl_fatalSQLError($sql,$DBI::errstr); my $resultsArrayRef = $sth->fetchall_arrayref({}); $sth->finish();

allows the script to function. Can anyone explain why? I am totally flummoxed. I am running into similar behavior elsewhere (currently troubleshooting to see if it is the same problem), but need to get to the bottom of this while I still have hair to pull out!

Replies are listed 'Best First'.
Re^2: fetchall_arrayref({}) call freezing
by McA (Priest) on Mar 14, 2014 at 12:18 UTC

    Hi,

    in this case I have two guesses:

    • Columns DP1 and DP2 don't exist, so that select * is fetching something different.
    • You have a weird case sensitivity problem, where one part of the stack seems to be not case sensitive and the other part is case sensitive.

    But, by the way: Whe you work with DBI and want to do the error handling on your own, than you have to check every DBI method, e.g. my $sth = $dbh->prepare($sql); should also be checked. On the other handside you can enable exceptions with $dbh->{RaiseError} = 1; which is IMHO much easier and an exception is thrown as soon as something went wrong. Especially in debugging cases I would prefer to set RaiseError.

    McA

      I know that DP1 and DP2 exist, and I have the column name correctly capitolized.

      I will enable raise error and see what happens, thanks.