|Subject||RE: Fwd: TIBOQuery.RecordCount and complex unions|
Just a guess is that IBO tries to get rid of all the fields (select) and maintaing the logics (from, where) when it creates the SQL for the accurate count. Drop a TIB_Monitor (theres a version with a dialog prepared for you) and look at what happens before the error.
The you can probably deduce what throws off the IBO parser and notify Jason. Regarding joins and SQL manipulation, also check all KeyLink, JoiningLinks et. al.
---In IBObjects@yahoogroups.com, <lcampbell@...> wrote:
-------- Original Message --------
Subject: TIBOQuery.RecordCount and complex unions Date: Tue, 19 Nov 2013 09:31:38 -0800 From: lcampbell <lcampbell@...> To: IBO Support List <supportlist@...>
I have a TIBOQuery object in a Delphi program whose SQL is a fairly complex three-way union, using the "union all" option to capture all records. By default, TIBOQuery objects appear with their RecordCountAccurate property set to true. When I test this query in Database Workbench, it opens and returns the records it shouldl; when I put it into the TIBOQuery and Activate it in the Delphi IDE, no problem. At run time (based on watching it in Debug) the query opens and gets results just fine -- but calling RecordCount on it throws an "unexpected end of command" ISC Error. If I set RecordCountAccurate to False, no problem. (The RecordCount test was for RecordCount= 0, which still works as expected when there's an empty resultset.) So -- is this a bug, or a feature? Is there some incompatibility between RecordCountAccurate, the RecordCount method, and complex union SQLs? Just seeking understanding ... Thanks, Lane Campbell NW Software