public void Truncate(Pid id) { if (Cache != null) { PgHdr p; PgHdr next; for (p = Dirty; p != null; p = next) { next = p.DirtyNext; // This routine never gets call with a positive pgno except right after sqlite3PcacheCleanAll(). So if there are dirty pages, it must be that pgno==0. Debug.Assert(p.ID > 0); if (C._ALWAYS(p.ID > id)) { Debug.Assert((p.Flags & PgHdr.PGHDR.DIRTY) != 0); MakeClean(p); } } if (id == 0 && Page1 != null) { Page1.memsetData(SizePage); id = 1; } Cache.Truncate(id + 1); } }