In a query such as:
SELECT
E.id as s_id,
S.name as s_name,
E.date as s_date,
E.cash as s_cash,
FROM
salelogs E, stores S
WHERE
(E.s_id=$P{storeID} OR $P{storeID} <= 0)
AND E.s_date BETWEEN $P{date_begin} AND $P{date_end}
AND E.s_id=S.store_id
ORDER BY E.id, E.date
the parameter date_begin is replaced to
SELECT
E.id as s_id,
S.name as s_name,
E.date as s_date,
E.cash as s_cash,
FROM
salelogs E, stores S
WHERE
(E.s_id=1 OR 1 <= 0)
AND E.s_date BETWEEN 2006-01-01 AND 2007-01-01
AND E.s_id=S.store_id
ORDER BY E.id, E.date
which fails ( MSSQL Server thru QODBC driver ).
I would suggest taking an QVariant as the value instead in NCReport::addParameter and use Qt's named bindings so Qt will do the quotes on the fields automagically.
Also, please consider changing the order of parameters in the method, value before name is VERY awkward.
Logged In: YES
user_id=1271256
Originator: NO
Is better to put quotes into sql query IMHO, because of compatibility and consistency.
It's part of sql syntax.
(AND E.s_date BETWEEN '$P{date_begin}' AND '$P{date_end}')
Logged In: YES
user_id=1271256
Originator: NO
I may add later a new addParameter methud using QVariant and a new _evalParameter() method.