@@ 349-359 (lines=11) @@ | ||
346 | * |
|
347 | * @return int |
|
348 | */ |
|
349 | public static function _count($conditions = [], $debug = false) { |
|
350 | $dbQuery = (new DBPreparedQuery())->prepare( |
|
351 | "SELECT COUNT(*) as 'val' FROM " . static::TABLE_NAME, |
|
352 | $conditions |
|
353 | ); |
|
354 | ||
355 | if (!$debug) { |
|
356 | return (int)DBCore::selectSingleValue($dbQuery); |
|
357 | } |
|
358 | $dbQuery->debug(); |
|
359 | } |
|
360 | ||
361 | /** |
|
362 | * Returns result of the MAX($field) SQL query. |
|
@@ 370-380 (lines=11) @@ | ||
367 | * |
|
368 | * @return int |
|
369 | */ |
|
370 | public static function _max($field, $conditions = [], $debug = false) { |
|
371 | $dbQuery = (new DBPreparedQuery())->prepare( |
|
372 | "SELECT MAX(`" . $field . "`) as 'val' FROM " . static::TABLE_NAME, |
|
373 | $conditions |
|
374 | ); |
|
375 | ||
376 | if (!$debug) { |
|
377 | return DBCore::selectSingleValue($dbQuery); |
|
378 | } |
|
379 | $dbQuery->debug(); |
|
380 | } |
|
381 | ||
382 | /** |
|
383 | * Returns result of the MIN($field) SQL query. |
|
@@ 391-401 (lines=11) @@ | ||
388 | * |
|
389 | * @return int |
|
390 | */ |
|
391 | public static function _min($field, $conditions = [], $debug = false) { |
|
392 | $dbQuery = (new DBPreparedQuery())->prepare( |
|
393 | "SELECT MIN(`" . $field . "`) as 'val' FROM " . static::TABLE_NAME, |
|
394 | $conditions |
|
395 | ); |
|
396 | ||
397 | if (!$debug) { |
|
398 | return DBCore::selectSingleValue($dbQuery); |
|
399 | } |
|
400 | $dbQuery->debug(); |
|
401 | } |
|
402 | ||
403 | /** |
|
404 | * Prepare DBObject for the UPDATE SQL query. |