This is a bug notification... I managed to re-create the "segmentation
fault" bug.
The service was crashing without giving any output and any reason, the
problem was in the NUMBER of the parameters in the result set fetched in
the select:
10.
Fetching less parameters (9), all works. You can add and remove any kind
of parameter, not one in particular to force the crash.
The query is perfectly working both via ssh and graphical clients, even
on localhost.
A strange thing is that if I set parseSQL to true, I get a mysql syntax
error before the crash of the application:
Check the manual that corresponds to your MySQL server version for the
right syntax to use near 'GROUP BY i.pk_iscrizione, i.n_ingressi,
t.nome, a.nome, a.tipo_
So I'm guessing who parses the sql... if the mysql (as it should be) or
the component, cause there is no reason to have a sql syntax error from
a query that works perfectly via shell and gui.
As you can see from the query, there are no strange (italian) characters
in it.
I tryed also to concat two fields that I need concatenated in the code
(first name and last name (nome e cognome)) to make 9 fields fit me,
with no success.
So the problem seems to be not the number of parameters i fetch in the
query, but the number of parameters i fetch in the code via
"sqlquery.fieldbyname('field').asstring"
Also, a strange fact is that the crash happens the SECOND time I do the
query and not the first one... but I can also do it one time and then
crash the program with a second "whathever query", so I suppose that the
first time I do the query the connection or the transaction are "bugged"
and the problem appear the second time I use them.
This is the crashing query, commenting any of the fields of the first
rows (so reducing the number (10) of the fetched fields) and commenting
the fetching I do in the second part of the code makes it work perfectly:
SqlQuery.SQL.Text := 'SELECT i.pk_iscrizione, i.n_ingressi, ' +
't.nome as nome_turno, '+
'a.nome as nome_attivita,
a.tipo_gestione_ingressi, a.flag_permetti_ingressi_multipli, '+
'area.pk_area_impianto, '+
//'an.cognome as cognome_anagrafica,
an.nome as nome_anagrafica, '+
//'concat(an.cognome, '' '', an.nome) as
nome_anagrafica, '+
'an.nome as nome_anagrafica, '+
'MAX(ing.pk_ingresso) as last_ingresso '+
'FROM ISCRIZIONI i '+
'INNER JOIN CORSI c ON ((i.pk_corso =
c.pk_corso) and '+
'(c.data_inizio <=
CURDATE()) and '+
'(c.data_fine >=
CURDATE())) '+
'INNER JOIN TURNI t ON c.pk_turno =
t.pk_turno '+
'INNER JOIN ORARI o ON ((o.pk_turno =
t.pk_turno) and '+
'(o.giorno =
WEEKDAY(CURDATE()) + 1) and '+
'(
TIME_TO_SEC(o.dalle_ore) - 60 * GREATEST(a.anticipo_ingresso,
an.anticipo_ingresso) <= TIME_TO_SEC(CURTIME()) ) and '+
'(
TIME_TO_SEC(o.alle_ore) >= TIME_TO_SEC(CURTIME()) )) '+
'INNER JOIN ATTIVITA a ON t.pk_attivita =
a.pk_attivita '+
'INNER JOIN AREE_IMPIANTO area ON
a.pk_area_impianto = area.pk_area_impianto '+
'INNER JOIN REL_DISP_AREE rda ON
area.pk_area_impianto '+
'INNER JOIN DISPOSITIVI disp ON
((rda.pk_dispositivo = disp.pk_dispositivo) and '+
'(disp.id_dispositivo = '+inttostr(self.Dispositivo_Id)+')) '+
'INNER JOIN ANAGRAFICA an ON
i.pk_anagrafica = an.pk_anagrafica '+
'LEFT JOIN INGRESSI ing ON
((i.pk_iscrizione = ing.pk_iscrizione) and '+
'(DAYOFYEAR(ing.data_e_ora) = DAYOFYEAR(CURDATE())) and '+
'(YEAR(ing.data_e_ora) = YEAR(CURDATE())) and '+
'(ing.verso =
1) ) '+
'WHERE (an.codice_tessera =
'''+self.passaggioGestito.id_tessera+''') '+
'AND (i.data_inizio <= CURDATE()) '+
'AND (i.data_scadenza >= CURDATE()) '+
'AND ((a.tipo_gestione_ingressi <> 2) OR
(i.n_ingressi > 0)) '+
'GROUP BY i.pk_iscrizione, i.n_ingressi, ' +
't.nome, '+
'a.nome, a.tipo_gestione_ingressi,
a.flag_permetti_ingressi_multipli, '+
'area.pk_area_impianto, '+
'an.cognome, an.nome '+
'ORDER BY a.tipo_gestione_ingressi ASC ';
I also tryed to change database (and component name) from mysql40 to
mysql50 but to do it I have to compile the application for linux 64
bits, and I'm still not able to make it work.
What can I do to check the mysql_client libraries I'm REALLY using?
When I place a "dot" after the mysql40connection I don't get anything,
also space+tabbing gives an error: "identifier not found:
tmysql40connection" so I can't look at that component properties.
Alvise
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives