You are here

function uc_quote_update_6 in Ubercart 5

File

shipping/uc_quote/uc_quote.install, line 230

Code

function uc_quote_update_6() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {uc_quote_manufacturer_locations} ADD COLUMN phone varchar(255) NOT NULL");
      $ret[] = update_sql("ALTER TABLE {uc_quote_product_locations} ADD COLUMN phone varchar(255) NOT NULL");
      break;
    case 'pgsql':
      db_add_column($ret, 'uc_quote_manufacturer_locations', 'phone', 'varchar(255)', array(
        'not null' => true,
        'default' => "''",
      ));
      db_add_column($ret, 'uc_quote_product_locations', 'phone', 'varchar(255)', array(
        'not null' => true,
        'default' => "''",
      ));
      break;
  }
  $address = variable_get('uc_quote_store_default_address', new stdClass());
  $result = db_query("UPDATE {uc_quote_manufacturer_locations} SET phone = '%s'", $address->phone);
  $ret[] = array(
    'success' => $result !== FALSE,
    'query' => check_plain("UPDATE {uc_quote_manufacturer_locations} SET phone = '" . $address->phone . "'"),
  );
  $result = db_query("UPDATE {uc_quote_product_locations} SET phone = '%s'", $address->phone);
  $ret[] = array(
    'success' => $result !== FALSE,
    'query' => check_plain("UPDATE {uc_quote_product_locations} SET phone = '" . $address->phone . "'"),
  );
  return $ret;
}