condition('entity_type', $entity_type) ->execute(); $query=db_select('node', 'n'); $query->addField('n','nid', 'entity_id'); $query->addField('n','type', 'bundle'); $query->addField('n','changed', 'changed'); db_insert('oai') ->fields(array( 'entity_id', 'bundle', 'changed')) ->from($query) ->execute(); } catch (Exception $e) { $transaction->rollback(); // Re-throw the exception so we are aware of the failure. throw $e; } } function oai_uninstall() { variable_del('oai_configurations'); } /** * Implementation of hook_schema */ function oai_schema(){ $schema['oai'] = array( 'description' => 'Stores a record of when an entity changed to determine if it needs export for OAI store.', 'fields' => array( 'entity_type' => array( 'description' => 'The type of entity.', 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => 'node', ), 'entity_id' => array( 'description' => 'The primary identifier for an entity.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'bundle' => array( 'description' => 'The bundle to which this entity belongs.', 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, ), 'status' => array( 'description' => 'Boolean indicating whether the entity should be in the OAI store.', 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'changed' => array( 'description' => 'The Unix timestamp when an entity was changed.', 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'dc_path' => array( 'description' => 'path of xml file for "dc" profile', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'pse_path' => array( 'description' => 'path of xml file for "pse" profile', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), ), 'indexes' => array( 'bundle_changed' => array('bundle', 'changed'), ), 'primary key' => array('entity_id'), ); return $schema; }