You are here

function drush_salesforce_sf_execute_query in Salesforce Suite 7.3

Same name and namespace in other branches
  1. 8.4 salesforce.drush.inc \drush_salesforce_sf_execute_query()
  2. 8.3 salesforce.drush.inc \drush_salesforce_sf_execute_query()
  3. 5.0.x salesforce.drush.inc \drush_salesforce_sf_execute_query()

Execute a SOQL query.

Parameters

$query: The query to execute

File

./salesforce.drush.inc, line 354
Drush integration for Salesforce.

Code

function drush_salesforce_sf_execute_query($query = NULL) {
  if (!$query) {
    return drush_log('Please specify a query as an argument.', 'error');
  }
  $salesforce = _drush_salesforce_drush_get_api();
  try {
    $result = $salesforce
      ->apiCall('query?q=' . urlencode($query));
    drush_print(drush_format($result));
  } catch (SalesforceException $e) {
    drush_log($e
      ->getMessage(), 'error');
  }
}