AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken Delphi Zeos Query - too many connections
Thema durchsuchen
Ansicht
Themen-Optionen

Zeos Query - too many connections

Ein Thema von bl3nder · begonnen am 19. Aug 2008 · letzter Beitrag vom 19. Aug 2008
Antwort Antwort
Seite 2 von 3     12 3      
bl3nder

Registriert seit: 18. Aug 2006
89 Beiträge
 
#11

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 10:56
Also hier mal zur Erklaerung, vielleicht kann man den Fehler so finden:


Habe 2 Units Model.pas und Model_Database.pas



In Model.pas habe ich folgende Klassen:

Delphi-Quellcode:

  TAttributes = class(TObject)
  private
  public
  end;

  TMain = class(TObject)
  private
  public
    function DBSearch(Criteria: TAttributes): TObjectList; Virtual; Abstract;
    function DBCreate(): TZQuery; Virtual; Abstract;
    function DBEdit(): TZQuery; Virtual; Abstract;
    function DBDelete(): TZQuery; Virtual; Abstract;
  end;





  { ---- Attributes ---- }

  TDockingstationAttributes = class(TAttributes)
  private
    FComment: String;
    FFabricant: String;
    FID: Integer;
    //..
  public
    function GetComment: String;
    function GetFabricant: String;
    function GetID: Integer;
   //...
    procedure SetComment(Comment: String);
    procedure SetFabricant(Fabricant: String);
    procedure SetID(ID: Integer);
    //...
  end;
  { ---- /Attributes ---- }


  { ---- Main ---- }
  TDockingstation = class(TMain)
  private
    FAttributes : TDockingstationAttributes;
  public
    constructor Create();

    function GetAttributes(): TDockingstationAttributes;

    procedure SetAttributes(Comment: String='';Fabricant: String='';
      ID: Integer=0; ...);

  end;

  { ---- /Main ---- }


  { ---- Search ---- }

  TDockingstationSearch = class(TMain)
  private
  public
    function DBSearch(Modus: String; Criteria: TDockingstationAttributes)
      : TObjectList; Overload;
  end;

  { ---- /Search ---- }





  { ---- Attributes ---- }


  TComputerAttributes = class(TAttributes)
  private
    //..
    FComment: String;
    //..
    FGraphicCard: String;
  //..
    FDockingstation: TDockingstation; // <-- Computer enthaelt dockingstation objekt
  public
  //..get/set
  end;

  { ---- /Attributes ---- }


  { ---- Main ---- }

  TComputer = class(TMain)
  private
    FAttributes: TComputerAttributes;
  public
    constructor Create();

    function GetAttributes(): TComputerAttributes;

    procedure SetAttributes(Comment: String='';...GraphicCard: String='';...);

  end;

  { ---- /Main ---- }


  { ---- Search ---- }

  TComputerSearch = class(TMain)
  private
  public
    function DBSearch(Modus: String; Criteria: TComputerAttributes): TObjectList; Overload;
  end;

  { ---- /Search ---- }


implementation

//............


function TDockingstationSearch.DBSearch(Modus: String;
  Criteria: TDockingstationAttributes): TObjectList;
var
FMdbDsSearch: Model_Database.TDockingstationSearch;
FWsList: TObjectList;
begin
  FWsList := TObjectList.Create;
  FMdbDsSearch := Model_Database.TDockingstationSearch.Create;

  FWsList := FMdbDsSearch.DBSearch(Modus,Criteria);

  Result := FWsList;
end;


//................

function TComputerSearch.DBSearch(Modus: String; Criteria: TComputerAttributes)
  : TObjectList;
var
FMdbCSearch: Model_Database.TComputerSearch;
FCList: TObjectList;
begin
  FCList := TObjectList.Create;
  FMdbCSearch := Model_Database.TComputerSearch.Create;

  FCList := FMdbCSearch.DBSearch(Modus,Criteria);
  Result := FCList;
end;

//..










In Model_Database.pas steht folgendes:


Delphi-Quellcode:
  TDatabase = class(TObject)
  private
    FWQuery : TZQuery;
    FDQuery : TZQuery;
    FCQuery : TZQuery;
    FMQuery : TZQuery;
    FSqlConnection : TZConnection;
  public
    constructor Create();

    function DBSearch(Criteria: Model.TAttributes)
      : TObjectList; virtual; abstract;
    procedure DBCreate(); virtual; abstract;
    procedure DBEdit(); virtual; abstract;
    procedure DBDelete(); virtual; abstract;
  end;




  TDockingstationSearch = class(TDatabase)
  private
  public
    function DBSearch(Modus: String; Criteria: Model.TDockingstationAttributes)
      : TObjectList; Overload;
  end;

  TComputerSearch = class(TDatabase)
  private
  public
    function DBSearch(Modus: String; Criteria: Model.TComputerAttributes)
      : TObjectList; Overload;
  end;

implementation




constructor TDatabase.Create();
begin
  FSqlConnection := TZConnection.Create(FSqlConnection);
  FSqlConnection.HostName := ''; //Server
  FSqlConnection.User := ''; //Benutzername
  FSqlConnection.Password := ''; //Passwort
  FSqlConnection.Database := ''; //Name der Datenbank
  FSqlConnection.Protocol := 'mysql-4.1';
  FSqlConnection.Port := 3306;


  FDQuery := TZQuery.Create(FDQuery);
  FDQuery.Connection := FSqlConnection;
  FCQuery := TZQuery.Create(FCQuery);
  FCQuery.Connection := FSqlConnection;

end;





function TDockingstationSearch.DBSearch(Modus: String;
  Criteria: Model.TDockingstationAttributes): TObjectList;
var
FDSList: TObjectList;
I: Integer;
FEqual1,FEqual2 : String;
FMyDockingstation: Model.TDockingstation;
begin
  FDSList := TObjectList.Create;
  FMyDockingstation := Model.TDockingstation.Create;

 
//...
  // Search in the database for dockingstations by using the criteria
  FDQuery.Close;

  FDQuery.SQL.Text := 'SELECT * FROM Dockingstation';
  FDQuery.SQL.Add(' WHERE (1=1');
//...
  FDQuery.SQL.Add(')');
  FDQuery.Open;

  while not FDQuery.EOF do
  begin
    // Use search result to create a new dockingstation object
    FMyDockingstation.SetAttributes('','',
      FDQuery.FieldByName('DockingstationID').AsInteger,'',
       );

    // Add dockingstation to a list of dockingstation ojects
    FDSList.Add(FMyDockingstation);

    FDQuery.Next;
  end;

  FDQuery.Free;
  Result := FDSList;

end;


function TComputerSearch.DBSearch(Modus: String;
  Criteria: Model.TComputerAttributes): TObjectList;
var
//..

begin
  //..

  FCList := TObjectList.Create;

//..

  // Search in the database for computers by using the criteria
  FCQuery.Close;

  FCQuery.SQL.Text := 'SELECT';
  FCQuery.SQL.Add('....');
//...
  FCQuery.Open;

  while not FCQuery.EOF do
  begin
    FMyComputer := Model.TComputer.Create;

    // Use search result to create a new computer object
    FMyID := FCQuery.FieldByName('RechnerID').AsInteger;

   
    FMyComment := FCQuery.FieldByName('Bemerkungen').AsString;
    FMyGraphicCard := FCQuery.FieldByName('Grafikkarte').AsString;
    //...

  



// HIER KOENNTE DER FEHLER LIEGEN WEIL ICH HIER WIEDER EINE DOCKINGSTATIONSEARCH ERZEUGE UND DAS GANZE IN DER GROSSEN WHILE SCHLEIFE VOM FCSQLQUERY ---------------------

  if (FCQuery.FieldByName('DockingstationID').AsInteger > 0) then
      begin
        FMyDSearch := TDockingstationSearch.Create;
        FMyDCriteria := TDockingstationAttributes.Create;
       
        // Search for the dockingstation that is used by the computer
        FMyDCriteria.SetID(
          FCQuery.FieldByName('DockingstationID').AsInteger);
        
        FDList := FMyDSearch.DBSearch('vague',FMyDCriteria);
        


        // Create the dockingstation object for the computer object
        FMyDockingstation := FDList[0] as Model.TDockingstation;
      
      end;
 
//---------------------



    // Set all the information of the computer object
    FMyComputer.SetAttributes(...,FMyComment,...,FMyGraphicCard,.., FMyDockingstation...);

    // Add computer object to a list of computer ojects
    FCList.Add(FMyComputer);

    FCQuery.Next;
  end;


  FCQuery.Free;
  Result := FCList;

end;
  Mit Zitat antworten Zitat
bl3nder

Registriert seit: 18. Aug 2006
89 Beiträge
 
#12

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 10:57
Zitat von Bernhard Geyer:
Zitat von bl3nder:
Ja die Logdatei wird mega groß und ich muss das Programm abbrechen sonst hört er wohl garnicht mehr auf in die Log datei reinzuschreiben. Irgendwie bau ich mist mit meinem Objekten :/
Schaut so aus. Du solltest auch TD32-Debuginfos aktiv haben sonst wirst du nicht so glücklich mit der Logdatei.
Wo und wie stell ich das ein ? Finde in FastMM4Options.exe dazu nichts.
  Mit Zitat antworten Zitat
Benutzerbild von Bernhard Geyer
Bernhard Geyer
Online

Registriert seit: 13. Aug 2002
17.171 Beiträge
 
Delphi 10.4 Sydney
 
#13

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 11:04
Zitat von bl3nder:
Wo und wie stell ich das ein ? Finde in FastMM4Options.exe dazu nichts.
In den Projektoptionen, Reiterseite Linker.
Windows Vista - Eine neue Erfahrung in Fehlern.
  Mit Zitat antworten Zitat
bl3nder

Registriert seit: 18. Aug 2006
89 Beiträge
 
#14

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 11:12
Wird trotzdem eine sehr große Logdatei.. Ka ob es Sinn macht die zu posten
  Mit Zitat antworten Zitat
Benutzerbild von Bernhard Geyer
Bernhard Geyer
Online

Registriert seit: 13. Aug 2002
17.171 Beiträge
 
Delphi 10.4 Sydney
 
#15

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 11:16
Zitat von bl3nder:
Wird trotzdem eine sehr große Logdatei.. Ka ob es Sinn macht die zu posten
Es macht Sinn das du diese verstehst und deine Fehler behebst.
Windows Vista - Eine neue Erfahrung in Fehlern.
  Mit Zitat antworten Zitat
bl3nder

Registriert seit: 18. Aug 2006
89 Beiträge
 
#16

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 11:19
Hmm wie genau soll ich bitte sowas verstehen ?


Zitat:
...
--------------------------------2008/8/19 11:31:02--------------------------------
A memory block has been leaked. The size is: 20

Stack trace of when this block was allocated (return addresses):
403086
403F97
407059
40435E
577439
40709B
406FDC
579B39
5820FD
57D08E

The block is currently used for an object of class: TZVariablesList

The allocation number is: 455821

Current memory dump of 256 bytes starting at pointer address 7EDC02E0:
C4 73 57 00 01 00 00 00 19 12 40 00 70 03 DC 7E 20 73 57 00 A7 03 3C 7E 00 00 00 00 80 F6 DB 7E
00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 8E F4 06 00 86 30 40 00 97 3F 40 00 5E 43 40 00
46 D9 42 00 59 70 40 00 5E 43 40 00 49 74 57 00 39 9B 57 00 FD 20 58 00 8E D0 57 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 14 00 00 00 00 00 00 00 26 39 C6 81 4C D8 42 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 D9 C6 39 7E 00 00 00 00 80 F6 DB 7E 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00
8F F4 06 00 86 30 40 00 97 3F 40 00 59 70 40 00 5E 43 40 00 D9 50 57 00 9B 70 40 00 DC 6F 40 00
56 9B 57 00 FD 20 58 00 8E D0 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Ä s W . . . . . . . @ . p . Ü ~ s W . § . < ~ . . . . € ö Û ~
. . . . . . . . ÿ ÿ ÿ ÿ . . . . Ž ô . . † 0 @ . — ? @ . ^ C @ .
F Ù B . Y p @ . ^ C @ . I t W . 9 › W . ý X . Ž Ð W . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . & 9 Æ L Ø B . . . . . . . . . . . . .
. . . . Ù Æ 9 ~ . . . . € ö Û ~ . . . . . . . . ÿ ÿ ÿ ÿ . . . .
ô . . † 0 @ . — ? @ . Y p @ . ^ C @ . Ù P W . › p @ . Ü o @ .
V › W . ý X . Ž Ð W . . . . . . . . . . . . . . . . . . . . .

...
  Mit Zitat antworten Zitat
Benutzerbild von Bernhard Geyer
Bernhard Geyer
Online

Registriert seit: 13. Aug 2002
17.171 Beiträge
 
Delphi 10.4 Sydney
 
#17

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 11:31
Zitat von bl3nder:
Hmm wie genau soll ich bitte sowas verstehen ?
TD32-Debuginfos aktivieren und projekt erzeugen. Compilieren aktualisiert nur geänderte Units.
Windows Vista - Eine neue Erfahrung in Fehlern.
  Mit Zitat antworten Zitat
bl3nder

Registriert seit: 18. Aug 2006
89 Beiträge
 
#18

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 11:42
Beim Erzeugen wird keine Logdatei erstellt
  Mit Zitat antworten Zitat
Benutzerbild von Bernhard Geyer
Bernhard Geyer
Online

Registriert seit: 13. Aug 2002
17.171 Beiträge
 
Delphi 10.4 Sydney
 
#19

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 12:29
Du mußt das Projekt erzeugen damit wirklich für jede Unit TD32-Debuginfos vorhanden sind und du statt Speicheradressen Funktions/Methodennamen bekommst.
Windows Vista - Eine neue Erfahrung in Fehlern.
  Mit Zitat antworten Zitat
bl3nder

Registriert seit: 18. Aug 2006
89 Beiträge
 
#20

Re: Zeos Query - too many connections

  Alt 19. Aug 2008, 12:57
Hmm wenn ich das Projekte erzeuge dann bekomme ich aber kein neues LOG file, welches ich ja parallel zur .exe finden muesste.

Sry aber ka was ich falsch mache
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 3     12 3      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:44 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz