I'm receiving the following type of error message whenever I try to do anything with this module:

Table '[drupal_db].civicrm_contact' doesn't exist query: SELECT COUNT(*) FROM civicrm_contact in [root]/html/sites/all/modules/cd_sunlight/cd_civicrm/cd_civicrm.module on line 641.

It seems when the module executes db_query, it's running against the drupal db instead of the civi db. I've tried changing the active db, but of course that just creates a cascade of problems.

Have I got this thing set up wrong or is this a bug in the system?

Comments

dalin’s picture

Status: Active » Postponed (maintainer needs more info)

Are you trying to upgrade from 6.x-1.x? If so note that the way that we now use table prefixes rather than separate db connections. Please review README.txt and admin/reports/status for all the details.

christok’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

Thanks for the response. We recently upgraded from 6.2.x, although I never actually got it working (not sure if this is related; quite possibly is).

At any rate, I completely uninstalled the module by deleting the files, tables, variables, and flushing the cache. When I reinstalled - following directions in both readmes - I got the same behavior.

I managed to work around the problem by adding the following function to cd_sunlight.module (civi_query), then replacing instances of db_query with civi_query:

function civi_query($querystring) {
db_set_active('civicrm');
$result=db_query($querystring);
db_set_active('default');
return $result;
}

One interesting aside to this regarding table prefixes... when I set the table prefixes in settings.php to "civicrm_", the module kept trying to query tables with the prefix "civicrm_civicrm_". I had to go back and change the settings prefixes to "". Strange, eh?

dalin’s picture

When you setup the table prefixes did you follow the installation instructions and use what CiviCRM outputs at
civicrm/admin/setting/uf
?

Are you sharing a database between CiviCRM and Drupal? If so then your prefix would be ''. If your CiviCRM DB is called 'civicrm' then the prefix is 'civicrm.'.

dalin’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Status: Postponed (maintainer needs more info) » Closed (works as designed)