Subject Re: IBOQuery doesn't work when parentheses are present
Author mspencewasunavailable
Here's some additional information:

Here's the IBOMonitor output for the aforementioned query, without
parentheses and with them. AFAICT, it seems that the query is
actually working in both cases because the first row is fetched, but
when the parens are present IBO thinks that the query found no rows.


Works================================================================
=====================
28 Dec 2006 11:05:47:563 [ INFO] /*---
PREPARE STATEMENT
TR_HANDLE = 22
STMT_HANDLE = 85

select C."Last Name", C.ID,
A."Invoice #", A."Date", A."Total", A."Tax",
A."Paid", A."Paid" * A."Tax" /
A."Total" as "Tax Received"
from CUST C, ARINV A where C.ID = A."Acc ID" and A."Invoice #"
<> '' and A."Date" between ? /* sdate */ and ? /* edate */
ORDER BY A."Date" ASC
, A."Invoice #" ASC

PLAN SORT (JOIN (A NATURAL, C
INDEX (PK_Cust)))

FIELDS = [ Version 1 SQLd 8 SQLn
64
CUST."Last Name" = <NIL>
CUST.ID = <NIL>
ARINV."Invoice #" = <NIL>
ARINV.DATE = <NIL>
ARINV.TOTAL = <NIL>
ARINV.TAX = <NIL>
ARINV.PAID = <NIL>
["Tax Received"] = <NIL> ]
----*/
28 Dec 2006 11:05:47:563 [ INFO] /*===
//>>> STATEMENT PREPARED <<<//
TIB_Statement.API_Prepare()
TIBOInternalDataset: "" stHandle=85
====*/
28 Dec 2006 11:05:47:595 [ INFO] /*---
EXECUTE STATEMENT
TR_HANDLE = 22
STMT_HANDLE = 85
PARAMS = [ Version 1 SQLd 2 SQLn 2
[SDATE] = '01 Jan 2006'
[EDATE] = '28 Dec 2006' ]
----*/
28 Dec 2006 11:05:47:595 [ INFO] /*---
FETCH
STMT_HANDLE = 85
FIELDS = [ Version 1 SQLd 8 SQLn 8
CUST."Last Name" = 'Abrams'
CUST.ID = 7
ARINV."Invoice #" = '1002'
ARINV.DATE = '04 Apr 2006'
ARINV.TOTAL = 320.44
ARINV.TAX = 25.44
ARINV.PAID = 320.44
["Tax Received"] = 25.44 ]
----*/
28 Dec 2006 11:05:47:610 [ INFO] /*---
PREPARE STATEMENT
TR_HANDLE = 22
STMT_HANDLE = 86

SELECT COUNT( * )
from CUST C, ARINV A where C.ID =
A."Acc ID" and A."Invoice #" <> '' and A."Date" between ? /*
sdate */ and ? /* edate */
PLAN JOIN (A NATURAL, C INDEX
(PK_Cust))

FIELDS = [ Version 1 SQLd 1 SQLn 1
COUNT = -1 ]
----*/
28 Dec 2006 11:05:47:610 [ INFO] /*===
//>>> STATEMENT PREPARED <<<//
TIB_Statement.ISC_ExecImmed2()
TIBOInternalDataset: ""
stHandle=86 #EI
====*/
28 Dec 2006 11:05:47:610 [ INFO] /*---
EXECUTE2 DSQL
TR_HANDLE = 22
STMT_HANDLE = 86
PARAMS = [ Version 1 SQLd 2 SQLn 2
[SDATE] = '01 Jan 2006'
[EDATE] = '28 Dec 2006' ]
FIELDS = [ Version 1 SQLd 1 SQLn 1
COUNT = 25 ]

SELECT COUNT: 1
----*/


Doesn't
work=================================================================
==============

28 Dec 2006 11:04:22:226 [ INFO] /*---
PREPARE STATEMENT
TR_HANDLE = 22
STMT_HANDLE = 85

select C."Last Name", C.ID,
A."Invoice #", A."Date", A."Total", A."Tax",
A."Paid", (A."Paid") * A."Tax" /
A."Total" as "Tax Received"
from CUST C, ARINV A where C.ID = A."Acc ID" and A."Invoice #"
<> '' and A."Date" between ? /* sdate */ and ? /* edate */
ORDER BY A."Date" ASC
, A."Invoice #" ASC

PLAN SORT (JOIN (A NATURAL, C
INDEX (PK_Cust)))

FIELDS = [ Version 1 SQLd 8 SQLn
64
CUST."Last Name" = <NIL>
CUST.ID = <NIL>
ARINV."Invoice #" = <NIL>
ARINV.DATE = <NIL>
ARINV.TOTAL = <NIL>
ARINV.TAX = <NIL>
ARINV.PAID = <NIL>
["Tax Received"] = <NIL> ]
----*/
28 Dec 2006 11:04:22:226 [ INFO] /*===
//>>> STATEMENT PREPARED <<<//
TIB_Statement.API_Prepare()
TIBOInternalDataset: "" stHandle=85
====*/
28 Dec 2006 11:04:22:258 [ INFO] /*---
EXECUTE STATEMENT
TR_HANDLE = 22
STMT_HANDLE = 85
PARAMS = [ Version 1 SQLd 2 SQLn 2
[SDATE] = '01 Jan 2006'
[EDATE] = '28 Dec 2006' ]
----*/
28 Dec 2006 11:04:22:273 [ INFO] /*---
FETCH
STMT_HANDLE = 85
FIELDS = [ Version 1 SQLd 8 SQLn 8
CUST."Last Name" = 'Abrams'
CUST.ID = 7
ARINV."Invoice #" = '1002'
ARINV.DATE = '04 Apr 2006'
ARINV.TOTAL = 320.44
ARINV.TAX = 25.44
ARINV.PAID = 320.44
["Tax Received"] = 25.44 ]

SECONDS = 0.016
----*/


Michael D. Spence
Mockingbird Data Systems, Inc.