function similarterms_install in Similar By Terms 5
Implementation of hook_install().
File
- ./
similarterms.install, line 11 - Similar By Terms install file
Code
function similarterms_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$result = db_query("CREATE TABLE {cache_similarterms} (\n cid varchar(255) NOT NULL default '',\n data longblob,\n expire int NOT NULL default '0',\n created int NOT NULL default '0',\n headers text,\n PRIMARY KEY (cid),\n INDEX expire (expire)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
$result2 = db_query("CREATE TABLE IF NOT EXISTS {similarterms_override} (\n nid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n path INT(10) UNSIGNED NOT NULL,\n vid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n KEY (nid),\n KEY (vid)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
$result = db_query("CREATE TABLE {cache_similarterms} (\n cid varchar(255) NOT NULL default '',\n data bytea,\n expire int NOT NULL default '0',\n created int NOT NULL default '0',\n headers text,\n PRIMARY KEY (cid)\n )");
db_query("CREATE INDEX {cache_similarterms}_expire_idx ON {cache_similarterms} (expire)");
$result2 = db_query("CREATE TABLE {similarterms_override} (\n nid int NOT NULL default '0',\n path int NOT NULL,\n vid int NOT NULL default '0'\n )");
db_query("CREATE INDEX {similarterms_override}_nid_idx ON {similarterms_override} (nid)");
db_query("CREATE INDEX {similarterms_override}_vid_idx ON {similarterms_override} (vid)");
break;
}
if (!$result || !$result2) {
drupal_set_message(t('The table similar by terms was not installed properly. Please investigate.', 'error'));
}
}