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

Diff of /contributions/modules/stock/stock.install

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

revision 1.2, Wed May 9 23:37:51 2007 UTC revision 1.3, Mon Sep 22 03:58:45 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: stock.install,v 1.1.4.1 2007/02/05 15:30:54 oadaeh Exp $  // $Id: stock.install,v 1.1.4.3 2008/03/18 22:58:39 kbahey Exp $
3    
4  /**  /**
5   * Implementation of hook_install()   * Implementation of hook_install()
6   *   *
7   * This will automatically install the MySQL database tables for Stock module.   * This will automatically install the MySQL & PostgreSQL database tables for Stock module.
  *  
  * Todo: Create pgsql query.  
8   *   *
9   */   */
10    function stock_schema() {
11      $schema['stock'] = array(
12      'description' => t('This is the default table for stock'),
13      'fields' => array(
14        'uid' => array(
15          'description' => t('the user id'),
16          'type' => 'int',
17          'not null' => 'TRUE',
18          'default' => '0'),
19        'symbols' => array(
20          'description' => t('the stock symbol'),
21          'type' => 'varchar',
22          'length' => 255,
23          'not null' => TRUE,
24          'default' => ''),
25        ),
26        'primary key' => array('uid'),
27        );
28      return $schema;
29    }
30  function stock_install() {  function stock_install() {
31    switch ($GLOBALS['db_type']) {    drupal_install_schema('stock');
     case 'mysqli':  
     case 'mysql':  
       $query = db_query(  
         "CREATE TABLE {stock} (  
         uid         INT(10)      NOT NULL DEFAULT '0',  
         symbols     VARCHAR(255) NOT NULL DEFAULT '',  
         PRIMARY KEY  (uid)  
         ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");  
       break;  
   
     case 'pgsql':  
       break;  
   }  
32  }  }
33    
34    
35  /**  /**
36   * Implementation of hook_uninstall()   * Implementation of hook_uninstall()
37   *   *
38   * This will automatically remove the MySQL database tables for Stock module.   * This will automatically remove the MySQL & PostgreSQL database tables for Stock module.
39   *   *
  * Todo: Create pgsql query.  
40   */   */
41  function stock_uninstall() {  function stock_uninstall() {
42    switch ($GLOBALS['db_type']) {    drupal_uninstall_schema('stock');
     case 'mysqli':  
     case 'mysql':  
       db_query('DROP TABLE {stock}');  
       variable_del('stock_block_title');  
       variable_del('stock_description');  
       variable_del('stock_overview_title');  
       break;  
   
     case 'pgsql':  
       break;  
   }  
43  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2