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

version» Context lines:

pike.git/lib/modules/Search.pmod/Queue.pmod/MySQL.pike:1:   inherit .Base;    - Sql.Sql db; +    string url, table;    -  + protected Thread.Local _db = Thread.Local(); + Sql.Sql `db() + { +  // NB: We need to have a thread local connection, +  // since the status functions may get called +  // from some other thread while we're busy +  // performing sql queries elsewhere. +  Sql.Sql ret = _db->get(); +  if (ret && !ret->ping()) return ret; +  return _db->set(Sql.Sql( url )); + } +    Web.Crawler.Stats stats;   Web.Crawler.Policy policy;   Web.Crawler.RuleSet allow, deny;      inherit Web.Crawler.Queue;      static string to_md5(string url)   {    Crypto.MD5 md5 = Crypto.MD5();    md5->update(string_to_utf8(url));
pike.git/lib/modules/Search.pmod/Queue.pmod/MySQL.pike:20:    Web.Crawler.Policy _policy,       string _url, string _table,       void|Web.Crawler.RuleSet _allow,    void|Web.Crawler.RuleSet _deny)   {    stats = _stats; policy = _policy;    allow=_allow; deny=_deny;    table = _table; +  url = _url;    -  db = Sql.Sql( _url ); +     perhaps_create_table( );   }      static void perhaps_create_table( )   {    db->query(   #"    create table IF NOT EXISTS "+table+#" (    uri blob not null,    uri_md5 char(32) not null default '',