Page 1 of 1

Assertion failure (MyClasses.pas, line 5864)

Posted: Thu 08 Oct 2009 11:24
by alphaflight83
Hi there, i am currently testing the UniDAC (3.0.0.2) components for Delphi 2009 and was really satisfied with it. But today i tried a MySQL query including UNION and ORDER BY.
The query runs perfectly in the MySQL query browser, so i think the problem comes with UniDAC.
The filepath displayed in the message makes no sense to me.

Assertion failure
(D:\Projects\Delphi\Dac\MySQL\Source\MyClasses.pas, line 5864)

The Query simplified looks like:

Code: Select all

(SELECT
  T1.ID AS Name,
  T1.Partial DIV 3600 AS Partial,
  T1.Total DIV 3600 AS Total,
  T2.Unit AS Unit
FROM Table1 AS T1, Table2 AS T2
WHERE T1.ID = T2.ID
  AND T2.Unit = 'hours')
UNION
(SELECT
  T1.ID AS Name,
  T1.Partial AS Partial,
  T1.Total AS Total,
  T2.Unit AS Unit
FROM Table1 AS T1, Table2 AS T2
WHERE T1.ID = T2.ID
  AND T2.Unit = '')
ORDER BY
  Name ASC
LIMIT 10000
It really seems, that the UNION causes the problem,
cause all other queries in the program work without problems,
including the two parts of the UNION for themselves.[/code]

Posted: Fri 09 Oct 2009 07:14
by alphaflight83
I posted the problem in the (german) Delphi-Praxis forum and got the following SQL, which works fine:

Code: Select all

SELECT 
  t1.id AS name, 
  CASE WHEN t2.unit = 'hours' 
    THEN t1.partial DIV 3600
    ELSE t1.partial
  END AS partial,
  CASE WHEN t2.unit = 'hours'
    THEN t1.total DIV 3600
    ELSE t1.total
  END AS total,
  t2.unit AS unit
FROM tabelle1 t1
  INNER JOIN tabelle2 t2 
  ON t1.id = t2.id
ORDER BY name 
LIMIT 10000
All other proposals with an UNION included led to the 'assertion failure'

Posted: Fri 09 Oct 2009 07:54
by Dimon
I can not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill table.
Also specify the exact version of MySQL server. You can see it in the Info sheet of TMyConnection Editor.