| @@ 358-368 (lines=11) @@ | ||
| 355 | * |
|
| 356 | * @return int |
|
| 357 | */ |
|
| 358 | public static function _count($conditions = [], $debug = false) { |
|
| 359 | $dbQuery = (new DBPreparedQuery())->prepare( |
|
| 360 | "SELECT COUNT(*) as 'val' FROM " . static::TABLE_NAME, |
|
| 361 | $conditions |
|
| 362 | ); |
|
| 363 | ||
| 364 | if (!$debug) { |
|
| 365 | return (int)DBCore::selectSingleValue($dbQuery); |
|
| 366 | } |
|
| 367 | $dbQuery->debug(); |
|
| 368 | } |
|
| 369 | ||
| 370 | /** |
|
| 371 | * Returns result of the MAX($field) SQL query. |
|
| @@ 379-389 (lines=11) @@ | ||
| 376 | * |
|
| 377 | * @return int |
|
| 378 | */ |
|
| 379 | public static function _max($field, $conditions = [], $debug = false) { |
|
| 380 | $dbQuery = (new DBPreparedQuery())->prepare( |
|
| 381 | "SELECT MAX(`" . $field . "`) as 'val' FROM " . static::TABLE_NAME, |
|
| 382 | $conditions |
|
| 383 | ); |
|
| 384 | ||
| 385 | if (!$debug) { |
|
| 386 | return DBCore::selectSingleValue($dbQuery); |
|
| 387 | } |
|
| 388 | $dbQuery->debug(); |
|
| 389 | } |
|
| 390 | ||
| 391 | /** |
|
| 392 | * Returns result of the MIN($field) SQL query. |
|
| @@ 400-410 (lines=11) @@ | ||
| 397 | * |
|
| 398 | * @return int |
|
| 399 | */ |
|
| 400 | public static function _min($field, $conditions = [], $debug = false) { |
|
| 401 | $dbQuery = (new DBPreparedQuery())->prepare( |
|
| 402 | "SELECT MIN(`" . $field . "`) as 'val' FROM " . static::TABLE_NAME, |
|
| 403 | $conditions |
|
| 404 | ); |
|
| 405 | ||
| 406 | if (!$debug) { |
|
| 407 | return DBCore::selectSingleValue($dbQuery); |
|
| 408 | } |
|
| 409 | $dbQuery->debug(); |
|
| 410 | } |
|
| 411 | ||
| 412 | /** |
|
| 413 | * Prepare DBObject for the UPDATE SQL query. |
|