You are here

function clients_resource_load in Web Service Clients 7

Same name and namespace in other branches
  1. 6 clients.module \clients_resource_load()
  2. 7.3 clients.module \clients_resource_load()

Loads a resource

Return value

Array

8 calls to clients_resource_load()
clientsQuery::execute in clients/clients_views/clientsQuery.inc
Execute a call
clients_resources_form in ./clients.module
@todo validate uniqueness of name
clients_resource_view in ./clients.module
@todo hide password until clicked to prevent overshoulder attacks when keys are being checked
clients_views_views_data in clients/clients_views/clients_views.module
client_delete_confirm in ./clients.module
Form builder for confirmation of deletion of a connection or resource.

... See full list

File

./clients.module, line 650
Clients module - handles keys and service connections and provides an API for clients

Code

function clients_resource_load($identifier) {
  if (is_numeric($identifier)) {
    $result = db_query("SELECT * FROM {clients_resources} WHERE {clients_resources}.rid = %d", $identifier);
  }
  elseif (is_string($identifier)) {
    $result = db_query("SELECT * FROM {clients_resources} WHERE {clients_resources}.name = '%s'", $identifier);
  }
  else {

    // @todo watchdog
    drupal_set_message('error');
    return;

    // or FALSE?
  }
  $resource = db_fetch_object($result);

  /**
   * @TODO test resource has loaded successfully, return FALSE if not
   */
  $resource->configuration = unserialize($resource->configuration);
  return $resource;
}