Forum
× Components and Libraries for Database Development, discussions, problems and suggestions

Question 'External: SIGSEGV'. Zeos DB

  • Randall
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 month 2 days ago #13155 by Randall
'External: SIGSEGV'. Zeos DB was created by Randall
this is the code fragment that I have
ZSPCostosCombustible.Params.ParamByName('AUX_DESDE').AsDate:=DateTimePicker1.Date;
ZSPCostosCombustible.Params.ParamByName('AUX_HASTA').AsDate:=DateTimePicker2.Date;
ZSPCostosCombustible.Params.ParamByName('ACTIVO_DESDE').AsString:=MaskEdit1.Text;
ZSPCostosCombustible.Params.ParamByName('ACTIVO_HASTA').AsString:=MaskEdit2.Text;
ZSPCostosCombustible.Open;

this is the exception
Error: El proyecto Gesagric 2018 ha lanzado una excepci├│n de la clase 'External: SIGSEGV'.

En archivo '.\source\parsesql\ZGenericSqlAnalyser.pas' en linea 357:
if (Tokens[i].P^ = '(') and (Tokens[i].L = 1) then

It contains a Mysql stored procedure that is called: RPT_COSTOS_CONSUMOS_COMBUSTIBLE
and the sentence is:
BEGIN
if AUX_TIPO_RPT = 'Hist x Dates' then
select
ecc.date as Date,
dcc.idplaca as 'Id Active',
concat (ifnull (ati.marca, ''), '', ifnull (ati.modelo, ''), '', ifnull (ati.serie, '')) as Descripcion,
concat (dcc.idarticulo, '-', art.descripcion) as 'Articulo',
dcc.litros as Liters,
dcc.horim_kilom as 'Hr / Km'
from enc_consumo_combustible as ecc
inner join det_consumo_combustible as dcc
on ecc.idboleta = dcc.idboleta
inner join activosti as ati
on ati.idplaca = dcc.idplaca
inner join articles as art
on art.idarticulo = dcc.idarticulo
where ecc.date between AUX_DESDE and AUX_HASTA
order by dcc.idarticulo, ecc.fecha, dcc.idplaca;
else
if AUX_TIPO_RPT = 'Hist x Dates x Assets' then
select
ecc.date as Date,
dcc.idplaca as 'Id Active',
concat (ifnull (ati.marca, ''), '', ifnull (ati.modelo, ''), '', ifnull (ati.serie, '')) as Descripcion,
concat (dcc.idarticulo, '-', art.descripcion) as 'Articulo',
dcc.litros as Liters,
dcc.horim_kilom as 'Hr / Km'
from enc_consumo_combustible as ecc
inner join det_consumo_combustible as dcc
on ecc.idboleta = dcc.idboleta
inner join activosti as ati
on ati.idplaca = dcc.idplaca
inner join articles as art
on art.idarticulo = dcc.idarticulo
where ecc.date between AUX_DESDE and AUX_HASTA
and dcc.idplaca between ACTIVO_DEZDE and ACTIVO_HASTA
order by dcc.idplaca, ecc.date, dcc.horim_kilom;
end if;
end if;
END

the exception occurs in these lines of the ZGenericSqlAnalyser.pas
if not FoundSection and (TokenIndex < Tokens.Count) then begin
      BracketCount := 0;
      repeat
        Elements.Add(Tokens[TokenIndex]^);
        if (Tokens[i].P^ = '(') and (Tokens[i].L = 1) then
          Inc(BracketCount)
        else if (Tokens[i].P^ = ')') and (Tokens[i].L = 1) then
          Dec(BracketCount);
        Inc(TokenIndex);
      until (BracketCount <= 0) or (TokenIndex >= Tokens.Count);
    end;

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
1 month 2 days ago #13156 by Sternas Stefanos
Replied by Sternas Stefanos on topic 'External: SIGSEGV'. Zeos DB
My suggestion
is to post a project with the problem

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Randall
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 month 2 days ago - 1 month 2 days ago #13157 by Randall
Replied by Randall on topic 'External: SIGSEGV'. Zeos DB
In the ZGenericSqlAnalyser.pas unit, the function
function TZGenericStatementAnalyser.SplitSections ({$ IFDEF AUTOREFCOUNT} const {$ ENDIF} Tokens: TZTokenList): TObjectList;

must be replaced with this section of code, it is already tested and works correctly, corrects the problem
function TZGenericStatementAnalyser.SplitSections({$IFDEF AUTOREFCOUNT}const{$ENDIF}
  Tokens: TZTokenList): TObjectList;
var
  I: Integer;
  Keyword: string;
  WordCount: Integer;
  TokenIndex: Integer;
  Elements: TZTokenList;
  FoundSection: Boolean;
  BracketCount: Integer;
begin
  Result := TObjectList.Create;
  TokenIndex := 0;
  FoundSection := True;
  Elements := nil;
  CheckForKeyword(Tokens, TokenIndex, SectionNames, Keyword{%H-}, WordCount{%H-});

  while TokenIndex < Tokens.Count do begin
    if FoundSection then begin
      Elements := TZTokenList.Create;
      for I := 0 to WordCount - 1 do
        Elements.Add(Tokens[TokenIndex + I]^);
      Inc(TokenIndex, WordCount);
      Result.Add(TZStatementSection.Create(Keyword, Elements));
    end;
    FoundSection := CheckForKeyword(Tokens, TokenIndex, SectionNames,
      Keyword, WordCount);
    if not FoundSection and (TokenIndex < Tokens.Count) then begin
      BracketCount := 0;
      repeat
        Elements.Add(Tokens[TokenIndex]^);
        if (Tokens[TokenIndex].L = 1) then
          if (Tokens[TokenIndex].P^ = '(') then
            Inc(BracketCount)
          else if (Tokens[TokenIndex].P^ = ')') then
            Dec(BracketCount);
        Inc(TokenIndex);
      until (BracketCount <= 0) or (TokenIndex >= Tokens.Count);
    end;
  end;
end;
Last edit: 1 month 2 days ago by Randall.
The following user(s) said Thank You: universe

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
1 month 2 days ago #13158 by Sternas Stefanos
Replied by Sternas Stefanos on topic 'External: SIGSEGV'. Zeos DB
Done, in LAB CT 6.80

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Randall
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 month 2 days ago #13159 by Randall
Replied by Randall on topic 'External: SIGSEGV'. Zeos DB
excellent, trying a little I managed to find the solution

Please Log in or Create an account to join the conversation.