gmap_taxonomy.install in GMap Module 5
File
gmap_taxonomy.install
View source
<?php
function gmap_taxonomy_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {gmap_taxonomy_term} (\n tid int(10) unsigned NOT NULL default '0',\n marker varchar(32),\n PRIMARY KEY tid(tid)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */");
db_query("CREATE TABLE {gmap_taxonomy_node} (\n nid int(10) unsigned NOT NULL default '0',\n tid int(10) unsigned NOT NULL default '0',\n marker varchar(32),\n PRIMARY KEY nid(nid)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */");
break;
case 'pgsql':
break;
}
}
function gmap_taxonomy_uninstall() {
db_query('DROP TABLE {gmap_taxonomy_node}');
db_query('DROP TABLE {gmap_taxonomy_term}');
}
function gmap_taxonomy_update_5001() {
$ret = array();
return $ret;
}
function gmap_taxonomy_update_5002() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("DROP TABLE {gmap_taxonomy_node}");
$ret[] = update_sql("CREATE TABLE {gmap_taxonomy_node} (\n nid int(10) unsigned NOT NULL default '0',\n tid int(10) unsigned NOT NULL default '0',\n marker varchar(32),\n PRIMARY KEY nid(nid),\n INDEX nid(nid)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */");
$ret[] = update_sql("INSERT INTO {gmap_taxonomy_node} (nid, tid, marker) (SELECT t.nid, t.tid, g.marker FROM {term_node} t INNER JOIN {gmap_taxonomy_term} g ON t.tid = g.tid GROUP BY t.nid ORDER BY NULL)");
break;
case 'pgsql':
break;
}
if (function_exists('views_invalidate_cache')) {
views_invalidate_cache();
}
return $ret;
}