You are here

function clients_resource_load in Web Service Clients 6

Same name and namespace in other branches
  1. 7.3 clients.module \clients_resource_load()
  2. 7 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_delete_form in ./clients.module
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

... See full list

File

./clients.module, line 627
Clients module - handles keys and service connections and provides an API for clients @author Django Beatty - adub

Code

function clients_resource_load($identifier) {
  if (is_int($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;
}