Branch: Tag:

2011-05-25

2011-05-25 13:26:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Search.Queue: Added get_schemes() and reset_stage().

224:    return uris;   }    + array(string) get_schemes() + { +  // FIXME: Consider using SUBSTRING_INDEX(). +  array(string) schemes = +  db->query("SELECT DISTINCT" +  " SUBSTRING(uri, 1, 20) AS scheme" +  " FROM "+table)->scheme; +  schemes = map(schemes, +  lambda(string s) { +  return (s/":")[0]; +  }); +  return uniq(sort(schemes)); + } +    void put(string|array(string)|Standards.URI|array(Standards.URI) uri)   {    if(arrayp(uri))
299:    else    return -1;   } +  + void reset_stage(string|void uri_prefix) + { +  if (uri_prefix) { +  db->query("UPDATE " + table + " SET stage = 0" +  " WHERE SUBSTRING(uri, 1, " + sizeof(uri_prefix) + ") = %s", +  uri_prefix); +  } else { +  db->query("UPDATE " + table + " SET stage = 0"); +  } + }