From 98ad480bf2408530a845d1985a32348c626618b2 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 21 Aug 2009 22:33:33 -0400 Subject: [PATCH] Fixing error string passing in SchemaShell::__run() Fixes #45 --- cake/console/libs/schema.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cake/console/libs/schema.php b/cake/console/libs/schema.php index 62ceded538c..4375a662611 100644 --- a/cake/console/libs/schema.php +++ b/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)); } }