Skip to content

Commit 49d66af

Browse files
committed
Merge pull request cakephp#1491 from ravage84/sql_dump
Improved code readability
2 parents 8ccdf62 + 14f876f commit 49d66af

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/Cake/View/Elements/sql_dump.ctp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,27 @@ if ($noLogs || isset($_forced_from_dbo_)):
5858
}
5959
foreach ($i['params'] as $bindKey => $bindVal) {
6060
if ($bindType === true) {
61-
$bindParam .= h($bindKey) ." => " . h($bindVal) . ", ";
61+
$bindParam .= h($bindKey) . " => " . h($bindVal) . ", ";
6262
} else {
6363
$bindParam .= h($bindVal) . ", ";
6464
}
6565
}
6666
$i['query'] .= " , params[ " . rtrim($bindParam, ', ') . " ]";
6767
}
68-
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";
68+
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',
69+
$k + 1,
70+
h($i['query']),
71+
$i['error'],
72+
$i['affected'],
73+
$i['numRows'],
74+
$i['took'],
75+
"\n"
76+
);
6977
endforeach;
7078
?>
7179
</tbody></table>
7280
<?php
7381
endforeach;
7482
else:
75-
echo '<p>Encountered unexpected $logs cannot generate SQL log</p>';
83+
printf('<p>%s</p>', __d('cake_dev', 'Encountered unexpected %s. Cannot generate SQL log.', '$logs'));
7684
endif;

0 commit comments

Comments
 (0)