function sf_prematch_update_1 in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 sf_prematch/sf_prematch.install \sf_prematch_update_1()
See also
salesforce_api_update_1
File
- sf_prematch/
sf_prematch.install, line 77 - Installs tables needed for sf_prematch module.
Code
function sf_prematch_update_1() {
$ret = array();
if (!db_field_exists('salesforce_field_map', 'name')) {
$ret[] = array(
'success' => FALSE,
'query' => 'N/A',
);
drupal_set_message(t('There are still updates to be run: Update for sf_prematch was not run. Please run update.php again to complete this update.'), 'warning');
}
db_add_column($ret, 'salesforce_prematch', 'name', 'varchar(255)');
$result = db_query('SELECT fieldmap, name FROM {salesforce_field_map}');
while ($row = db_fetch_array($result)) {
$sql = 'UPDATE {salesforce_prematch} SET name = "%s" WHERE fieldmap = %d';
// TODO Please review the conversion of this statement to the D7 database API syntax.
/* db_query($sql, $name, $fieldmap) */
$update_result = db_update('salesforce_prematch')
->fields(array(
'name' => $name,
))
->condition('fieldmap', $fieldmap)
->execute();
$ret[] = array(
'success' => $update_result !== FALSE,
'query' => check_plain($sql),
);
}
db_add_primary_key('salesforce_prematch', 'name', array(
'name',
));
// TODO update_sql has been removed. Use the database API for any schema or data changes.
$ret[] = array();
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.');
}