--- oup/rewrite/DataAccess/Access_OUP_ADB.pas 2007/02/20 20:43:29 101 +++ oup/current/DataAccess/Access_OUP_ADB.pas 2007/02/21 03:12:33 109 @@ -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; @@ -102,6 +105,7 @@ begin Msg := SM_OK; FBackend := DB_ADB; + FConnectionID := ConnectionID; FChangeRights := [CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw]; UpdateListCache; @@ -167,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