*** /home/appa/drupal.d/5.x/geo.d/countries_api/countries_api.install.orig 2009-06-27 20:27:20.000000000 +0100 --- /home/appa/drupal.d/5.x/geo.d/countries_api/countries_api.install 2009-06-29 17:39:09.599875420 +0100 *************** *** 5,11 **** * Implementation of hook_install(). */ function countries_api_install() { ! switch ($GLOBALS['db_type']) { case 'mysqli': case 'mysql': //create countries db --- 5,11 ---- * Implementation of hook_install(). */ function countries_api_install() { ! switch ($GLOBALS['db_type']) { case 'mysqli': case 'mysql': //create countries db *************** *** 17,23 **** numcode smallint(6), PRIMARY KEY (iso2) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); ! break; } //Include country module include for initial data import require_once(dirname(__FILE__) . '/countries_api.module'); --- 17,23 ---- numcode smallint(6), PRIMARY KEY (iso2) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); ! break; } //Include country module include for initial data import require_once(dirname(__FILE__) . '/countries_api.module'); *************** *** 28,34 **** * Implementation of hook_uninstall(). */ function countries_api_uninstall() { ! db_query('DROP TABLE {countries_api_countries}'); } /** --- 28,34 ---- * Implementation of hook_uninstall(). */ function countries_api_uninstall() { ! db_query('DROP TABLE {countries_api_countries}'); } /** *************** *** 36,44 **** */ function countries_api_update_5101() { $ret = array(); //Include country module include for initial data import require_once(dirname(__FILE__) .'/countries_api.module'); - _countries_api_flush(); countries_api_csv_import_countries(); return $ret; ! } \ No newline at end of file --- 36,61 ---- */ function countries_api_update_5101() { $ret = array(); + + switch ($GLOBALS['db_type']) { + case 'mysqli': + case 'mysql': + // Drop table if exists. + db_query("DROP TABLE IF EXISTS {countries_api_countries}"); + // Create countries DB table. + $ret[] = update_sql("CREATE TABLE {countries_api_countries} ( + iso2 char(2) NOT NULL DEFAULT '', + iso3 char(3) NOT NULL, + name varchar(80) NOT NULL, + printable_name varchar(80) NOT NULL, + numcode smallint(6), + PRIMARY KEY (iso2) + ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); + break; + } //Include country module include for initial data import require_once(dirname(__FILE__) .'/countries_api.module'); countries_api_csv_import_countries(); return $ret; ! } !