Subject Re: [IBO] Unhandled Exception: Multiple rows in singleton fetch ...
Author Jason Wharton
There are a few possibilities. You are getting this error because there is
something in your application that needs to be revisited. I deliberately put
it in here because I don't want people thinking their apps are working
flawlessly when in fact they aren't. I know this is a bit harsh but it is
documented, in red, in the release notes.

Most commonly it has to do with improper usage of the KeyLinks or JoinLinks
properties. (The high hurdles and heart of IBO.)

By chance, are you using a joined dataset using the old syntax of:

SELECT ...
FROM TABLE1 T1, TABLE2 T2
WHERE T1.KEY = T2.KEY

If so, you are causing a problem for IBO. It doesn't know how to extract out
of the where clause the information which is really pertinent for the join,
instead of just plain record reduction.

Your solution is to do this:

SQL:
SELECT ...
FROM TABLE1 T1, TABLE2 T2

JoinLinks:
T1.KEY=T2.KEY

What this does is allow IBO to know this particular relationship is for the
join and not plain where clause material. At the time of preparing the
statement (sending it to the server) IBO parses it into the where clause for
you, as well as other internal statements it makes use of.

Another easy solution is to simply use the more SQL standards friendly
syntax style of:

SELECT ...
FROM TABLE1 T1
JOIN TABLE2 T2
ON T1.KEY = T2.KEY

This accomplishes the same thing. But keep in mind InterBase didn't optimize
this well until version 5.

Another potential problem is you do not have enough columns in the KeyLinks
property. The rule of thumb is, you need enough in there so that records *on
the server* can be uniquely identified. When doing an inner join, be sure to
include key columns from all tables being joined.

I hope this helps!!!

PS. Helen, this is definite FAQ material.

Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "dkLists" <dklists@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, December 05, 2001 2:10 PM
Subject: Re: [IBO] Unhandled Exception: Multiple rows in singleton fetch ...


> All -
>
> When I restart the cgi server, problem goes away. This has not
happened
> in over 14 months of operation of this CGI app. Any suggestions?
>
> Thanks.
>
> David Keith> I'm receiving the following error with an application that I
> finally got working last week. The code behind this app worked after I
fixed
> it... I don't know why it's having problems now.
> >
> > The way it works is that a CGIExpert app server processes requests for
> pages by pulling them out of an Interbase database. This includes
framesets,
> which appear to need to be delivered simultaneously in separate threads or
> socket connections, I'm not certain which.
> >
> > I had previously attempted this with IBExpress, but it failed to
> consistently retrieve the frames in order, and sometimes failed to fulfill
a
> frame request.
> >
> > The local thread technology written into IBO has worked flawlessly at
this
> task previously, I'm only now experiencing problems after updating to
v4.2.
> >
> > Any suggestions?
> >
> > Error text:
> >
> > Unhandled Exception: Multiple rows in singleton fetch Check KeyLinks and
> JoinLinks
> > properties SELECT ALL WEBDB.* FROM WEBDB WHERE WEBDB.SQLKEY=? /*
> > BIND_0 */
> >
> > ___________________________________
> > GreatLand Technology
> >
> > inquiries@...
> > ___________________________________
>
>
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>