banesong has asked for the wisdom of the Perl Monks concerning the following question:
I have a problem with fetchall_arrayref that is driving me batty. When I am running a query to gather data from a table, the script is freezing right at the _arrayref({}) call in weird ways. This happens with no consistency in regard to the number of values that exist in the data set coming back - it works fine up 400 and more than 2000 in one script, but then in another the script will hang with 70-80 returned items. Nothing happens after the arrayref call - I can put a print statement with no result. Any help? We have had the number of places that this is happening increasing over the past few months, and it is concerning. Code sample below.
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(); my $data; foreach my $hashRef (@$resultsArrayRef) { $data .= "$$hashRef{DP1}' = $$hashRef{DP2};\n"; } print $data;
Update: Forgive me, a sick child drew me away from the computer. When running a trace, I see the statement come up as normal; I don't think that it is freezing but will also be posting on a SQL forum to validate that as well.
WRT to version and other data -
CREATE TABLE dbo.Table1 ( DP1 varchar(32) NULL, DP2 varchar(32) NULL )
Further Update: Almost certain that this is not in the database - I don't see a long running query; the query is not showing running immediately after execution - I think it has been handed back to DBD::ODBC and DBI.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: fetchall_arrayref({}) call freezing
by McA (Priest) on Mar 11, 2014 at 19:11 UTC | |
by Laurent_R (Canon) on Mar 11, 2014 at 22:20 UTC | |
by banesong (Acolyte) on Mar 12, 2014 at 12:52 UTC | |
|
Re: fetchall_arrayref({}) call freezing
by GotToBTru (Prior) on Mar 11, 2014 at 18:01 UTC | |
|
Re: fetchall_arrayref({}) call freezing
by mje (Curate) on Mar 12, 2014 at 13:17 UTC | |
by banesong (Acolyte) on Mar 12, 2014 at 14:07 UTC | |
by banesong (Acolyte) on Mar 13, 2014 at 10:55 UTC | |
by mje (Curate) on Mar 13, 2014 at 12:01 UTC | |
by banesong (Acolyte) on Mar 24, 2014 at 18:53 UTC | |
| |
|
Re: fetchall_arrayref({}) call freezing
by banesong (Acolyte) on Mar 13, 2014 at 10:53 UTC | |
by McA (Priest) on Mar 14, 2014 at 12:18 UTC | |
by banesong (Acolyte) on Mar 24, 2014 at 18:55 UTC |