You are here

function weather_update_5 in Weather 5.6

Same name and namespace in other branches
  1. 6.5 weather.install \weather_update_5()

File

./weather.install, line 360

Code

function weather_update_5() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $sql = "ALTER TABLE {weather_config} CHANGE config settings VARCHAR(255) NOT NULL DEFAULT '%s'";

      // we cannot use update_sql() because of the brackets {} issue
      $result = db_query($sql, 'a:3:{s:22:"show_unconverted_metar";i:0;s:27:"show_abbreviated_directions";i:0;s:22:"show_directions_degree";i:0;}');
      $ret[] = array(
        'success' => $result !== FALSE,
        'query' => check_plain($sql),
      );
      break;
    case 'pgsql':
      $sql = "ALTER TABLE {weather_config} RENAME COLUMN config TO settings";
      $ret[] = update_sql($sql);
      $sql = "ALTER TABLE {weather_config} ALTER settings SET DEFAULT '%s'";

      // we cannot use update_sql() because of the brackets {} issue
      $result = db_query($sql, 'a:3:{s:22:"show_unconverted_metar";i:0;s:27:"show_abbreviated_directions";i:0;s:22:"show_directions_degree";i:0;}');
      $ret[] = array(
        'success' => $result !== FALSE,
        'query' => check_plain($sql),
      );
      break;
  }
  return $ret;
}