You are here

function views_calc_update_2 in Views Calc 6.3

Same name and namespace in other branches
  1. 5 views_calc.install \views_calc_update_2()
  2. 6 views_calc.install \views_calc_update_2()

Create a table to store custom views calculation fields.

File

./views_calc.install, line 96

Code

function views_calc_update_2() {
  $ret = array();
  global $db_type;
  switch ($db_type) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE if not exists {views_calc_fields} (\n        cid int(10) unsigned NOT NULL default '0',\n        label varchar(255),\n        format varchar(255),\n        custom varchar(255),\n        tablelist text,\n        fieldlist text,\n        calc text,\n        KEY (cid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    case 'postgres':
      $ret[] = update_sql("CREATE TABLE if not exists {views_calc_fields} (\n        cid int(10) unsigned NOT NULL default '0',\n        label varchar(255),\n        format varchar(255),\n        custom varchar(255),\n        tablelist text,\n        fieldlist text,\n        calc text,\n        KEY (cid)\n      ) ");
      break;
  }
  return $ret;
}