Ejemplo n.º 1
0
 internal static int MarkPage(StorageImpl db, int pageId, int type, int height)
 {
     int nPages = 1;
     Page pg = db.GetGCPage(pageId);
     try
     {
         int i, n = GetItemsCount(pg);
         if (--height != 0)
         {
             if (type == ClassDescriptor.tpString || type == ClassDescriptor.tpArrayOfByte)
             {
                 // page of strings
                 for (i = 0; i <= n; i++)
                 {
                     nPages += MarkPage(db, GetKeyStrOid(pg, i), type, height);
                 }
             }
             else
             {
                 for (i = 0; i <= n; i++)
                 {
                     nPages += MarkPage(db, GetReference(pg, maxItems - i - 1), type, height);
                 }
             }
         }
         else
         {
             if (type == ClassDescriptor.tpString || type == ClassDescriptor.tpArrayOfByte)
             {
                 // page of strings
                 for (i = 0; i < n; i++)
                 {
                     db.MarkOid(GetKeyStrOid(pg, i));
                 }
             }
             else
             {
                 // page of scalars
                 for (i = 0; i < n; i++)
                 {
                     db.MarkOid(GetReference(pg, maxItems - 1 - i));
                 }
             }
         }
     }
     finally
     {
         db.pool.Unfix(pg);
     }
     return nPages;
 }