You are here

function currency_api_install in Currency 5

Same name and namespace in other branches
  1. 6 currency_api/currency_api.install \currency_api_install()

Implementation of hook_install()

This will automatically install the MySQL database tables for CurrencyAPI.

File

currency_api/currency_api.install, line 9

Code

function currency_api_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("CREATE TABLE {currencyapi} (\n          currency_from varchar(10) NOT NULL default '',\n          currency_to varchar(10) NOT NULL default '',\n          rate float NOT NULL default '0',\n          timestamp int NOT NULL default '0'\n        ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {currencyapi} (\n          currency_from varchar(10) NOT NULL default '',\n          currency_to varchar(10) NOT NULL default '',\n          rate float NOT NULL default '0',\n          timestamp int NOT NULL default '0'\n        );");
      break;
  }
}