diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index 0fcf9e8..75b6729 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -689,19 +689,36 @@ class FeedsSource extends FeedsConfigurable { * - message: If set, time and method should be ignored. */ public function getNextImportTimeDetails() { - // Check queue. - $queue_created = db_select('queue') - ->fields('queue', array('created')) - ->condition('name', 'feeds_source_import') - ->condition('data', 's:4:"type";s:[0-9]*:"' . db_like($this->id) . '";s:2:"id";(i|s:[0-9]*):"?' . db_like($this->feed_nid) . '"?', 'REGEXP') - ->execute() - ->fetchField(); + // Get database type to determine how to form the regex query. + $db_type = Database::getConnection()->databaseType(); + switch ($db_type) { + case 'pgsql': + $regex_operator = 'SIMILAR TO'; + break; + + default: + $regex_operator = 'REGEXP'; + break; + } - if ($queue_created) { - return array( - 'time' => $queue_created, - 'method' => t('Queue'), - ); + // Check queue. + try { + $queue_created = db_select('queue') + ->fields('queue', array('created')) + ->condition('name', 'feeds_source_import') + ->condition('data', 's:4:"type";s:[0-9]*:"' . db_like($this->id) . '";s:2:"id";(i|s:[0-9]*):"?' . db_like($this->feed_nid) . '"?', $regex_operator) + ->execute() + ->fetchField(); + + if ($queue_created) { + return array( + 'time' => $queue_created, + 'method' => t('Queue'), + ); + } + } + catch (PDOException $e) { + // Database type probably cannot handle regex based conditions. } // Check if the importer is in the process of being rescheduled.