I encountered this error on import of data from vBulletin Version 3.8.6:
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=258&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a.contenttypeid' in 'where clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {vbImport.attachment} a INNER JOIN {vbImport.attachmenttype} av ON a.extension = av.extension WHERE (a.contenttypeid IS NULL ) ) subquery; Array ( ) in vbimportapi_import() (line 985 of /var/www/html/sites/all/modules/vbtodrupal/vbimportapi.module).
It looks like it is caused by the vbtodrupal_query_vbtodrupal_attachment_alter function in vbtodrupal.module starting at line 434.
If I'm understanding the logic the following line is executed even if the contentid column does not exist:
$query->condition('a.contenttypeid', $contenttypeid);
I moved the line up into the if() and completed my import. Here is my updated version of this function:
/**
* Implements hook_query_TAG_alter().
*/
function vbtodrupal_query_vbtodrupal_attachment_alter(QueryAlterableInterface $query) {
$contenttypeid = &drupal_static(__FUNCTION__);
if (!isset($contenttypeid)) {
if (vbimportapi_import_db_column_exists('contentid', 'attachment')) {
// vB 4 has a concept of content types.
$contenttypeid = db_select('contenttype', 'ct')
->fields('ct', array('contenttypeid'))
->addTag('vbimport')
->condition('class', 'Post')
->execute()
->fetchField();
$query->condition('a.contenttypeid', $contenttypeid);
}
}
}
Comments
Comment #0.0
mattreba commentedAdded detail re: another issue encountered.
Comment #1
liam mcdermott commentedThanks very much for reporting this and providing the fix! I've committed your fix, which for anyone interested, will appear on the project home page shortly.
Comment #2.0
(not verified) commentedUpdated test result as "completed import"