<HTML><HEAD><TITLE>RE: [fdo-internals] [Select] Empty reader or NULL?</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY dir=ltr>
<DIV>I&nbsp;verified SdfSelect and it throws a class-not-found exception if the class is not in the schema. So yes, an exception seems like the consistent thing to do.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Traian</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT size=2>-----Original Message----- <BR><B>From:</B> fdo-internals-bounces@lists.osgeo.org&nbsp;on behalf of&nbsp;Greg Boone <BR><B>Sent:</B> Mon 3/19/2007 10:07 PM <BR><B>To:</B> FDO Internals Mail List <BR><B>Cc:</B> <BR><B>Subject:</B> RE: [fdo-internals] [Select] Empty reader or NULL?<BR><BR></FONT></DIV>
<P><FONT size=2>In this specific case, I would image that an exception would be thrown<BR>stating that 'class non-existing-feature-class-name does not exist'.<BR><BR>In other cases, where no valid data is available for return, but an<BR>exception is not warranted, I would recommend not returning NULL. I<BR>recommend returning an instantiated Reader. When the user calls<BR>ReadNext(), it will return false.<BR><BR>Greg<BR><BR>-----Original Message-----<BR>From: fdo-internals-bounces@lists.osgeo.org<BR>[<A href="mailto:fdo-internals-bounces@lists.osgeo.org">mailto:fdo-internals-bounces@lists.osgeo.org</A>] On Behalf Of Mateusz<BR>Loskot<BR>Sent: Monday, March 19, 2007 8:43 PM<BR>To: fdo-internals<BR>Subject: [fdo-internals] [Select] Empty reader or NULL?<BR><BR>Hi,<BR><BR>I'd like to ask about semantic details of FdoISelect::Execute()<BR>operation, especially in DBMS provider.<BR><BR>For instance, if a feature class is directly mapped to table in a<BR>database.<BR>Let's imagine the code below is called by a client:<BR><BR><BR>// Connection is Open<BR>FdoPtr&lt;FdoIConnection&gt; conn;<BR><BR>FdoPtr&lt;FdoISelect&gt; cmd;<BR>cmd = static_cast&lt;FdoISelect*&gt;(<BR>&nbsp;&nbsp;&nbsp; conn-&gt;CreateCommand(FdoCommandType_Select));<BR>assert(0 != cmd);<BR><BR>// NOTE: Querying non-existing class<BR>cmd-&gt;SetFeatureClassName(L"non-existing-feature-class-name");<BR><BR>// XXX - What Execute() is supposed to return here?<BR>FdoPtr&lt;FdoIFeatureReader&gt; reader = cmd-&gt;Execute();<BR><BR><BR>My question is as in line marked with XXX:<BR>If a client queries for a feature class that does not<BR>exist (a non-existing table), what the Execute() operation is supposed<BR>to return?<BR><BR>Is it safe to return NULL pointer to a reader?<BR><BR>Or it should return a kind of empty (terminating) reader, however here I<BR>have no idea how to achieve this kind of feature.<BR><BR>Or an exception is thrown from Execute()?<BR><BR>Cheers<BR>--<BR>Mateusz Loskot<BR><A href="http://mateusz.loskot.net/">http://mateusz.loskot.net</A><BR>_______________________________________________<BR>fdo-internals mailing list<BR>fdo-internals@lists.osgeo.org<BR><A href="http://lists.osgeo.org/mailman/listinfo/fdo-internals">http://lists.osgeo.org/mailman/listinfo/fdo-internals</A><BR><BR>_______________________________________________<BR>fdo-internals mailing list<BR>fdo-internals@lists.osgeo.org<BR><A href="http://lists.osgeo.org/mailman/listinfo/fdo-internals">http://lists.osgeo.org/mailman/listinfo/fdo-internals</A><BR></FONT></P></BLOCKQUOTE></BODY></HTML>