| @@ 255-263 (lines=9) @@ | ||
| 252 | * |
|
| 253 | * @return int Number of records. |
|
| 254 | */ |
|
| 255 | public function count() { |
|
| 256 | $query = "SELECT count(*) FROM " . $this->dbObject->getTableName(); |
|
| 257 | ||
| 258 | if ($this->conditions != "") { |
|
| 259 | $query .= " WHERE " . $this->conditions; |
|
| 260 | } |
|
| 261 | ||
| 262 | return DBCore::selectSingleValue($query); |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * Selects max value of some field by some predefined condition. |
|
| @@ 270-278 (lines=9) @@ | ||
| 267 | * |
|
| 268 | * @return int Number of records. |
|
| 269 | */ |
|
| 270 | public function max() { |
|
| 271 | $query = "SELECT max(`" . $this->field . "`) FROM " . $this->dbObject->getTableName(); |
|
| 272 | ||
| 273 | if ($this->conditions != "") { |
|
| 274 | $query .= " WHERE " . $this->conditions; |
|
| 275 | } |
|
| 276 | ||
| 277 | return DBCore::selectSingleValue($query); |
|
| 278 | } |
|
| 279 | ||
| 280 | /** |
|
| 281 | * Selects min value of some field by some predefined condition. |
|
| @@ 285-293 (lines=9) @@ | ||
| 282 | * |
|
| 283 | * @return int Number of records. |
|
| 284 | */ |
|
| 285 | public function min() { |
|
| 286 | $query = "SELECT min(`" . $this->field . "`) FROM " . $this->dbObject->getTableName(); |
|
| 287 | ||
| 288 | if ($this->conditions != "") { |
|
| 289 | $query .= " WHERE " . $this->conditions; |
|
| 290 | } |
|
| 291 | ||
| 292 | return DBCore::selectSingleValue($query); |
|
| 293 | } |
|
| 294 | ||
| 295 | /** |
|
| 296 | * Returns SQL ORDER string for current selector. |
|