function drush_salesforce_sf_execute_query in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 salesforce.drush.inc \drush_salesforce_sf_execute_query()
- 7.3 salesforce.drush.inc \drush_salesforce_sf_execute_query()
- 5.0.x salesforce.drush.inc \drush_salesforce_sf_execute_query()
Execute a SOQL query.
Parameters
string $query: The query to execute.
File
- ./
salesforce.drush.inc, line 437 - Drush integration for Salesforce.
Code
function drush_salesforce_sf_execute_query($query = NULL) {
_drush_salesforce_deprecated();
if (!$query) {
drush_log('Please specify a query as an argument.', 'error');
return;
}
$salesforce = \Drupal::service('salesforce.client');
try {
$result = $salesforce
->apiCall('query?q=' . urlencode($query));
drush_print(drush_format($result));
} catch (SalesforceException $e) {
drush_log($e
->getMessage(), 'error');
}
}