[Select] Empty reader or NULL?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Select] Empty reader or NULL?

Mateusz Loskot
Hi,

I'd like to ask about semantic details of FdoISelect::Execute()
operation, especially in DBMS provider.

For instance, if a feature class is directly mapped to table in a database.
Let's imagine the code below is called by a client:


// Connection is Open
FdoPtr<FdoIConnection> conn;

FdoPtr<FdoISelect> cmd;
cmd = static_cast<FdoISelect*>(
    conn->CreateCommand(FdoCommandType_Select));
assert(0 != cmd);

// NOTE: Querying non-existing class
cmd->SetFeatureClassName(L"non-existing-feature-class-name");

// XXX - What Execute() is supposed to return here?
FdoPtr<FdoIFeatureReader> reader = cmd->Execute();


My question is as in line marked with XXX:
If a client queries for a feature class that does not
exist (a non-existing table), what the Execute() operation is supposed
to return?

Is it safe to return NULL pointer to a reader?

Or it should return a kind of empty (terminating) reader, however here I
have no idea how to achieve this kind of feature.

Or an exception is thrown from Execute()?

Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals
Reply | Threaded
Open this post in threaded view
|

RE: [Select] Empty reader or NULL?

Greg Boone
In this specific case, I would image that an exception would be thrown
stating that 'class non-existing-feature-class-name does not exist'.

In other cases, where no valid data is available for return, but an
exception is not warranted, I would recommend not returning NULL. I
recommend returning an instantiated Reader. When the user calls
ReadNext(), it will return false.

Greg

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Mateusz
Loskot
Sent: Monday, March 19, 2007 8:43 PM
To: fdo-internals
Subject: [fdo-internals] [Select] Empty reader or NULL?

Hi,

I'd like to ask about semantic details of FdoISelect::Execute()
operation, especially in DBMS provider.

For instance, if a feature class is directly mapped to table in a
database.
Let's imagine the code below is called by a client:


// Connection is Open
FdoPtr<FdoIConnection> conn;

FdoPtr<FdoISelect> cmd;
cmd = static_cast<FdoISelect*>(
    conn->CreateCommand(FdoCommandType_Select));
assert(0 != cmd);

// NOTE: Querying non-existing class
cmd->SetFeatureClassName(L"non-existing-feature-class-name");

// XXX - What Execute() is supposed to return here?
FdoPtr<FdoIFeatureReader> reader = cmd->Execute();


My question is as in line marked with XXX:
If a client queries for a feature class that does not
exist (a non-existing table), what the Execute() operation is supposed
to return?

Is it safe to return NULL pointer to a reader?

Or it should return a kind of empty (terminating) reader, however here I
have no idea how to achieve this kind of feature.

Or an exception is thrown from Execute()?

Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals

_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals
Reply | Threaded
Open this post in threaded view
|

RE: [Select] Empty reader or NULL?

Traian Stanev
RE: [fdo-internals] [Select] Empty reader or NULL?
I 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.
 
Traian
-----Original Message-----
From: [hidden email] on behalf of Greg Boone
Sent: Mon 3/19/2007 10:07 PM
To: FDO Internals Mail List
Cc:
Subject: RE: [fdo-internals] [Select] Empty reader or NULL?

In this specific case, I would image that an exception would be thrown
stating that 'class non-existing-feature-class-name does not exist'.

In other cases, where no valid data is available for return, but an
exception is not warranted, I would recommend not returning NULL. I
recommend returning an instantiated Reader. When the user calls
ReadNext(), it will return false.

Greg

-----Original Message-----
From: [hidden email]
[[hidden email]] On Behalf Of Mateusz
Loskot
Sent: Monday, March 19, 2007 8:43 PM
To: fdo-internals
Subject: [fdo-internals] [Select] Empty reader or NULL?

Hi,

I'd like to ask about semantic details of FdoISelect::Execute()
operation, especially in DBMS provider.

For instance, if a feature class is directly mapped to table in a
database.
Let's imagine the code below is called by a client:


// Connection is Open
FdoPtr<FdoIConnection> conn;

FdoPtr<FdoISelect> cmd;
cmd = static_cast<FdoISelect*>(
    conn->CreateCommand(FdoCommandType_Select));
assert(0 != cmd);

// NOTE: Querying non-existing class
cmd->SetFeatureClassName(L"non-existing-feature-class-name");

// XXX - What Execute() is supposed to return here?
FdoPtr<FdoIFeatureReader> reader = cmd->Execute();


My question is as in line marked with XXX:
If a client queries for a feature class that does not
exist (a non-existing table), what the Execute() operation is supposed
to return?

Is it safe to return NULL pointer to a reader?

Or it should return a kind of empty (terminating) reader, however here I
have no idea how to achieve this kind of feature.

Or an exception is thrown from Execute()?

Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals

_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals


_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals
Reply | Threaded
Open this post in threaded view
|

Re: [Select] Empty reader or NULL?

Mateusz Loskot
Traian Stanev wrote:
> I 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.

Greg, Traian,

Thanks for these hints.
I will go with exceptions.

Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
_______________________________________________
fdo-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-internals