Subject Re: [IBO] IBOQuery and Refresh
Author Petr Hartman
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:
> 1. Put a monitor on your application and see what exact values are
> being passed for each one, using your query as it stands.

There is a monitor output after I call IBOQuery1.Refresh:

/*---
EXECUTE STATEMENT
TR_HANDLE = 3830508
STMT_HANDLE = 3830660
PARAMS = [ Version 1 SQLd 2 SQLn 2
[TYP] = 2
[DATUM] = '12 IX 2007' ]
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 3830508
STMT_HANDLE = 3830320

select
ID,
ZKR,
DATUM,
(select NAZ from TAB2 where ID = TAB1.ID and TYP = ? /* TYP */ ) as
NAZ
from TAB1
WHERE TAB1.ID=? /* BIND_0 */

PLAN (TAB2 INDEX (PK_TAB2))
PLAN (TAB1 INDEX (PK_TAB1))

FIELDS = [ Version 1 SQLd 4 SQLn 4
TAB1.ID = <n> 0
TAB1.ZKR = <NULL>
TAB1.DATUM = <NULL>
[NAZ] = <NULL> ]
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 3830508
STMT_HANDLE = 3830076

SELECT TAB1.ID
from TAB1
WHERE TAB1.ID=?
AND DATUM = ? /* DATUM */

PLAN (TAB1 INDEX (PK_TAB1))

FIELDS = [ Version 1 SQLd 1 SQLn 1
TAB1.ID = 1 ]
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 3830508
STMT_HANDLE = 3830076
PARAMS = [ Version 1 SQLd 2 SQLn 2
TAB1.ID = 1
[TYP] = 2 ]

ERRCODE = 335544569
----*/
/*---
INTERPRET BUFFER =
ERRCODE = 17
----*/
/*---
INTERPRET BUFFER = Dynamic SQL Error
ERRCODE = 21
----*/
/*---
INTERPRET BUFFER = SQL error code = -303
ERRCODE = 32
----*/
/*---
INTERPRET BUFFER = conversion error from string "2"
ERRCODE = -1
----*/

Note, that the statement with STMT_HANDLE = 3830076 has params
TAB1.ID and DATUM (in Prepare phase} and it receives params TAB1.ID
and TYP (in Execute phase).

> 2. Change this parameter assignment:
>
> IBOQuery1.ParamByName('DATUM').asDateTime := StrToDate('1.1.2007');
>
> to (first test):
>
> a) IBOQuery1.ParamByName('DATUM').asDateTime := StrToDate
('1/1/2007');

It doesn't work, because I have set DateSeparator to '.', not to '/'

> b) (second test):
>
> IBOQuery1.ParamByName('DATUM').AsRawString := '''1.1.2007''';

It doesn't work, because ParamByName is TParam, not TIB_Column. There
is no property AsRawString. I tried also
IBOQuery1.ParamByName('DATUM').AsDateTime := Date;
without success.

Thanks
Petr