You are here

mobile_tools.install in Mobile Tools 5

Install file for mobile_tools module

File

mobile_tools.install
View source
<?php

/**
 * @file
 * Install file for mobile_tools module
 */

/**
 * Implementation of hook_install()
 */
function mobile_tools_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {mobile_tools_roles_relations} (\n        rid INT(9) NOT NULL,\n        mrid INT(9) NOT NULL\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {mobile_tools_roles_relations} (\n        rid integer NOT NULL,\n        mrid integer NOT NULL\n      )");
      break;
  }
}

/**
 * Implementation of hook_uninstall()
 */
function mobile_tools_uninstall() {
  $query = "SELECT * FROM {mobile_tools_roles_relations}";
  $result = db_query($query);
  while ($item = db_fetch_object($result)) {
    db_query("DELETE FROM {role} WHERE rid = %d", $item->mrid);
  }
  db_query("DROP TABLE {mobile_tools_roles_relations}");
}

Functions

Namesort descending Description
mobile_tools_install Implementation of hook_install()
mobile_tools_uninstall Implementation of hook_uninstall()