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

Diff of /contributions/modules/stockapi/stockapi.install

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

revision 1.1.4.2, Wed May 9 23:40:09 2007 UTC revision 1.1.4.3, Tue Mar 18 22:58:39 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: stockapi.install,v 1.1.4.1 2007/02/05 15:25:43 oadaeh Exp $  // $Id: stockapi.install,v 1.1.4.2 2007/05/09 23:40:09 kbahey Exp $
3    
4  /**  /**
5   * Implementation of hook_install()   * Implementation of hook_install()
6   *   *
7   * This will automatically install the MySQL database tables for StockAPI.   * This will automatically install the MySQL & PostgreSQL database tables for StockAPI.
  *  
  * TODO: Create pgsql query.  
8   *   *
9   */   */
10  function stockapi_install() {  function stockapi_install() {
# Line 31  function stockapi_install() { Line 29  function stockapi_install() {
29        break;        break;
30    
31      case 'pgsql':      case 'pgsql':
32         db_query(
33           "CREATE TABLE stockapi (
34           symbol VARCHAR(10) NOT NULL DEFAULT '',
35           name VARCHAR(50) NOT NULL DEFAULT '',
36           current_price FLOAT NOT NULL DEFAULT 0,
37           change_amt FLOAT NOT NULL DEFAULT 0,
38           opening FLOAT NOT NULL DEFAULT 0,
39           high FLOAT NOT NULL DEFAULT 0,
40           low FLOAT NOT NULL DEFAULT 0,
41           volume INTEGER NOT NULL DEFAULT 0,
42           last_date VARCHAR(10) NOT NULL,
43           last_time VARCHAR(8) NOT NULL,
44           updated INTEGER NOT NULL DEFAULT 0)");
45         db_query(
46           "CREATE UNIQUE INDEX stockapi_symbol ON stockapi (symbol)");
47        break;        break;
48    }    }
49  }  }
# Line 38  function stockapi_install() { Line 51  function stockapi_install() {
51  /**  /**
52   * Implementation of hook_uninstall()   * Implementation of hook_uninstall()
53   *   *
54   * This will automatically remove the MySQL database tables for StockAPI.   * This will automatically remove the MySQL & PostgreSQL database tables for StockAPI.
55   *   *
  * TODO: Create pgsql query.  
56   */   */
57  function stockapi_uninstall() {  function stockapi_uninstall() {
58    switch ($GLOBALS['db_type']) {    switch ($GLOBALS['db_type']) {
# Line 53  function stockapi_uninstall() { Line 65  function stockapi_uninstall() {
65        break;        break;
66    
67      case 'pgsql':      case 'pgsql':
68          db_query('DROP TABLE stockapi CASCADE');
69          variable_del('stockapi_fetch_last');
70          variable_del('stockapi_fetch');
71          variable_del('stockapi_rows');
72        break;        break;
73    }    }
74  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.2