Autor Beitrag
ak
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 240

Suse Windows 9 XP
D6 Professional
BeitragVerfasst: Mi 03.09.03 18:20 
Hallo Leute,

ich habe ein Programm bekommen, welches einen Bug hat, nun soll ich diesen Bug entfernen (habe das Programm nicht selbst geschrieben).

Folgendes Problem. Das Programm öffnet eine Textdatei mit ca. 140.000 Zeilen. Diese Textdatei wird in ein Memofeld geladen. Anschliessend wird eine lokale Paradoxtabelle geöffnet, in einer for-Schleife wird in mehrere Felder der Tabelle ( der Zeile x) ein Wert aus dem Memofeld ( der Zeile x) geschrieben, am ende der for-Schleife kommt ein post. Die ersten ca. 95.000 Zeilen werden übersprungen, da das Programm dort keine relevanten Daten finden kann. Das Programm stürzt jedesmal in der Zeile 115.807 ab (try-except Fehlerbehandlung). Wenn ich nun die Daten aus der Textdatei von der Zeile 115.500 - 116.000 ausschneide und in einer seperaten Textdatei speichere, und mit dem Programm öffne, dann stürzt das Programm nicht ab. An den Daten wird es wohl nicht liegen.
Kann es ein, dass es mit Paradoxtabellen und einem 20.000 fachen post-Aufruf Probleme gibt? Woran könnte es noch liegen?

Gruß

_________________
Gruß AK
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Mi 03.09.03 19:18 
mit welcher Fehlermeldung stürzt es denn ab? Das kann mehrere Ursachen haben und leider sind mir die Glaskugeln ausgegangen :-)

grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
ak Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 240

Suse Windows 9 XP
D6 Professional
BeitragVerfasst: Mi 03.09.03 21:10 
Hallo MSCH,

die Fehlermeldung ist eine selbstgeschriebene try-except Fehlermeldung (showmessage('Unbekannter Fehler in Zeile inttostr(x)');). Da ich erst wieder am Montag an das Programm rankomme, kann ich erst dann mal den try-except Block ausklammern. Der try-except Block ist ist ca 100 Zeilen gross, ich habe aber alle strtoint Anweisungen mit weiteren try- except Blöcken abgefangen.

Vielleicht hat ja jemand schon ähnliche Erfahrungen mit mehr als 20.000 mal "post" in einer Paradoxtabelle. Weil, wie gesagt, wenn ich nur einen kleinen Auschnitt der ganzen Textdatei durchlaufen lasse, "meckert" das Programm nicht rum. Dieser Textausschnitt beinhaltet auch die Zeilen die in der Fehlermeldung erscheinen.

Gruß

_________________
Gruß AK
ak Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 240

Suse Windows 9 XP
D6 Professional
BeitragVerfasst: Sa 06.09.03 16:40 
Soo habe jetzt mal ein eigenes kleines Tool erstellt welches eine Textdatei mit mehr als 200.000 Zeilen einliest. Das übertragen in das Memofeld mit anschliessendem eintragen anhand von Kriterien in eine Paradoxtabelle ging ohne Probleme.
Die for-schelife wird etwas mehr als 200.000 mal durchlaufen:

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
procedure TForm1.Button1Click(Sender: TObject);
var
  mega :textfile;
  zeile :string;
  ende, x: integer;
begin
  if opendialog1.Execute = True then begin
    assignfile(mega,opendialog1.FileName);
    reset(mega);
    memo1.Lines.Clear;
    while not eof(mega) do begin
      if not eof(mega) then
        readln(mega,zeile);

        memo1.Lines.Add(zeile);
    end;
  end;

  ende := memo1.Lines.Count;
  table1.EmptyTable;
  table1.Open;
  for x:=0 to ende-1 do begin
    table1.Insert;
    table1.FieldByName('Eins').Value := copy(memo1.lines[x],1,3);
    table1.FieldByName('zwei').Value := copy(memo1.lines[x],4,3);
    table1.FieldByName('drei').Value := copy(memo1.lines[x],8,3);
    table1.FieldByName('vier').Value := copy(memo1.lines[x],13,3);
    table1.Post;
  end;
  table1.Close;
  showmessage('Fertig!');
end;


hmmmm am post und der Anzahl der Einträge wird es wohl nicht liegen....

_________________
Gruß AK
ak Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 240

Suse Windows 9 XP
D6 Professional
BeitragVerfasst: Mi 10.09.03 11:10 
Hallo MSCH,

die Fehlermeldung lautet "Indexfehler" :-) .

_________________
Gruß AK
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Mi 10.09.03 12:40 
Also fügst du doppelte Einträge hinzu, welche aber schon vorhanden sind. Nun, da musst du wohl vorher ein Abgleich machen.
grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
ak Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 240

Suse Windows 9 XP
D6 Professional
BeitragVerfasst: Mi 10.09.03 14:28 
Hallo,

was verstehst du unter einem "Abgleich"?

_________________
Gruß AK
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Mi 10.09.03 17:56 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if not Table.locate('ID',NeuID,[]) then
  einfügen
else
  updaten


so oder ähnlich. Du hast ein Indexfeld, welches keine doppelten Einträge zulässt, du aber trotzdem welche hinzufügst. Das ist ein Indexfehler.
Also vorher prüfen ob Wert in Indexspalte schon vorhanden.
grez
msch

Moderiert von user profile iconKlabautermann: Delphi-Tags hinzugefügt.

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
ak Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 240

Suse Windows 9 XP
D6 Professional
BeitragVerfasst: Do 11.09.03 13:16 
danke dir

_________________
Gruß AK