You are here

function _salesforce_insert in Salesforce Suite 5

used for inserting a single column into the salesforce_users table

3 calls to _salesforce_insert()
salesforce_account_select in includes/salesforce_api.inc
select from the salesforce contact table
salesforce_contact in includes/salesforce_api.inc
handle contacts in salesforce
salesforce_lead in includes/salesforce_api.inc
handle leads in salesforce

File

./salesforce.module, line 520
Original Creator, Maintainer & Developer: Steve McKenzie (http://drupal.org/user/45890) Drupal and Salesforce.com (mainly only working with contacts / leads but can be extended to do anything the salesforce API version 6 can do) Current…

Code

function _salesforce_insert($col, $value, $account = NULL) {
  $account = _salesforce_select_account($account);
  if (db_num_rows(db_query("SELECT * FROM {salesforce_users} WHERE uid = %d", $account->uid)) > 0) {
    $result = db_query("UPDATE {salesforce_users} SET %s = '%s' WHERE uid = %d", $col, $value, $account->uid);
  }
  else {
    $result = db_query("INSERT INTO {salesforce_users} (uid, %s) VALUES (%d, '%s')", $col, $account->uid, $value);
  }
  if (db_affected_rows() > 0) {
    return true;
  }
  else {
    return false;
  }
}