Einzelnen Beitrag anzeigen

danielA

Registriert seit: 10. Jun 2002
Ort: Hamburg
72 Beiträge
 
Delphi XE7 Enterprise
 
#8

Re: Firebird hängt beim disconnect

  Alt 7. Mai 2004, 14:01
Habe die TIBQuery abgeleitet. Folgender Code funktioniert unter IB6 und Firebird 1.0.3. Bei Firebird 1.5 fliegt er an der markierten Stelle raus wenn
UseCountStatement True ist (und FDBType auf F_Interbase6 steht).
PS.: Ich weiß das das Countstatement bei Firebird nicht mehr notwendig ist da RecordCount richtig gesetzt wird. Leider ist das nur eine Stelle an der er mit dieser Fehlermeldung rausfliegt.

Delphi-Quellcode:
   
   ...
        Self.Active:=False;
        if (MyUseCountStatement) and (FDBType = F_Interbase6) then
        begin
          SQLKompo:=TIBQuery.Create(self);
          SQLTransaction:=TIBTransaction.Create(self);
          try
            SQLTransaction.DefaultDatabase:=Self.Database;
            SQLKompo.Database:=Self.Database;
            SQLKompo.Transaction:=SQLTransaction;
            if not SQLKompo.Transaction.InTransaction then
               SQLKompo.Transaction.StartTransaction;
            SQLKompo.SQL.Text:=CountStatement;
            SQLKompo.Prepare;
            SQLKompo.Active:=True;
            FRecordCount:=SQLKompo.fieldbyname('ANZAHL').AsInteger;
            SQLKompo.Transaction.Rollback;
            SQLKompo.Active:=False;
          finally
            SQLKompo.Free;
            SQLTransaction.Free;
          end;
        end;
        Self.SQL.Clear;
        Self.SQL.Add(Statement);
        Self.Prepare;
        Self.Active:=True; // <== und hier fliegt er dann raus
   ...
Gruß Daniel
  Mit Zitat antworten Zitat