Changeset 116 for oup/current


Ignore:
Timestamp:
Feb 26, 2007, 11:57:02 PM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/current/DataAccess
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • oup/current/DataAccess/Access_OUP_ADB.pas

    r113 r116  
    3333
    3434    function GetDatLinks(FileID: Integer): TDatLinkList; override;
     35    function GetDatLink(FileID, DatOffset: Integer): TDatLink; override;
    3536    function GetRawList(FileID: Integer): TRawDataList; override;
    3637    function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override;
     
    4748
    4849uses
    49   SysUtils, Data, Functions, ABSDecUtil, DB;
     50  SysUtils, Data, Functions, ABSDecUtil, DB, DatLinks;
    5051
    5152
     
    445446
    446447
     448
     449function TAccess_OUP_ADB.GetDatLink(FileID, DatOffset: Integer): TDatLink;
     450begin
     451  Result := DatLinksManager.GetDatLink(FConnectionID, FileID, DatOffset);
     452  FQuery.SQL.Text := 'SELECT target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' and src_link_offset = ' + IntToStr(DatOffset) + ';';
     453  FQuery.Open;
     454  if FQuery.RecordCount > 0 then
     455    Result.DestID := FQuery.FieldByName('target_id').AsInteger;
     456  FQuery.Close;
     457end;
     458
     459
     460function TAccess_OUP_ADB.GetDatLinks(FileID: Integer): TDatLinkList;
     461var
     462  i: Integer;
     463  SrcOffset, DestID: Integer;
     464begin
     465  Result := DatLinksManager.GetDatLinks(FConnectionID, FileID);
     466  if Length(Result) > 0 then
     467  begin
     468    FQuery.SQL.Text := 'SELECT src_link_offset, target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' ORDER BY src_link_offset ASC;';
     469    FQuery.Open;
     470    if FQuery.RecordCount > 0 then
     471    begin
     472      repeat
     473        SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger;
     474        DestID := FQuery.FieldByName('target_id').AsInteger;
     475        for i := 0 to High(Result) do
     476          if Result[i].SrcOffset = SrcOffset then
     477            Break;
     478        if i < Length(Result) then
     479          Result[i].DestID := DestID
     480        else
     481          Result[i].DestID := -1;
     482        FQuery.Next;
     483      until FQuery.EOF;
     484    end;
     485    FQuery.Close;
     486  end;
     487end;
     488
     489
    447490function TAccess_OUP_ADB.GetRawList(FileID: Integer): TRawDataList;
    448491var
  • oup/current/DataAccess/Access_OniArchive.pas

    r113 r116  
    3535
    3636    function GetDatLinks(FileID: Integer): TDatLinkList; override;
     37    function GetDatLink(FileID, DatOffset: Integer): TDatLink; override;
    3738    function GetRawList(FileID: Integer): TRawDataList; override;
    3839    function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override;
     
    5152
    5253uses
    53   SysUtils, StrUtils, Data, Functions, RawList;
     54  SysUtils, StrUtils, Data, Functions, RawList, DatLinks;
    5455
    5556
     
    398399
    399400
     401function TAccess_OniArchive.GetDatLink(FileID, DatOffset: Integer): TDatLink;
     402var
     403  link: Integer;
     404begin
     405  Result := DatLinksManager.GetDatLink(FConnectionID, FileID, DatOffset);
     406  LoadDatFilePart(fileid, Result.SrcOffset, 4, @link);
     407  if link > 0 then
     408    Result.DestID := link div 256
     409  else
     410    Result.DestID := -1;
     411end;
     412
     413
     414function TAccess_OniArchive.GetDatLinks(FileID: Integer): TDatLinkList;
     415var
     416  i: Integer;
     417  link: Integer;
     418begin
     419  Result := DatLinksManager.GetDatLinks(FConnectionID, FileID);
     420  if Length(Result) > 0 then
     421  begin
     422    for i := 0 to High(Result) do
     423    begin
     424      LoadDatFilePart(fileid, Result[i].SrcOffset, 4, @link);
     425      if link > 0 then
     426        Result[i].DestID := link div 256
     427      else
     428        Result[i].DestID := -1;
     429    end;
     430  end;
     431end;
     432
     433
    400434function TAccess_OniArchive.GetRawList(FileID: Integer): TRawDataList;
    401435begin
  • oup/current/DataAccess/DataAccess.pas

    r113 r116  
    4545
    4646    function GetDatLinks(FileID: Integer): TDatLinkList; virtual; abstract;
     47    function GetDatLink(FileID, DatOffset: Integer): TDatLink; virtual; abstract;
    4748    function GetRawList(FileID: Integer): TRawDataList; virtual; abstract;
    4849    function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; virtual; abstract;
Note: See TracChangeset for help on using the changeset viewer.