Author: spadkins
Date: Tue Jun 20 14:07:43 2006
New Revision: 6556
Modified:
p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm
Log:
cleaned up explain_sql
Modified: p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm Tue Jun 20
14:07:43 2006
@@ -400,19 +400,18 @@
}
if ($sql =~ /^select/i) {
my ($rows);
-print $sql;
eval {
$rows = $dbh->selectall_arrayref("explain $sql");
};
print "EXPLAIN_SQL: $DBI::errstr\n";
if ($rows) {
- print
"+----+-------------+-------+-------+-------------------------------------+-------------------+---------+-------------+------+-------+\n";
- print "| id | select_type | table | type | possible_keys
| key | key_len | ref | rows | Extra
|\n";
- print
"+----+-------------+-------+-------+-------------------------------------+-------------------+---------+-------------+------+-------+\n";
+ print
"+----+-------------+-------+-------+---------------------------------------+--------------------+---------+-------------+-------+\n";
+ print "| id | select_type | table | type | possible_keys
| key | key_len | ref | rows |
Extra\n";
+ print
"+----+-------------+-------+-------+---------------------------------------+--------------------+---------+-------------+-------+\n";
foreach my $row (@$rows) {
- printf("|%3s | %-12s| %-6s| %-6s| %-36s| %-18s|%8d |
%-12s|%5d | %-6s|\n", @$row);
+ printf("|%3s | %-12s| %-6s| %-6s| %-38s| %-19s|%8d |
%-12s|%6d | %s\n", @$row);
}
- print
"+----+-------------+-------+-------+-------------------------------------+-------------------+---------+-------------+------+-------+\n";
+ print
"+----+-------------+-------+-------+---------------------------------------+--------------------+---------+-------------+-------+\n";
}
}
else {