Subject: | [patch] [enhancement] DBIx::SearchBuilder::Record::_LoadFromSQL return database error message |
If _LoadFromSQL fails to execute the sql query, it currently returns
with: (0, "Couldn't execute query")
This patch (against DBIx::SearchBuilder::Record in 1.56) changes the
return message to include the error message from the database handle. An
example message would be: "Lost connection to MySQL server during query".
Passing this message back to the caller can make debugging problems
easier.
Subject: | Record-errstr.patch |
--- Record.pm.orig 2010-03-03 18:55:31.000000000 -0600
+++ Record.pm 2010-03-03 18:55:58.000000000 -0600
@@ -1208,7 +1208,7 @@
#TODO this only gets the first row. we should check if there are more.
- return ( 0, "Couldn't execute query" ) unless $sth;
+ return ( 0, "Couldn't execute query: ".$self->_Handle->dbh->errstr ) unless $sth;
$self->{'values'} = $sth->fetchrow_hashref;
$self->{'fetched'} = {};