From 1fbb8b6c082e9826a8610a43ab3279a872b6899b Mon Sep 17 00:00:00 2001 From: gnat Date: Tue, 20 Mar 2007 23:22:51 +0000 Subject: [PATCH] unitialized or typo variables --- lib/Doctrine/Connection/Db2.php | 8 ++++---- lib/Doctrine/Export/Mysql.php | 2 +- lib/Doctrine/Query.php | 10 +++++----- lib/Doctrine/RawSql.php | 5 +---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/Doctrine/Connection/Db2.php b/lib/Doctrine/Connection/Db2.php index 45e7b9178..33d27a7be 100644 --- a/lib/Doctrine/Connection/Db2.php +++ b/lib/Doctrine/Connection/Db2.php @@ -43,12 +43,12 @@ class Doctrine_Connection_Db2 extends Doctrine_Connection public function modifyLimitQuery($query, $limit, $offset) { if ($limit <= 0) - return $sql; + return $query; if ($offset == 0) { - return $sql . ' FETCH FIRST '. $count .' ROWS ONLY'; + return $query . ' FETCH FIRST '. $limit .' ROWS ONLY'; } else { - $sqlPieces = explode('from', $sql); + $sqlPieces = explode('from', $query); $select = $sqlPieces[0]; $table = $sqlPieces[1]; @@ -57,7 +57,7 @@ class Doctrine_Connection_Db2 extends Doctrine_Connection $sql = 'WITH OFFSET AS(' . $select . ', ROW_NUMBER() ' . 'OVER(ORDER BY ' . $col[1] . ') AS dctrn_rownum FROM ' . $table . ')' . $select . 'FROM OFFSET WHERE dctrn_rownum BETWEEN ' . $offset . - 'AND ' . ($offset + $count - 1); + 'AND ' . ($offset + $limit - 1); return $sql; } } diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index ed374bc43..eabf3b97c 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -303,7 +303,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export } else { $oldFieldName = $fieldName; } - $oldFieldName = $this->conn->quoteIdentifier($old_field_name, true); + $oldFieldName = $this->conn->quoteIdentifier($oldFieldName, true); $query .= "CHANGE $oldFieldName " . $this->getDeclaration($field['definition']['type'], $fieldName, $field['definition']); } } diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index 0fb25fdfc..a1707fb21 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -135,7 +135,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { $tableAlias = $this->getTableAlias($componentAlias); if ( ! isset($this->tables[$tableAlias])) - throw new Doctrine_Query_Exception('Unknown component path '.$componentPath); + throw new Doctrine_Query_Exception('Unknown component path '.$componentAlias); $table = $this->tables[$tableAlias]; @@ -247,7 +247,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { $tableAlias = $this->getTableAlias($componentAlias); if ( ! isset($this->tables[$tableAlias])) { - throw new Doctrine_Query_Exception('Unknown component path ' . $componentPath); + throw new Doctrine_Query_Exception('Unknown component path ' . $componentAlias); } $root = current($this->tables); @@ -491,7 +491,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { { $class = 'Doctrine_Query_Having'; $parser = new $class($this); - $this->parts['having'][] = $parser->parse($orderby); + $this->parts['having'][] = $parser->parse($having); return $this; } @@ -1216,7 +1216,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { } else { if ( ! (substr_count($term[$i], "'") & 1) && ! (substr_count($term[$i], "\"") & 1) && - ! (substr_count($term[$i], "´") & 1) + ! (substr_count($term[$i], "�") & 1) ) { $i++; } } } else { @@ -1231,7 +1231,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { } else { if ( ! (substr_count($term[$i], "'") & 1) && ! (substr_count($term[$i], "\"") & 1) && - ! (substr_count($term[$i], "´") & 1) + ! (substr_count($term[$i], "�") & 1) ) { $i++; } } } diff --git a/lib/Doctrine/RawSql.php b/lib/Doctrine/RawSql.php index 59eca7b13..4a5eb6d2e 100644 --- a/lib/Doctrine/RawSql.php +++ b/lib/Doctrine/RawSql.php @@ -227,11 +227,8 @@ class Doctrine_RawSql extends Doctrine_Hydrate if ($table) { $tableName = $table->getAliasName($component); - - $table = $this->conn->getTable($tableName); - } else { - $table = $this->conn->getTable($component); } + $table = $this->conn->getTable($component); $this->tables[$alias] = $table; $this->fetchModes[$alias] = Doctrine::FETCH_IMMEDIATE; $this->tableAliases[$currPath] = $alias;