Permalink
Browse files

Fixing error string passing in SchemaShell::__run() Fixes #45

  • Loading branch information...
1 parent 3f0f4b9 commit 98ad480bf2408530a845d1985a32348c626618b2 @markstory markstory committed Aug 22, 2009
Showing with 6 additions and 6 deletions.
  1. +6 −6 cake/console/libs/schema.php
@@ -369,8 +369,7 @@ function __run($contents, $event, $Schema) {
Configure::write('debug', 2);
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db->fullDebug = true;
-
- $errors = array();
+
foreach ($contents as $table => $sql) {
if (empty($sql)) {
$this->out(sprintf(__('%s is up to date.', true), $table));
@@ -382,15 +381,16 @@ function __run($contents, $event, $Schema) {
if (!$Schema->before(array($event => $table))) {
return false;
}
- if (!$db->_execute($sql)) {
+ $error = null;
+ if (!$db->execute($sql)) {
$error = $table . ': ' . $db->lastError();
}
- $Schema->after(array($event => $table, 'errors'=> $errors));
+ $Schema->after(array($event => $table, 'errors' => $error));
- if (isset($error)) {
+ if (!empty($error)) {
$this->out($error);
- } elseif ($this->__dry !== true) {
+ } else {
$this->out(sprintf(__('%s updated.', true), $table));
}
}

0 comments on commit 98ad480

Please sign in to comment.