Icon View Incident Report

Serious Serious
Reported By: Bruno Riviere
Reported On: 7/26/2012
For: Version 2.09 Build 1
# 3611 SQL Aggregate Calculations Can Differ Between EXEs and DLLs

I have create a main program with only one query. The result of this query is good and my table "MAJ_Prix" contain all the
records with the avergage.

I do the same thing with a dll and there is a problem, only the average of the first record of the table is calculate.

  Try
    with EDBQuery1 do
    begin
      DatabaseName := EDBDatabase1.DatabaseName;
      SQL.Text := 'SELECT * FROM Information.Tables WHERE Name =
'+Engine.QuotedSQLStr('MAJ_Prix');
      open;
      if RecordCount > 0 then
      begin
        close;
        SQL.Text := 'DROP TABLE "MAJ_Prix"';
        ExecSQL;
      end
      else close;

      SQL.Clear;
      SQL.Add('CREATE TABLE "MAJ_Prix" (');
      SQL.Add('"Code" VARCHAR(12) COLLATE "UNI",');
      SQL.Add('"Libelle" VARCHAR(130) COLLATE "UNI",');
      SQL.Add('"Unite" VARCHAR(3) COLLATE "UNI",');
      SQL.Add('"Mo_Min" DECIMAL(19,2),');
      SQL.Add('"Mo_Max" DECIMAL(19,2),');
      SQL.Add('"Mo_Moy" DECIMAL(19,2),');
      SQL.Add('"Mo" DECIMAL(19,2),');
      SQL.Add('"Mo_MAJ" BOOLEAN,');
      SQL.Add('"Mo_Etat" SMALLINT,');
      SQL.Add('"Mo_Pav" SMALLINT,');
      SQL.Add('"Mat_Min" DECIMAL(19,2),');
      SQL.Add('"Mat_Max" DECIMAL(19,2),');
      SQL.Add('"Mat_Moy" DECIMAL(19,2),');
      SQL.Add('"Mat" DECIMAL(19,2),');
      SQL.Add('"Mat_MAJ" BOOLEAN,');
      SQL.Add('"Mat_Etat" SMALLINT,');
      SQL.Add('"Mat_Pav" SMALLINT,');
      SQL.Add('"Perso" BOOLEAN,');
      SQL.Add('CONSTRAINT "PrimaryKey" PRIMARY KEY ("Code"))');
      SQL.Add('VERSION 1.00');
      SQL.Add('READWRITE');
      SQL.Add('UNENCRYPTED');
      SQL.Add('INDEX PAGE SIZE 8192');
      SQL.Add('BLOB BLOCK SIZE 1024');
      SQL.Add('PUBLISH BLOCK SIZE 1024');
      SQL.Add('PUBLISH COMPRESSION 0');
      SQL.Add('MAX ROW BUFFER SIZE 32768');
      SQL.Add('MAX INDEX BUFFER SIZE 65536');
      SQL.Add('MAX BLOB BUFFER SIZE 32768');
      SQL.Add('MAX PUBLISH BUFFER SIZE 32768');
      ExecSQL;
    end;
  Except
  End;

  Try
    with EDBQuery1 do
    begin
      SQL.Clear;
      SQL.Add('INSERT INTO Maj_Prix(Code,Libelle,Unite,Mo_Moy)');
      SQL.Add('SELECT Ouvrages.O_CODE, Ouvrages.O_LIBELLE, Ouvrages.O_UNITE,
AVG(Prixentrepreneur.Pose)');
      SQL.Add('FROM Prixentrepreneur');
      SQL.Add('INNER JOIN Ouvrages');
      SQL.Add('ON  (Ouvrages.O_CODE = Prixentrepreneur.O_CODE)');
      SQL.Add('GROUP BY O_CODE');
      ExecSQL;
    end;
  Except
  End;



Comments Comments
The problem turned out to be an uninitialized Boolean variable. So, depending upon the active memory contents, the compiled code, etc. there was a 50-50 chance that it would behave one way or the other. Normally it was behaving as False (the desired value), but when it went badly and the bug appeared, it was behaving like it was True.


Resolution Resolution
Fixed Problem on 8/3/2012 in version 2.10 build 1


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image