public static function getStoredBytes($pdo_connection, $period_timestamps = array(), $job_name = 'ALL', $client_id = 'ALL') { $statment = ''; $where = array(); $fields = array('SUM(JobBytes) AS stored_bytes'); $tablename = 'Job'; // Defined period $intervals = CDBQuery::get_Timestamp_Interval($period_timestamps); $where[] = '(endtime BETWEEN ' . $intervals['starttime'] . ' AND ' . $intervals['endtime'] . ') '; if ($job_name != 'ALL') { $where[] = "name = '{$job_name}'"; } if ($client_id != 'ALL') { $where[] = "clientid = '{$client_id}'"; } // Building SQL statment $statment = array('table' => $tablename, 'fields' => $fields, 'where' => $where); $statment = CDBQuery::get_Select($statment); // Execute query $result = CDBUtils::runQuery($statment, $pdo_connection); $result = $result->fetch(); return $result['stored_bytes']; }