[fdo-internals] Connection state and commands

Gavin Cramer gavin.cramer at autodesk.com
Tue Feb 20 14:35:04 EST 2007


I am not sure how many other providers don't support Pending or the
"DataStores" commands, but ODBC Provider lacks these.  It goes straight
from the Closed state to the Open state.  Since there is officially no
"server" or other target to set in ODBC, calling Open() to get to the
Pending state would not do much.

Instead, ODBC Provider just supports an enumerable connection property
called "DataSourceName", which can be accessed in the Closed state.

Some of ODBC Provider's unit tests (that talk to real servers) emulate
the Pending state in order to create test databases on-the-fly.
However, they do this by knowing server-specific details to put on the
ConnectionString property.  I.e. this does not work for connections via
DSN.  The actual connection state is Open (to the server) when creating
a test datastore, and the connection is closed before re-opening
directly to the intended datastore.

Gavin


-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org
[mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Greg Boone
Sent: Tuesday, February 20, 2007 2:14 PM
To: FDO Internals Mail List
Subject: RE: [fdo-internals] Connection state and commands

Se inline...

-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org
[mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Mateusz
Loskot
Sent: Friday, February 16, 2007 3:11 PM
To: fdo-internals
Subject: [fdo-internals] Connection state and commands

Hi,

Is there any general rule about what connection state is required
for what command or it is provider specific?

For example:

- FdoConnectionState_Open is required for commands like:

SQLCommand or Select Command
[GB] Yes. This is the rule.

- FdoConnectionState_Pending is a minimum requirement for commands like

ListDataStores
CreateDataStore
etc.
[GB] Yes, this is also the typically state at which point these commands
are run.

Now, is this assumed, across all FDO providers, that ListDataStores
or CreateDataStore will only work with connection of state open?
[GB] No. These commands should at  minimum be executable with a
connection state of pending

Perhaps, I a provider developer has liberty to set a requirement
that if connection is open to a particular datastore,
it's not possile to call commands operating on datastores:
CreateDataStore, DestroyDataStore, ListDataStores,
but pending connection is required?
[GB] You could do this, but that may be too restrictive. There may be
some unforeseen use case where a user would wish to execute these
commands which in an Open state. However, I would argue that we should
be consistent across all RDBMS providers and enforce a general rule. 

Similarly, if connection state == pending it shouldn't be possible to
create any commands other than operating on datastores.
[GB] Yes, typically only datastore commands should be available at this
time.


As I see in available providers, it's handled differently:
- one provider validates connection state before creating commands
- another doesn't check the state at all
[GB] I would argue that providers should always check their internal
state before creating commands. To do otherwise sounds like a defect. 

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

_______________________________________________
fdo-internals mailing list
fdo-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-internals



More information about the fdo-internals mailing list