AutoRefresh doesn't works as expected

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

AutoRefresh doesn't works as expected

Post by swierzbicki » Mon 15 Dec 2008 09:20

Hi,

When setting autorefresh to true, MyDAC generate a "bad" sql statement.
Here is the SQL Statement (TMyQuery.SQL) :

Code: Select all

Select distinct
planning.*,
affaires.IdTypeCommande,
affaires.poseht,
vrp.idagence,
vrp.iddepot,
ecrituresouvertes.MontantOuvertTTC,
receptionmarchandise.DateReception
from
  planning
  LEFT OUTER JOIN ecrituresouvertes on (ecrituresouvertes.idaffairefe2000 = planning.idaffairefe2000 and ecrituresouvertes.typeDocument  '')
  LEFT OUTER JOIN receptionmarchandise on (receptionmarchandise.idaffairefe2000 = planning.idaffairefe2000)
  INNER JOIN clientssia on (clientssia.idclientsia = planning.idclientsia)
  INNER JOIN `vrp` ON (`clientssia`.`IdVRP` = `vrp`.`IdVRP`)
  INNER JOIN perimetressia ON (vrp.idAgence like perimetressia.IdAgence And perimetressia.Utilisateur like :prUtilisateur)
  LEFT OUTER JOIN planningintervenants ON (planning.IdPlanning = planningintervenants.IdPlanning)
--  LEFT OUTER JOIN matricule ON (planningintervenants.IdMatricule = matricule.IdMatricule)
--  LEFT OUTER JOIN soustraitants ON (planningintervenants.idSoustraitant = soustraitants.idSoustraitant)
  LEFT OUTER JOIN affaires on (affaires.idaffairefe2000 = planning.idaffairefe2000)
Where
fin >= Date_Sub(curdate(), Interval 2 month)
and
( planning.IdIntervention  0 and planning.idStadePlanning  0)
and ( affaires.edi = 0 )

When autorefresh is set to true, MyDac generate this SQL Statement :

Code: Select all

SELECT IdPlanning FROM planning WHERE 
fin >= Date_Sub(curdate(), Interval 2 month)
and
( planning.IdIntervention  0 and planning.idStadePlanning  0)
and ( affaires.edi = 0 ) ORDER BY IdPlanning
I'm getting an error because query isn't correct

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 16 Dec 2008 12:16

I can not reproduce the problem.
TMyQuery on refreshing executes the same SQL query as on opening.
Please send me a complete small sample at dmitryg*devart*com to demonstrate the problem, including a script to create and fill table.

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Tue 16 Dec 2008 15:30

Allright, I'll send you a demo project

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 19 Dec 2008 14:12

I did not get your e-mail. If you already have sent a demo, please send it again.

Post Reply