X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=localdb.cc;h=077c927e524041a4010e33fc58f09aa219318582;hb=38ae53bac981d564d9f04c038a88d727289db5c8;hp=1c44fa4e8e1826aedbca35bc63b0a157d8c2f114;hpb=0546d239071daa82a8b85348a7f66fba10d85aff;p=cumulus.git diff --git a/localdb.cc b/localdb.cc index 1c44fa4..077c927 100644 --- a/localdb.cc +++ b/localdb.cc @@ -248,10 +248,12 @@ void LocalDb::StoreObject(const ObjectReference& ref, sqlite3_finalize(stmt); if (age != 0.0) { - stmt = Prepare("update segments set mtime = max(mtime, ?) " + stmt = Prepare("update segments " + "set mtime = coalesce(max(mtime, ?), ?) " "where segmentid = ?"); sqlite3_bind_double(stmt, 1, age); - sqlite3_bind_int64(stmt, 2, SegmentToId(ref.get_segment())); + sqlite3_bind_double(stmt, 2, age); + sqlite3_bind_int64(stmt, 3, SegmentToId(ref.get_segment())); rc = sqlite3_step(stmt); sqlite3_finalize(stmt); }