Author: spadkins
Date: Tue Feb 9 07:58:14 2010
New Revision: 13818
Modified:
p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm
Log:
explain_sql now works for App::Repository::Oracle
Modified: p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm Tue Feb 9
07:58:14 2010
@@ -712,14 +712,23 @@
my ($rows, $posskeys, $key, $keylen);
eval {
$dbh->do("explain plan for $sql");
- $rows = $dbh->selectall_arrayref("select * from table
(dbms_xplan.display)");
+ $rows = $dbh->selectall_arrayref("select * from
table(dbms_xplan.display)");
};
- print $App::DEBUG_FILE "EXPLAIN_SQL: $DBI::errstr\n";
- if ($rows && $#$rows == 0) {
- print $App::DEBUG_FILE $rows->[0][0];
+ if ($@) {
+ print $App::DEBUG_FILE "EXPLAIN_SQL: ERROR: (make sure that
the dbms_xplan package is installed)\n";
+ print $App::DEBUG_FILE "EXPLAIN_SQL: ", $@;
}
else {
- print $App::DEBUG_FILE "EXPLAIN_SQL: Got unexpected result.\n";
+ print $App::DEBUG_FILE "EXPLAIN_SQL: $DBI::errstr\n";
+ if ($rows) {
+ foreach my $row (@$rows) {
+ print $App::DEBUG_FILE @$row, "\n";
+ }
+ print $App::DEBUG_FILE "\n";
+ }
+ else {
+ print $App::DEBUG_FILE "EXPLAIN_SQL: Got unexpected
result. No rows returned.\n";
+ }
}
}
else {