You are here

function clients_connection_load in Web Service Clients 7

Same name and namespace in other branches
  1. 6.2 clients.module \clients_connection_load()
  2. 6 clients.module \clients_connection_load()
  3. 7.3 clients.module \clients_connection_load()
  4. 7.2 clients.module \clients_connection_load()

Load a client connection.

TODO: there's no need for this to be an object -- change to an array.

Parameters

$connection_info: Either a connection ID or the name of the connection.

22 calls to clients_connection_load()
clients_call in ./clients.module
defines hook_clients_call
clients_connections_list in ./clients.connection.admin.inc
Page callback: list connections.
clients_connection_drupal_services::connectionSettingsForm in backends/clients_drupal/clients_drupal.inc
Form builder for adding or editing connections of this class.
clients_connection_drupal_services::connectionSettingsForm_submit in backends/clients_drupal/clients_drupal.inc
Submit handler for saving/updating connections of this class.
clients_connection_edit in ./clients.connection.admin.inc
Form builder for editing a connection.

... See full list

File

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

Code

function clients_connection_load($connection_info) {
  if (is_numeric($connection_info)) {
    $result = db_query("SELECT * FROM {clients_connections} WHERE {clients_connections}.cid = %d", $connection_info);
  }
  elseif (is_string($connection_info)) {
    $result = db_query("SELECT * FROM {clients_connections} WHERE {clients_connections}.name = '%s'", $connection_info);
  }
  else {

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

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

  //dsm($connection);
  $connection->configuration = unserialize($connection->configuration);

  // invoke hook for contrib modules to process configuration
  // TODO: this has no need to be an invoke all pattern -- instead, call only
  // the function TYPE_clients_connection_load.
  module_invoke_all('clients_connection_load', $connection);

  // TODO: not working!!
  return $connection;
}