Ejemplo n.º 1
0
 //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Writer' and 'System.IO.StreamWriter' may cause compilation errors.
 public virtual void ExportXML(System.IO.StreamWriter writer)
 {
     lock (this)
     {
         if (!opened)
         {
             throw new StorageError(StorageError.STORAGE_NOT_OPENED);
         }
         objectCache.Flush();
         int rootOid = header.root[1 - currIndex].rootObject;
         if (rootOid != 0)
         {
             XMLExporter xmlExporter = new XMLExporter(this, writer);
             xmlExporter.ExportDatabase(rootOid);
         }
     }
 }
Ejemplo n.º 2
0
 internal static void ExportPage(StorageImpl db, XMLExporter exporter, int pageId, int type, int height)
 {
     Page pg = db.GetPage(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++)
                 {
                     ExportPage(db, exporter, GetKeyStrOid(pg, i), type, height);
                 }
             }
             else
             {
                 for (i = 0; i <= n; i++)
                 {
                     ExportPage(db, exporter, GetReference(pg, maxItems - i - 1), type, height);
                 }
             }
         }
         else
         {
             if (type == ClassDescriptor.tpString || type == ClassDescriptor.tpArrayOfByte)
             {
                 // page of strings
                 for (i = 0; i < n; i++)
                 {
                     exporter.ExportAssoc(GetKeyStrOid(pg, i), pg.data, BtreePage.firstKeyOffs + BtreePage.GetKeyStrOffs(pg, i), BtreePage.GetKeyStrSize(pg, i), type);
                 }
             }
             else
             {
                 for (i = 0; i < n; i++)
                 {
                     exporter.ExportAssoc(GetReference(pg, maxItems - 1 - i), pg.data, BtreePage.firstKeyOffs + i * ClassDescriptor.Sizeof[type], ClassDescriptor.Sizeof[type], type);
                 }
             }
         }
     }
     finally
     {
         db.pool.Unfix(pg);
     }
 }