Subject Re: [IBO] Problem-DSQL-with-singleton-select
Author Mihai Chezan
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 10:34 AM 18/08/2004 +0000, you wrote:
> SELECT, by design, returns 0-to-many rows in any situation except a
> scalar subquery. So, for a SELECT statement, you use a component
> designed to handle multiple rows, even if *you* know that the
> statement won't return any rows. The database engine doesn't know
> about it and the TIB_DSQL will complain about it. In my previous
> message I tried to explain to you how the bare TIB_Statement (of
> which TIB_DSQL is the implementation) handles input and output
> parameters. Singleton sets (one and only one row), aka return
> parameters, are the only "fields" that TIB_Statement knows about.
I understand but :)
If I create a SP I can use singleton selects that return 0 or 1 row.
eg:
select 1 from rdb$database where exists (select ...) INTO :v_ex;
IF (v_ex IS NULL) THEN
...the select returned an empty set
ELSE
...the select returned 1
From the pdf manual (LangRef.pdf) of Interbase
"The SELECT statement must return at most one row from the database,
like a standard singleton SELECT."
So I thought that if a standard singleton SELECT can return at most
one row and it works in SP then it should work in TIB_DSQL too.
So wouldn't be better if TIB_DSQL would trap the exception when there
is an empty set and return an empty set? That way it would work the
way it works in SP. Take this as a suggestion, a new feature for
TIB_DSQL.

> Your English seems fine to me; but your understanding of SQL
> concepts and Delphi component hierarchies seems to want some work.
> For better or worse, IBO's help text can't teach you the concepts of
> SQL or Delphi. It takes an 8.5 Mb helpfile just to document IBO's
> characteristics.
> FYI, because IBO implements the Firebird and InterBase API very
> thoroughly, it can be very useful to study the API Guide and
> understand what's actually going on down there. "Useful", I said,
> not "essential", since you seem like an intelligent person, albeit
> one who wants to run before he really
> knows how to walk...
>
> Helen
:)
I apologise for my 'rant'