pike.git / lib / modules / Search.pmod / Queue.pmod / MySQL.pike

version» Context lines:

pike.git/lib/modules/Search.pmod/Queue.pmod/MySQL.pike:217:    if (stage)    uris = db->query( "select * from "+table+" where stage=%d", stage );    else    uris = db->query( "select * from "+table );    uris = map(uris->uri, utf8_to_string);    uris = map(uris, Standards.URI);       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))    {    foreach(uri, string|object _uri)    put(_uri);    return;    }    if(!objectp(uri))    uri=Standards.URI(uri);
pike.git/lib/modules/Search.pmod/Queue.pmod/MySQL.pike:292:   }      int get_stage( Standards.URI uri )   {    array a = db->query( "select stage from "+table+" where uri_md5=%s", to_md5((string)uri));    if(sizeof(a))    return (int)a[0]->stage;    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"); +  } + }