Branch: Tag:

2004-02-05

2004-02-05 15:32:20 by Anders Johansson <anders@roxen.com>

Reverted one {UPDATE,INSERT} ==> REPLACE since it drastically changed the
functionallity (=useless cache).
Also let MySQL calculate atime with UNIX_TIMESTAMP() in all places.

Rev: server/base_server/roxen.pike:1.860

6:   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.859 2004/02/03 12:04:28 anders Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.860 2004/02/05 15:32:20 anders Exp $";      //! @appears roxen   //!
2902:    werror("Replacing entry for %O\n", id );   #endif    QUERY("REPLACE INTO "+name+ -  " (id,size,atime,meta,data) VALUES (%s,%d,%d,%s,%s)", -  id, strlen(data)+strlen(meta_data), time(1), meta_data, data ); +  " (id,size,atime,meta,data) VALUES (%s,%d,UNIX_TIMESTAMP(),%s,%s)", +  id, strlen(data)+strlen(meta_data), meta_data, data );    }       static mapping restore_meta( string id, RequestID rid )
3221:    if( zero_type( uid_cache[ ci ] ) )    {    uid_cache[ci] = user; -  QUERY("REPLACE INTO "+name+" (id,uid,atime) VALUES (%s,%s,%d)", -  ci, user||"", time(1) ); +  if( catch(QUERY( "UPDATE "+name+" SET uid=%s WHERE id=%s", +  user||"", ci )) ) +  QUERY("INSERT INTO "+name+" " +  "(id,uid,atime) VALUES (%s,%s,UNIX_TIMESTAMP())", +  ci, user||""); +     }      #ifndef NO_ARG_CACHE_SB_REPLICATE