/[drupal]/contributions/modules/countries_api/countries_api.install
ViewVC logotype

Diff of /contributions/modules/countries_api/countries_api.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.4.3, Sat Jun 27 19:27:20 2009 UTC revision 1.1.4.4, Sat Jul 18 09:26:52 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: countries_api.install,v 1.1.4.2 2009/03/18 04:12:49 ngmaloney Exp $  // $Id: countries_api.install,v 1.1.4.3 2009/06/27 19:27:20 mrfelton Exp $
3    
4  /**  /**
5   * Implementation of hook_install().   * Implementation of hook_install().
6   */   */
7  function countries_api_install() {  function countries_api_install() {
8   switch ($GLOBALS['db_type']) {    switch ($GLOBALS['db_type']) {
9      case 'mysqli':      case 'mysqli':
10      case 'mysql':      case 'mysql':
11        //create countries db        //create countries db
# Line 17  function countries_api_install() { Line 17  function countries_api_install() {
17          numcode smallint(6),          numcode smallint(6),
18          PRIMARY KEY (iso2)          PRIMARY KEY (iso2)
19        ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");        ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
20      break;        break;
21    }    }
22    //Include country module include for initial data import    //Include country module include for initial data import
23    require_once(dirname(__FILE__) . '/countries_api.module');    require_once(dirname(__FILE__) . '/countries_api.module');
# Line 28  function countries_api_install() { Line 28  function countries_api_install() {
28   * Implementation of hook_uninstall().   * Implementation of hook_uninstall().
29   */   */
30  function countries_api_uninstall() {  function countries_api_uninstall() {
31          db_query('DROP TABLE {countries_api_countries}');    db_query('DROP TABLE {countries_api_countries}');
32  }  }
33    
34  /**  /**
# Line 36  function countries_api_uninstall() { Line 36  function countries_api_uninstall() {
36   */   */
37  function countries_api_update_5101() {  function countries_api_update_5101() {
38    $ret = array();    $ret = array();
39    
40      switch ($GLOBALS['db_type']) {
41        case 'mysqli':
42        case 'mysql':
43          // Drop table if exists.
44          db_query("DROP TABLE IF EXISTS {countries_api_countries}");
45          // Create countries DB table.
46          $ret[] = update_sql("CREATE TABLE {countries_api_countries} (
47            iso2 char(2) NOT NULL DEFAULT '',
48            iso3 char(3) NOT NULL,
49            name varchar(80) NOT NULL,
50            printable_name varchar(80) NOT NULL,
51            numcode smallint(6),
52            PRIMARY KEY (iso2)
53          ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
54          break;
55      }
56    //Include country module include for initial data import    //Include country module include for initial data import
57    require_once(dirname(__FILE__) .'/countries_api.module');    require_once(dirname(__FILE__) .'/countries_api.module');
   _countries_api_flush();  
58    countries_api_csv_import_countries();    countries_api_csv_import_countries();
59    return $ret;    return $ret;
60  }  }
61    

Legend:
Removed from v.1.1.4.3  
changed lines
  Added in v.1.1.4.4

  ViewVC Help
Powered by ViewVC 1.1.2