--- oup/rewrite/DataAccess/Access_OUP_ADB.pas 2007/02/21 00:29:27 105 +++ oup/rewrite/DataAccess/Access_OUP_ADB.pas 2007/02/21 03:09:30 106 @@ -17,6 +17,9 @@ type procedure UpdateListCache; + function GetLinksToFile(FileID: Integer): TLinks; + function GetLinksFromFile(FileID: Integer): TLinks; + function GetFileInfo(FileID: Integer): TFileInfo; override; function GetFilesList(Ext: String; Pattern: String; NoEmptyFiles: Boolean; SortType: TSortType): TStrings; override; @@ -168,6 +171,51 @@ begin end; + +function TAccess_OUP_ADB.GetLinksToFile(FileID: Integer): TLinks; +var + i: Integer; +begin + SetLength(Result.ByName, 0); + FQuery.SQL.Text := 'SELECT src_link_offset, src_id FROM linkmap WHERE target_id = ' + IntToStr(FileID) + ' ORDER BY src_id ASC;'; + FQuery.Open; + SetLength(Result.ByID, FQuery.RecordCount); + if FQuery.RecordCount > 0 then + begin + i := 0; + repeat + Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger; + Result.ByID[i].Destination := FQuery.FieldByName('src_id').AsInteger; + Inc(i); + FQuery.Next; + until FQuery.EOF; + end; + FQuery.Close; +end; + +function TAccess_OUP_ADB.GetLinksFromFile(FileID: Integer): TLinks; +var + i: Integer; +begin + SetLength(Result.ByName, 0); + FQuery.SQL.Text := 'SELECT src_link_offset, target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' ORDER BY target_id ASC;'; + FQuery.Open; + SetLength(Result.ByID, FQuery.RecordCount); + if FQuery.RecordCount > 0 then + begin + i := 0; + repeat + Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger; + Result.ByID[i].Destination := FQuery.FieldByName('target_id').AsInteger; + Inc(i); + FQuery.Next; + until FQuery.EOF; + end; + FQuery.Close; +end; + + + function TAccess_OUP_ADB.GetFileInfo(fileid: Integer): TFileInfo; begin if fileid = -1 then