You are here

qpcache.install in QueryPath 6

Same filename and directory in other branches
  1. 7.3 qpcache/qpcache.install
  2. 7.2 qpcache/qpcache.install

The installer file for qpcache.

File

qpcache/qpcache.install
View source
<?php

/**
 * The installer file for qpcache.
 * @file
 */
function qpcache_update_6100() {
  $spec = array(
    'type' => 'int',
    'not null' => TRUE,
    'unsigned' => FALSE,
    'default' => 0,
  );
  $indexes = array(
    //'primary key' => array('cid'),
    'unique keys' => array(
      'hash' => array(
        'crckey',
        'hashkey',
      ),
    ),
  );
  $ret = array();

  // None of these work on MySQL: Illegal to drop primary key index,
  // illegal to drop other indices.

  //db_drop_primary_key($ret, 'qpcache_xmlcache');

  //db_drop_index($ret, 'qpcache_xmlcache', 'by_key');

  //db_drop_index($ret, 'qpcache_xmlcache', 'expire');
  db_change_field($ret, 'qpcache_xmlcache', 'crckey', 'crckey', $spec, $indexes);
  return $ret;
}
function qpcache_update_6101() {
  $spec = array(
    'type' => 'int',
    'size' => 'big',
    'not null' => TRUE,
    'unsigned' => FALSE,
    'default' => 0,
  );
  $ret = array();
  db_change_field($ret, 'qpcache_xmlcache', 'crckey', 'crckey', $spec);
  return $ret;
}

/**
 * Implementation of hook_install().
 */
function qpcache_install() {
  drupal_install_schema('qpcache');
}

/**
 * Implementation of hook_uninstall().
 */
function qpcache_uninstall() {
  drupal_uninstall_schema('qpcache');
}

/**
 * Implementation of hook_schema().
 */
function qpcache_schema() {
  $schema['qpcache_xmlcache'] = array(
    'fields' => array(
      // Cache ID
      'cid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      // CRC32 checksum
      'crckey' => array(
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'unsigned' => FALSE,
        'default' => 0,
      ),
      // Expiration timestamp
      'expire' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      // Hash key
      'hashkey' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      // Cleartext key (for DBAs)
      'clearkey' => array(
        'type' => 'text',
      ),
      // XML content
      'body' => array(
        'type' => 'text',
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    // Collision space for the combination of these two should be miniscule.
    'unique keys' => array(
      'hash' => array(
        'crckey',
        'hashkey',
      ),
    ),
    'indexes' => array(
      // Used for fast seeking
      'by_key' => array(
        'crckey',
        'hashkey',
        'expire',
      ),
      // Used by cache maintanance
      'cacheexpire' => array(
        'expire',
      ),
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
qpcache_install Implementation of hook_install().
qpcache_schema Implementation of hook_schema().
qpcache_uninstall Implementation of hook_uninstall().
qpcache_update_6100 The installer file for qpcache. @file
qpcache_update_6101