| 65 | 
   | 
   Stream_Body, Stream_Names:          TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | 
   | 
   Stream_Dat, Stream_Raw, Stream_Sep: TFileStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 68 | 
 – | 
 //  Data, rawdata: Tdata; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 | 
   | 
   BeginTime, FileTime: Double; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 | 
   | 
   Step:     Integer; | 
 
 
 
 
 
 
 
 
 
 | 71 | 
 – | 
 //  rawlist:  TRawDataList; | 
 
 
 
 
 
 
 
 
 
 | 72 | 
 – | 
 //  datlinks: TDatLinks; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 | 
   | 
   OniImage:   TOniImage; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 71 | 
   | 
   LevelID:    Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 72 | 
   | 
   TimeFormat: TFormatSettings; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 87 | 
   | 
   RawLinks:   TRawDataList; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 88 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 89 | 
   | 
   DatFileStream, RawFileStream: TMemoryStream; | 
 
 
 
 
 
 
 
 
 | 90 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 91 | 
 + | 
 // ########################### | 
 
 
 
 
 
 
 
 
 | 92 | 
 + | 
   datsum, linksum, rawsum: Int64; | 
 
 
 
 
 
 
 
 
 | 93 | 
 + | 
   freq: Int64; | 
 
 
 
 
 
 
 
 
 | 94 | 
 + | 
   tempticks1, tempticks2: Int64; | 
 
 
 
 
 
 
 
 
 | 95 | 
 + | 
 // ########################### | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 96 | 
   | 
 const | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 97 | 
   | 
   Steps: Byte = 3; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 98 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 154 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 155 | 
   | 
         ShowMessage('Couldn''t delete file. Aborting'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 156 | 
   | 
         Exit; | 
 
 
 
 
 
 
 
 
 
 | 154 | 
 – | 
       end else if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.raw')) then | 
 
 
 
 
 
 
 
 
 
 | 155 | 
 – | 
       begin | 
 
 
 
 
 
 
 
 
 
 | 156 | 
 – | 
         ShowMessage('Couldn''t delete file. Aborting'); | 
 
 
 
 
 
 
 
 
 
 | 157 | 
 – | 
         Exit; | 
 
 
 
 
 
 
 
 
 
 | 158 | 
 – | 
       end else if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.sep')) then | 
 
 
 
 
 
 
 
 
 
 | 159 | 
 – | 
       begin | 
 
 
 
 
 
 
 
 
 
 | 160 | 
 – | 
         ShowMessage('Couldn''t delete file. Aborting'); | 
 
 
 
 
 
 
 
 
 
 | 161 | 
 – | 
         Exit; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 157 | 
   | 
       end; | 
 
 
 
 
 
 
 
 
 | 158 | 
 + | 
       if FileExists(AnsiReplaceStr(Target, '.dat', '.raw')) then | 
 
 
 
 
 
 
 
 
 | 159 | 
 + | 
         if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.raw')) then | 
 
 
 
 
 
 
 
 
 | 160 | 
 + | 
         begin | 
 
 
 
 
 
 
 
 
 | 161 | 
 + | 
           ShowMessage('Couldn''t delete file. Aborting'); | 
 
 
 
 
 
 
 
 
 | 162 | 
 + | 
           Exit; | 
 
 
 
 
 
 
 
 
 | 163 | 
 + | 
         end; | 
 
 
 
 
 
 
 
 
 | 164 | 
 + | 
       if FileExists(AnsiReplaceStr(Target, '.dat', '.sep')) then | 
 
 
 
 
 
 
 
 
 | 165 | 
 + | 
         if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then | 
 
 
 
 
 
 
 
 
 | 166 | 
 + | 
           if not DeleteFile(AnsiReplaceStr(Target, '.dat', '.sep')) then | 
 
 
 
 
 
 
 
 
 | 167 | 
 + | 
           begin | 
 
 
 
 
 
 
 
 
 | 168 | 
 + | 
             ShowMessage('Couldn''t delete file. Aborting'); | 
 
 
 
 
 
 
 
 
 | 169 | 
 + | 
             Exit; | 
 
 
 
 
 
 
 
 
 | 170 | 
 + | 
           end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 171 | 
   | 
     end else begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 172 | 
   | 
       ShowMessage('Aborting'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 173 | 
   | 
       Exit; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 283 | 
   | 
   lbl_estimation.Caption := 'Estimated finishing time: unknown'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 284 | 
   | 
   Application.ProcessMessages; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 285 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 286 | 
 + | 
   QueryPerformanceFrequency(freq); | 
 
 
 
 
 
 
 
 
 | 287 | 
 + | 
   datsum := 0; | 
 
 
 
 
 
 
 
 
 | 288 | 
 + | 
   linksum := 0; | 
 
 
 
 
 
 
 
 
 | 289 | 
 + | 
   rawsum := 0; | 
 
 
 
 
 
 
 
 
 | 290 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 291 | 
   | 
   FileTime := Time; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 292 | 
   | 
   for FileID := 0 to DatHeader.Files - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 293 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 296 | 
   | 
       FilesHeader[FileID].Extension[j] := FileInfo.Extension[4 - j]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 297 | 
   | 
     if FileInfo.Size > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 298 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 | 299 | 
 + | 
       QueryPerformanceCounter(tempticks1); | 
 
 
 
 
 
 
 
 
 | 300 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 301 | 
   | 
       FilesHeader[FileID].DataAddr := Stream_Body.Size + 8; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 302 | 
   | 
       DatFileStream := TMemoryStream.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 303 | 
   | 
       Connection.LoadDatFile(FileID, TStream(DatFileStream)); | 
 
 
 
 
 
 
 
 
 
 
 
 | 304 | 
 < | 
       DatFileStream.Seek(4, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 304 | 
 > | 
       DatFileStream.Seek(0, soFromBeginning); | 
 
 
 
 
 
 | 305 | 
 > | 
       DatFileStream.Write(FileID, 4); | 
 
 
 
 
 
 
 
 
 
 
 
 | 306 | 
   | 
       DatFileStream.Write(LevelID, 4); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 307 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 308 | 
 + | 
       QueryPerformanceCounter(tempticks2); | 
 
 
 
 
 
 
 
 
 | 309 | 
 + | 
       datsum := datsum + (tempticks2 - tempticks1); | 
 
 
 
 
 
 
 
 
 | 310 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 311 | 
   | 
       DatLinks := Connection.GetDatLinks(FileID); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 312 | 
   | 
       if Length(DatLinks) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 313 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 322 | 
   | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 323 | 
   | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 324 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 325 | 
 + | 
       QueryPerformanceCounter(tempticks1); | 
 
 
 
 
 
 
 
 
 | 326 | 
 + | 
       linksum := linksum + (tempticks1 - tempticks2); | 
 
 
 
 
 
 
 
 
 | 327 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 328 | 
   | 
       RawLinks := Connection.GetRawList(FileID); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 329 | 
   | 
       if Length(RawLinks) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 330 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 351 | 
   | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 352 | 
   | 
       DatFileStream.Seek(0, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 353 | 
   | 
       Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size); | 
 
 
 
 
 
 
 
 
 | 354 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 355 | 
 + | 
       QueryPerformanceCounter(tempticks2); | 
 
 
 
 
 
 
 
 
 | 356 | 
 + | 
       rawsum := rawsum + (tempticks2 - tempticks1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 357 | 
   | 
     end | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 358 | 
   | 
     else | 
 
 
 
 
 
 
 
 
 
 
 
 | 359 | 
 < | 
       FilesHeader[i].DataAddr := 0; | 
 
 
 
 
 
 
 
 
 
 | 359 | 
 > | 
       FilesHeader[FileID].DataAddr := 0; | 
 
 
 
 
 
 
 
 
 
 
 
 | 360 | 
   | 
     if Length(fileinfo.Name) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 361 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 362 | 
 < | 
       FilesHeader[i].NameAddr := Stream_Names.Size; | 
 
 
 
 
 
 
 
 
 
 | 362 | 
 > | 
       FilesHeader[FileID].NameAddr := Stream_Names.Size; | 
 
 
 
 
 
 
 
 
 
 
 
 | 363 | 
   | 
       temps := fileinfo.Extension + fileinfo.Name + Chr(0); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 364 | 
   | 
       Stream_Names.Write(temps[1], Length(temps)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 365 | 
   | 
     end | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 366 | 
   | 
     else | 
 
 
 
 
 
 
 
 
 
 
 
 | 367 | 
 < | 
       FilesHeader[i].NameAddr := 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 368 | 
 < | 
     FilesHeader[i].FileSize := fileinfo.Size; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 369 | 
 < | 
     FilesHeader[i].FileType := fileinfo.FileType; | 
 
 
 
 
 
 
 
 
 
 | 367 | 
 > | 
       FilesHeader[FileID].NameAddr := 0; | 
 
 
 
 
 
 | 368 | 
 > | 
     FilesHeader[FileID].FileSize := fileinfo.Size; | 
 
 
 
 
 
 | 369 | 
 > | 
     FilesHeader[FileID].FileType := fileinfo.FileType; | 
 
 
 
 
 
 
 
 
 
 
 
 | 370 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 371 | 
 < | 
     if ((i mod 10) = 0) and (i >= 100) then | 
 
 
 
 
 
 
 
 
 
 | 371 | 
 > | 
     if ((FileID mod 10) = 0) and (FileID >= 100) then | 
 
 
 
 
 
 
 
 
 
 
 
 | 372 | 
   | 
       lbl_estimation.Caption := 'Estimated time left: ' + TimeToStr( | 
 
 
 
 
 
 
 
 
 
 
 
 | 373 | 
 < | 
         (Time - FileTime) / i * (progress.Max - i + 1) * 1.1, TimeFormat ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 374 | 
 < | 
     progress.Position := i + 1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 375 | 
 < | 
     lbl_progress.Caption := 'Files done: ' + IntToStr(i + 1) + '/' + IntToStr(progress.Max); | 
 
 
 
 
 
 
 
 
 
 | 373 | 
 > | 
         (Time - FileTime) / FileID * (progress.Max - FileID + 1) * 1.1, TimeFormat ); | 
 
 
 
 
 
 | 374 | 
 > | 
     progress.Position := FileID + 1; | 
 
 
 
 
 
 | 375 | 
 > | 
     lbl_progress.Caption := 'Files done: ' + IntToStr(FileID + 1) + '/' + IntToStr(progress.Max); | 
 
 
 
 
 
 
 
 
 
 
 
 | 376 | 
   | 
     Application.ProcessMessages; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 377 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 378 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 379 | 
 + | 
   ShowMessage('AvgDats: ' + FloatToStr((datsum / progress.Max) / freq) + #13#10 + | 
 
 
 
 
 
 
 
 
 | 380 | 
 + | 
       'AvgLinks: ' + FloatToStr((linksum / progress.Max) / freq) + #13#10 + | 
 
 
 
 
 
 
 
 
 | 381 | 
 + | 
       'AvgRaws: ' + FloatToStr((rawsum / progress.Max) / freq) | 
 
 
 
 
 
 
 
 
 | 382 | 
 + | 
    ); | 
 
 
 
 
 
 
 
 
 | 383 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 384 | 
   | 
   Stream_Dat.Write(DatHeader, SizeOf(DatHeader)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 385 | 
   | 
   for i := 0 to High(FilesHeader) do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 386 | 
   | 
     Stream_Dat.Write(FilesHeader[i], SizeOf(FilesHeader[i])); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 392 | 
   | 
   DatHeader.DataSize  := Stream_Body.Size; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 393 | 
   | 
   DatHeader.NamesSize := Stream_Names.Size; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 394 | 
   | 
   DatHeader.DataAddr  := Stream_Dat.Size; | 
 
 
 
 
 
 
 
 
 | 395 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 396 | 
   | 
   Stream_Body.Seek(0, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 397 | 
   | 
   Stream_Dat.CopyFrom(Stream_Body, Stream_Body.Size); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 398 | 
   | 
   DatHeader.NamesAddr := Stream_Dat.Size; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 448 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 449 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 450 | 
   | 
 procedure TForm_LevelDB.CreateDatabase(Source, target: String); | 
 
 
 
 
 
 
 
 
 | 451 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 452 | 
 + | 
   DataBase:  TABSDatabase; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 453 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 454 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 455 | 
   | 
   DataBase:    TABSDatabase; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 511 | 
   | 
   absolutebegintime := Time; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 512 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 513 | 
   | 
   DataBase := TABSDatabase.Create(Self); | 
 
 
 
 
 
 
 
 
 | 514 | 
 + | 
 } | 
 
 
 
 
 
 
 
 
 | 515 | 
 + | 
   DataBase.MaxConnections := 1; | 
 
 
 
 
 
 
 
 
 | 516 | 
 + | 
   DataBase.PageSize := 8112; | 
 
 
 
 
 
 
 
 
 | 517 | 
 + | 
   DataBase.PageCountInExtent := 8; | 
 
 
 
 
 
 
 
 
 | 518 | 
 + | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 519 | 
   | 
   DataBase.DatabaseName := 'OLDB'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 520 | 
   | 
   DataBase.DatabaseFileName := target; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 521 | 
   | 
   DataBase.CreateDatabase; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 529 | 
   | 
   Query := TABSQuery.Create(Self); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 530 | 
   | 
   Query.DatabaseName := 'OLDB'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 531 | 
   | 
   Query.SQL.Text := | 
 
 
 
 
 
 
 
 
 
 
 
 | 532 | 
 < | 
     'CREATE TABLE globals  ( id AUTOINC PRIMARY KEY, name STRING(128), value STRING(128) );'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 532 | 
 > | 
     'CREATE TABLE globals  ( id AUTOINC PRIMARY KEY, name STRING(128), ' + | 
 
 
 
 
 
 | 533 | 
 > | 
     'value STRING(128) );'; | 
 
 
 
 
 
 
 
 
 
 
 
 | 534 | 
   | 
   Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 535 | 
   | 
   Query.SQL.Text := | 
 
 
 
 
 
 
 
 
 
 
 
 | 536 | 
 < | 
     'CREATE TABLE linkmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, target_id INTEGER );'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 536 | 
 > | 
     'CREATE TABLE linkmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, ' + | 
 
 
 
 
 
 | 537 | 
 > | 
     'src_link_offset INTEGER, target_id INTEGER,  INDEX idsrcid src_id, ' + | 
 
 
 
 
 
 | 538 | 
 > | 
     'INDEX iddestid target_id);'; | 
 
 
 
 
 
 
 
 
 
 
 
 | 539 | 
   | 
   Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 540 | 
   | 
   Query.SQL.Text := | 
 
 
 
 
 
 
 
 
 
 
 
 | 541 | 
 < | 
     'CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, sep BOOLEAN, size INTEGER, data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 541 | 
 > | 
     'CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, ' + | 
 
 
 
 
 
 | 542 | 
 > | 
     'src_link_offset INTEGER, sep BOOLEAN, size INTEGER, ' + | 
 
 
 
 
 
 | 543 | 
 > | 
     'data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib, ' + | 
 
 
 
 
 
 | 544 | 
 > | 
     'INDEX idsrcid src_id);'; | 
 
 
 
 
 
 
 
 
 
 
 
 | 545 | 
   | 
   //    Query.SQL.Text:='CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 546 | 
   | 
   Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 547 | 
   | 
   Query.SQL.Text := | 
 
 
 
 
 
 
 
 
 
 
 
 | 548 | 
 < | 
     'CREATE TABLE datfiles  ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 548 | 
 > | 
     'CREATE TABLE datfiles  ( id INTEGER PRIMARY KEY, extension CHAR(4), ' + | 
 
 
 
 
 
 | 549 | 
 > | 
     'name STRING(128), contenttype INTEGER, size INTEGER, ' + | 
 
 
 
 
 
 | 550 | 
 > | 
     'data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib );'; | 
 
 
 
 
 
 
 
 
 
 
 
 | 551 | 
   | 
   //    Query.SQL.Text:='CREATE TABLE datfiles  ( id INTEGER PRIMARY KEY, extension CHAR(4), name STRING(128), contenttype INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 552 | 
   | 
   Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 
 
 | 553 | 
 < | 
   Query.SQL.Text := | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 554 | 
 < | 
     'CREATE TABLE extlist  ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 555 | 
 < | 
   Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 | 553 | 
 > | 
 //  Query.SQL.Text := | 
 
 
 
 
 
 | 554 | 
 > | 
 //    'CREATE TABLE extlist  ( id AUTOINC PRIMARY KEY, ext CHAR(4), ident CHAR(16) );'; | 
 
 
 
 
 
 | 555 | 
 > | 
 //  Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 
 
 | 556 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 557 | 
   | 
   Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("dbversion","' + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 558 | 
   | 
     dbversion + '");'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 561 | 
   | 
   for i := 0 to High(OniDataConnection.LevelInfo.Ident) do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 562 | 
   | 
     Data[i] := OniDataConnection.LevelInfo.Ident[i]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 563 | 
   | 
   temps := CreateHexString(Data, True); | 
 
 
 
 
 
 
 
 
 
 
 
 | 564 | 
 < | 
   Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("ident","' + temps + '");'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 565 | 
 < | 
   Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 | 564 | 
 > | 
 //  Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("ident","' + temps + '");'; | 
 
 
 
 
 
 | 565 | 
 > | 
 //  Query.ExecSQL; | 
 
 
 
 
 
 
 
 
 
 
 
 | 566 | 
   | 
   Query.SQL.Text := 'INSERT INTO globals (name,value) VALUES ("lvl","' + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 567 | 
   | 
     IntToStr(OniDataConnection.LevelInfo.LevelNumber) + '");'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 568 | 
   | 
   Query.ExecSQL; |