Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | } |
47 | 47 | |
48 | 48 | function getSpecializedWhereClause( $dbr ) { |
49 | | - return ' AND cr_author = ' . $dbr->addQuotes( $this->mAuthor ); |
| 49 | + return array( 'cr_author' => $this->mAuthor ); |
50 | 50 | } |
51 | 51 | |
52 | 52 | } |
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php |
— | — | @@ -161,28 +161,27 @@ |
162 | 162 | } |
163 | 163 | |
164 | 164 | function getRevCountQuery( $dbr ) { |
165 | | - $tables = array( $dbr->tableName( 'code_rev' ) ); |
166 | | - $selectFields = array( 'COUNT( cr_id ) AS rev_count' ); |
| 165 | + $tables = array( $dbr->tableName( 'code_rev' ) ); |
| 166 | + $selectFields = array( 'COUNT( DISTINCT cr_id ) AS rev_count' ); |
167 | 167 | // count if code_rev where path matches |
168 | 168 | if ( $this->mPath ) { |
169 | | - $whereCond = 'cr_id IN' . |
170 | | - ' ( SELECT cp_rev_id FROM '. $dbr->tableName( 'code_paths' ) . ' WHERE' . |
171 | | - ' cp_repo_id = ' . $this->mRepo->getId(). ' AND' . |
172 | | - ' cp_path LIKE ' . $dbr->addQuotes( $this->mPath . '%' ) . ' AND' . |
173 | | - // performance |
174 | | - ' cp_rev_id > ' . ( $this->mRepo->getLastStoredRev() - 20000 ) . |
175 | | - $this->getSpecializedWhereClause( $dbr ) . |
176 | | - ' )'; |
| 169 | + $tables[] = $dbr->tableName( 'code_paths' ); |
| 170 | + $whereCond = array('cr_repo_id' => $this->mRepo->getId(), |
| 171 | + 'cr_id = cp_rev_id', |
| 172 | + ' cp_path LIKE ' . $dbr->addQuotes( $this->mPath . '%' ), |
| 173 | + // performance |
| 174 | + ' cp_rev_id > ' . ( $this->mRepo->getLastStoredRev() - 20000 ) |
| 175 | + ); |
177 | 176 | // No path; count of code_rev |
178 | 177 | } else { |
179 | | - $whereCond = 'cr_repo_id = ' . $this->mRepo->getId() . |
180 | | - $this->getSpecializedWhereClause( $dbr ); |
| 178 | + $whereCond = array('cr_repo_id' => $this->mRepo->getId()); |
181 | 179 | } |
182 | | - return $dbr->selectRow ($tables, $selectFields, $whereCond); |
| 180 | + $whereCond += $this->getSpecializedWhereClause( $dbr ); |
| 181 | + return $dbr->selectRow( $tables, $selectFields, $whereCond ); |
183 | 182 | } |
184 | 183 | |
185 | 184 | function getSpecializedWhereClause( $dbr ) { |
186 | | - return ''; |
| 185 | + return array(); |
187 | 186 | } |
188 | 187 | |
189 | 188 | } |
Index: trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | } |
13 | 13 | |
14 | 14 | function getSpecializedWhereClause( $dbr ) { |
15 | | - return ' AND cr_status = ' . $dbr->addQuotes( $this->mStatus ); |
| 15 | + return array( 'cr_status' => $this->mStatus ); |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |