ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/DataAccess/Access_OUP_ADB.pas
(Generate patch)

Comparing:
oup/rewrite/DataAccess/Access_OUP_ADB.pas (file contents), Revision 101 by alloc, Tue Feb 20 20:43:29 2007 UTC vs.
oup/current/DataAccess/Access_OUP_ADB.pas (file contents), Revision 112 by alloc, Thu Feb 22 00:37:39 2007 UTC

# Line 17 | Line 17 | type
17  
18      procedure UpdateListCache;
19  
20 +    function GetLinksToFile(FileID: Integer): TLinks;
21 +    function GetLinksFromFile(FileID: Integer): TLinks;
22 +
23      function GetFileInfo(FileID: Integer): TFileInfo; override;
24      function GetFilesList(Ext: String; Pattern: String;
25        NoEmptyFiles: Boolean; SortType: TSortType): TStrings; override;
# Line 102 | Line 105 | begin
105    Msg := SM_OK;
106    FBackend := DB_ADB;
107  
108 +  FConnectionID := ConnectionID;
109    FChangeRights := [CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw];
110  
111    UpdateListCache;
# Line 167 | Line 171 | begin
171   end;
172  
173  
174 +
175 + function TAccess_OUP_ADB.GetLinksToFile(FileID: Integer): TLinks;
176 + var
177 +  i: Integer;
178 + begin
179 +  SetLength(Result.ByName, 0);
180 +  FQuery.SQL.Text := 'SELECT src_link_offset, src_id FROM linkmap WHERE target_id = ' + IntToStr(FileID) + ' ORDER BY src_id ASC;';
181 +  FQuery.Open;
182 +  SetLength(Result.ByID, FQuery.RecordCount);
183 +  if FQuery.RecordCount > 0 then
184 +  begin
185 +    i := 0;
186 +    repeat
187 +      Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger;
188 +      Result.ByID[i].Destination := FQuery.FieldByName('src_id').AsInteger;
189 +      Inc(i);
190 +      FQuery.Next;
191 +    until FQuery.EOF;
192 +  end;
193 +  FQuery.Close;
194 + end;
195 +
196 + function TAccess_OUP_ADB.GetLinksFromFile(FileID: Integer): TLinks;
197 + var
198 +  i: Integer;
199 + begin
200 +  SetLength(Result.ByName, 0);
201 +  FQuery.SQL.Text := 'SELECT src_link_offset, target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' ORDER BY target_id ASC;';
202 +  FQuery.Open;
203 +  SetLength(Result.ByID, FQuery.RecordCount);
204 +  if FQuery.RecordCount > 0 then
205 +  begin
206 +    i := 0;
207 +    repeat
208 +      Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger;
209 +      Result.ByID[i].Destination := FQuery.FieldByName('target_id').AsInteger;
210 +      Inc(i);
211 +      FQuery.Next;
212 +    until FQuery.EOF;
213 +  end;
214 +  FQuery.Close;
215 + end;
216 +
217 +
218 +
219   function TAccess_OUP_ADB.GetFileInfo(fileid: Integer): TFileInfo;
220   begin
221    if fileid = -1 then
# Line 212 | Line 261 | var
261        name := fields.Strings[2];
262        extension := fields.Strings[0];
263      end;
264 +    if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then
265 +    begin
266 +      id := fields.Strings[2];
267 +      name := fields.Strings[1];
268 +      extension := fields.Strings[0];
269 +    end;
270    end;
271  
272   begin
# Line 225 | Line 280 | begin
280      begin
281        if (NoEmptyFiles = False) or ((Fdat_files[i].FileType and $02) = 0) then
282        begin
283 <        if AppSettings.FilenumbersAsHex then
229 <          id := IntToHex(Fdat_files[i].ID, 4)
230 <        else
231 <          id := FormatNumber(Fdat_files[i].ID, 5, '0');
283 >        id := FormatNumber(Fdat_files[i].ID, 5, '0');
284          name := Fdat_files[i].Name;
285          extension := Fdat_files[i].Extension;
286  
# Line 236 | Line 288 | begin
288            ST_IDAsc, ST_IDDesc:     list.Add(id + ';' + name + ';' + extension);
289            ST_NameAsc, ST_NameDesc: list.Add(name + ';' + id + ';' + extension);
290            ST_ExtAsc, ST_ExtDesc:   list.Add(extension + ';' + id + ';' + name);
291 +          ST_ExtNameAsc, ST_ExtNameDesc: list.Add(name + ';' + extension + ';' + id);
292          end;
293        end;
294      end;
# Line 244 | Line 297 | begin
297    if list.Count > 0 then
298    begin
299      fields := TStringList.Create;
300 <    if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc] then
300 >    if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc, ST_ExtNameAsc] then
301        for i := 0 to list.Count - 1 do
302        begin
303          getfields;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)