You are here

function countries_api_install in Country codes API 5

Same name and namespace in other branches
  1. 6 countries_api.install \countries_api_install()

Implementation of hook_install().

File

./countries_api.install, line 6

Code

function countries_api_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':

      //create countries db
      db_query("CREATE TABLE {countries_api_countries} (\n        iso2 char(2) NOT NULL DEFAULT '',\n        iso3 char(3) NOT NULL,\n        name varchar(80) NOT NULL,\n        printable_name varchar(80) NOT NULL,\n        numcode smallint(6),\n        PRIMARY KEY (iso2)\n      ) /*!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();
}