Project:Salesforce Suite
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

I just installed Salesforce module 6.x-2.x-dev, with soapclient in correct folder. Running Drupal 6.10, with Profile module, Advanced User module running. As soon as I activate the Salesforce User module I get the following errors:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fields) VALUES ('user', 'Lead', '', 1, 'a:0:{}')' at line 1 query: INSERT INTO salesforce_field_map (drupal, salesforce, action, automatic, fields) VALUES ('user', 'Lead', '', 1, 'a:0:{}') in /.../www/htdocs/includes/common.inc on line 3422.
user warning: Table 'drupal.salesforce_object_map' doesn't exist query: SELECT sfid, fieldmap FROM salesforce_object_map WHERE drupal_type = 'user' AND oid = 1 in /.../www/htdocs/modules/salesforce/salesforce_api/salesforce_api.module on line 553.
That fieldmap does not exist.
user warning: Table 'drupal.salesforce_object_map' doesn't exist query: SELECT sfid, fieldmap FROM salesforce_object_map WHERE drupal_type = 'user' AND oid = 1 in /.../www/htdocs/modules/salesforce/salesforce_api/salesforce_api.module on line 553.
user warning: Table 'drupal.salesforce_field_map' doesn't exist query: SELECT fieldmap, drupal, salesforce FROM salesforce_field_map in /.../www/htdocs/modules/salesforce/salesforce_api/salesforce_api.admin.inc on line 96.
user warning: Table 'drupal.salesforce_object_map' doesn't exist query: SELECT sfid, fieldmap FROM salesforce_object_map WHERE drupal_type = 'user' AND oid = 1 in /.../www/htdocs/modules/salesforce/salesforce_api/salesforce_api.module on line 553.
user warning: Table 'drupal.salesforce_object_map' doesn't exist query: SELECT sfid, fieldmap FROM salesforce_object_map WHERE drupal_type = 'user' AND oid = 1 in /.../www/htdocs/modules/salesforce/salesforce_api/salesforce_api.module on line 553.
user warning: Table 'drupal.salesforce_object_map' doesn't exist query: SELECT sfid, fieldmap FROM salesforce_object_map WHERE drupal_type = 'user' AND oid = 1 in /.../www/htdocs/modules/salesforce/salesforce_api/salesforce_api.module on line 553.

Looking at database, no Salesforce tables are created. Ran Update.php just in case (nothing for Salesforce shows up anywhere),... no change.

-Chris

Comments

#1

I get similar errors:

# user warning: Table 'treepeople_org_renubora.salesforce_field_map' doesn't exist query: INSERT INTO salesforce_field_map (drupal, salesforce, action, automatic, fields) VALUES ('node_profile', 'Contact', '', 1, 'a:0:{}') in /home/dev/common/crsp/branches/6-1/rel/drupal/includes/common.inc on line 3501.
# user warning: Table 'treepeople_org_renubora.salesforce_field_map' doesn't exist query: SELECT fieldmap, drupal, salesforce FROM salesforce_field_map in /home/dev/treepeople.org/treepeople_org/shadow/treepeople_org/branches/renubora/drupal/modules/salesforce/salesforce_api/salesforce_api.admin.inc on line 96.
# user warning: Table 'treepeople_org_renubora.salesforce_object_map' doesn't exist query: SELECT sfid, fieldmap FROM salesforce_object_map WHERE drupal_type = 'user' AND oid = 1 in /home/dev/treepeople.org/treepeople_org/shadow/treepeople_org/branches/renubora/drupal/modules/salesforce/salesforce_api/salesforce_api.module on line 553.
# user warning: Table 'treepeople_org_renubora.salesforce_object_map' doesn't exist query: SELECT sfid, fieldmap FROM salesforce_object_map WHERE drupal_type = 'user' AND oid = 7 in /home/dev/treepeople.org/treepeople_org/shadow/treepeople_org/branches/renubora/drupal/modules/salesforce/salesforce_api/salesforce_api.module on line 553.

-Renu

#2

Hey guys, the latest dev udpates last week added a new (hopefully permanent) database schema, but it only fires on install. We haven't started with hook_update yet, and probably won't until we get to an actual alpha or beta release.

For right now, if you uninstall and reinstall, you'll get your schema.

#3

Status:active» closed (won't fix)

Marking wontfix. Next release we will start managing hook_update for data issues.

#4

Could you explain the "uninstall and reinstall" fix? Salesforce doesn't show up under the "uninstall" tab and just unchecking the boxes and then checking again doesn't seem to trigger the install script... update.php doesn't seem to do it for me either.

thanks

#5

Status:closed (won't fix)» needs work

I think there may be a bigger issue here. I just moved a Drupal DB created on MySQL 5 to a 4.1 host. When I tried to add a new field map on the MySQL 4.1 install, I got a similar error.

Turns out "fields" must be a reserved keyword on 4.1, but not 5. Added the following to salesforce_api_fieldmap_save() and it worked, adding `s around the fields key:
$map ['`fields`'] = $map['fields'];
unset($map['`fields`']);

drupal_write_record('salesforce_field_map', $map, $primary_keys);

#6

Status:needs work» closed (won't fix)

re #4: since this module doesn't offer an uninstall hook,
"uninstall and reinstall" in this case refers to either:
* reinstalling the module on a fresh drupal install
or
* disabling the module, manually removing it from the filesystem, manually removing the tables from the database and the module's entry in the system table, manually replacing the module in the filesystem, and enabling the module

re #5: If backtick escaping a fieldname is really at fault, then this is an issue with the db abstraction layer; the proposed solution feels like a hack. Consider: what happens when the drupal_write_record function is updated to properly backtick-escape its fields?

#7

Yeah, good point, it is a hack. drupal_write_record is where it should be fixed, I just needed to get my site up.

Umm, hate to suggest it, but you could consider renaming that column.

#8

re #5 again:
Turns out "fields" is indeed a reserved word in mysql 4.1. There is some long-standing discussion around this issue as it relates to the db layer:
#371: resolve ANSI SQL-92/99/2003 reserved words conflict in query statements
#266610: Function drupal_write_record() should enclose field names by backticks

I'm reversing my previous position:
given that Drupal 6 supports MySQL 4.1, salesforce module should too by not using a reserved word for a column name.
If such an approach is not desirable, then the project page for this module should explicitly state incompatibility, or at least note the ongoing discussion around an issue with core.

However, this issue is unrelated to the original intent of this ticket.
Please create a new issue.

#9

Ran into the issue mentioned in #5 - #8 and created a new issue here:
#790872: Reserved word conflict with MySQL 4.1 in salesforce_field_map

nobody click here