Skip to content
Permalink
Browse files

Improved code readability

Changed table echo to printf for more readable code
Wrapped sql_dump error message in __d(), as discussed here:
4c4fdc6#commitcomment-3155723
and here:
https://github.com/cakephp/cakephp/pull/1491/files#r5646701
  • Loading branch information...
ravage84 committed Aug 7, 2013
1 parent 481d392 commit 14f876fbc92e4abec82fb75d2d488def6ba58b60
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/Cake/View/Elements/sql_dump.ctp
@@ -58,19 +58,27 @@ if ($noLogs || isset($_forced_from_dbo_)):
}
foreach ($i['params'] as $bindKey => $bindVal) {
if ($bindType === true) {
$bindParam .= h($bindKey) ." => " . h($bindVal) . ", ";
$bindParam .= h($bindKey) . " => " . h($bindVal) . ", ";
} else {
$bindParam .= h($bindVal) . ", ";
}
}
$i['query'] .= " , params[ " . rtrim($bindParam, ', ') . " ]";
}
echo "<tr><td>" . ($k + 1) . "</td><td>" . h($i['query']) . "</td><td>{$i['error']}</td><td style = \"text-align: right\">{$i['affected']}</td><td style = \"text-align: right\">{$i['numRows']}</td><td style = \"text-align: right\">{$i['took']}</td></tr>\n";
printf('<tr><td>%d</td><td>%s</td><td>%s</td><td style="text-align: right">%d</td><td style="text-align: right">%d</td><td style="text-align: right">%d</td></tr>%s',
$k + 1,
h($i['query']),
$i['error'],
$i['affected'],
$i['numRows'],
$i['took'],
"\n"
);
endforeach;
?>
</tbody></table>
<?php
endforeach;
else:
echo '<p>Encountered unexpected $logs cannot generate SQL log</p>';
printf('<p>%s</p>', __d('cake_dev', 'Encountered unexpected %s. Cannot generate SQL log.', '$logs'));
endif;

0 comments on commit 14f876f

Please sign in to comment.
You can’t perform that action at this time.