You are here

function _drd_server_count in Drupal Remote Dashboard Server 7.2

Same name and namespace in other branches
  1. 6.2 drd_server.module \_drd_server_count()

Callback to count the number of records in a given database table.

Parameters

string $table: The name of the database table from which the number of records should be counted.

string $primary: The name of the primary keys in that database table.

Return value

int The number of records being available.

1 call to _drd_server_count()
drd_server_heartbeat in ./drd_server.module
Callback to retrieve lots of current runtime data form the domain.

File

./drd_server.module, line 1203
Provides XMLRPC implementation to respond to requests from DRD.

Code

function _drd_server_count($table, $primary) {
  if (db_table_exists($table)) {
    $query = db_select($table);
    $query
      ->addExpression('COUNT(' . $primary . ')', 'count');
    return $query
      ->execute()
      ->fetchField();
  }
  return 0;
}