You are here

protected function SensorDatabaseAggregator::buildQuery in Monitoring 7

Builds the database query.

Return value

\SelectQuery

5 calls to SensorDatabaseAggregator::buildQuery()
SensorCommerceTurnover::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorCommerceTurnover.php
Builds the database query.
SensorDatabaseAggregator::getQueryResult in lib/Drupal/monitoring/Sensor/Sensors/SensorDatabaseAggregator.php
Executes the query and returns the result.
SensorDblog404::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorDblog404.php
Builds the database query.
SensorImageMissingStyle::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorImageMissingStyle.php
Builds the database query.
SensorUserFailedLogins::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorUserFailedLogins.php
Builds the database query.
4 methods override SensorDatabaseAggregator::buildQuery()
SensorCommerceTurnover::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorCommerceTurnover.php
Builds the database query.
SensorDblog404::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorDblog404.php
Builds the database query.
SensorImageMissingStyle::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorImageMissingStyle.php
Builds the database query.
SensorUserFailedLogins::buildQuery in lib/Drupal/monitoring/Sensor/Sensors/SensorUserFailedLogins.php
Builds the database query.

File

lib/Drupal/monitoring/Sensor/Sensors/SensorDatabaseAggregator.php, line 128
Contains \Drupal\monitoring\Sensor\Sensors\SensorDatabaseAggregator.

Class

SensorDatabaseAggregator
Base for database aggregator sensors.

Namespace

Drupal\monitoring\Sensor\Sensors

Code

protected function buildQuery() {
  $table = $this->info
    ->getSetting('table');
  $query = db_select($table);
  $this
    ->buildQueryAggregate($query);
  if ($conditions = $this->info
    ->getSetting('conditions')) {
    foreach ($conditions as $condition) {
      $query
        ->condition($this
        ->getFieldName($query, $condition), $condition['value'], isset($condition['operator']) ? $condition['operator'] : NULL);
    }
  }
  $time_interval_field = $this->info
    ->getSetting('time_interval_field');
  if (!empty($time_interval_field) && $this->info
    ->getTimeIntervalValue()) {
    $query
      ->where(db_escape_field($time_interval_field) . ' > :timestamp_value', array(
      ':timestamp_value' => REQUEST_TIME - $this->info
        ->getTimeIntervalValue(),
    ));
  }
  return $query;
}