OSGeo FDO Provider for ODBC API Reference

OSGeo FDO Provider for ODBC API

API Reference OSGeo FDO Provider for ODBC

SqlServerOvClassDefinition.h

Go to the documentation of this file.
00001 #ifndef FDO_SqlServerOVCLASSDEFINITION_H
00002 #define FDO_SqlServerOVCLASSDEFINITION_H
00003 /*
00004  * Copyright (C) 2004-2008  Autodesk, Inc.
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of version 2.1 of the GNU Lesser
00008  * General Public License as published by the Free Software Foundation.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  *
00019  */
00020 
00021 #include <Rdbms/Override/RdbmsOvClassDefinition.h>
00022 #include <Rdbms/Override/SQLServerSpatial/SqlServerOv.h>
00023 #include <Rdbms/Override/SQLServerSpatial/SqlServerOvDataPropertyDefinition.h>
00024 #include <Rdbms/Override/SQLServerSpatial/SqlServerOvGeometricPropertyDefinition.h>
00025 #include <Rdbms/Override/SQLServerSpatial/SqlServerOvObjectPropertyDefinition.h>
00026 #include <Rdbms/Override/SQLServerSpatial/SqlServerOvPropertyDefinitionCollection.h>
00027 #include <Rdbms/Override/SQLServerSpatial/SqlServerOvTable.h>
00028 #include <Rdbms/Override/SQLServerSpatial/SqlServerOvGeometricColumn.h>
00029 
00030 /// \brief
00031 /// Concrete class defining physical schema overrides for a class definition.
00032 class FdoSqlServerOvClassDefinition : public FdoRdbmsOvClassDefinition
00033 {
00034 
00035 public:
00036     /// \brief
00037     /// Constructs a default of an FdoSqlServerOvClassDefinition
00038     /// 
00039     /// \return
00040     /// Returns FdoSqlServerOvClassDefinition
00041     /// 
00042     FDOSQLSERVER_OV_API static FdoSqlServerOvClassDefinition* Create();
00043 
00044     /// \brief
00045     /// Constructs an instance of an FdoSqlServerOvClassDefinition using the specified arguments
00046     /// 
00047     /// \param name 
00048     /// Input name
00049     /// 
00050     /// \return
00051     /// Returns FdoSqlServerOvClassDefinition
00052     /// 
00053     FDOSQLSERVER_OV_API static FdoSqlServerOvClassDefinition* Create(FdoString* name);
00054 
00055     /// \brief
00056     /// Gets a collection of SqlServer property overrides
00057     /// 
00058     /// \return
00059     /// Returns the collection of SqlServer property overrides
00060     /// 
00061     FDOSQLSERVER_OV_API FdoSqlServerOvPropertyDefinitionCollection* GetProperties();
00062 
00063     /// \brief
00064     /// Gets the SqlServer table override for this class override
00065     /// 
00066     /// \return
00067     /// Returns FdoSqlServerOvTable
00068     /// 
00069     FDOSQLSERVER_OV_API FdoSqlServerOvTable* GetTable();
00070 
00071     /// \brief
00072     /// Sets the SqlServer table override for this class override
00073     /// 
00074     /// \param name 
00075     /// Input SqlServer table override
00076     /// 
00077     /// \return
00078     /// Returns nothing
00079     /// 
00080     FDOSQLSERVER_OV_API void SetTable(FdoSqlServerOvTable* table);
00081 
00082     /// \brief
00083     /// Sets the SqlServer geometry column override for this class override
00084     /// 
00085     /// \param column 
00086     /// Input SqlServer Geometric Column override
00087     /// 
00088     /// \return
00089     /// Returns nothing
00090     /// 
00091     FDOSQLSERVER_OV_API void SetGeometryColumn(FdoSqlServerOvGeometricColumn* column);
00092 
00093     /// \brief
00094     /// Specifies which FDO property corresponds to the single SqlServer IDENTITY column.
00095     /// This property corresponds to the singleton IDENTITY column of the SQL Server table.
00096     /// This is not to be confused with the usual FDO identity properties, which instead 
00097     /// correspond to the primary key of a SQL Server table.
00098     /// 
00099     /// \param name 
00100     /// Input SqlServer identity property name override.
00101     /// An empty string means there is no identity column for this class.
00102     /// 
00103     /// \return
00104     /// Returns nothing
00105     /// 
00106     FDOSQLSERVER_OV_API void SetIdentityPropertyName(FdoString* identityPropertyName);
00107 
00108     /// \brief
00109     /// Gets which FDO property corresponds to the single SqlServer IDENTITY column
00110     /// 
00111     /// \return
00112     /// Returns the FDO property corresponding to the single SqlServer IDENTITY column,
00113     /// or an empty string if there is no such property
00114     /// 
00115     FDOSQLSERVER_OV_API FdoString* GetIdentityPropertyName(void);
00116 
00117     /// \brief
00118     /// Retrieves the identity column's type, whether it is a non-globally-unique
00119     /// identity column or a globally-unique identity column.
00120     /// 
00121     /// \remarks
00122     /// Non-globally-unique identity columns have their value
00123     /// automatically populated by SQL Server on insert; the first value is set to the specified
00124     /// IdentitySeed, and all subsequent values are set using the specified IdentityIncrement.
00125     /// If defining such a column during ApplySchema, it must be one of the following SQL Server
00126     /// native data types: decimal, int, numeric, smallint, bigint, or tinyint.  Note that the
00127     /// “not for replication” identity column flag is not exposed.  Also note that the identifier
00128     /// column must not be nullable and must not contain a default value.
00129     /// Globally-unique identity columns do not have their value automatically populated by SQL Server.
00130     /// Instead SQL Server relies on the default value or the user to populate this value.  To have
00131     /// this value populated automatically on insert, the user should set the default value to use the
00132     /// NEWID() function to obtain a globally-unique identity value.
00133     /// This override is ignored on ApplySchema if this column belongs to an existing table in a
00134     /// foreign database.  This override is also ignored if IdentityPropertyName is not specified.
00135     /// 
00136     /// \return
00137     /// Returns the type of the single IDENTITY column, if it exists
00138     /// 
00139     FDOSQLSERVER_OV_API bool GetIdentityIsGloballyUnique(void);
00140 
00141     /// \brief
00142     /// Set the type of the single IDENTITY column, if it exists
00143     /// 
00144     /// \return
00145     /// Returns nothing
00146     /// 
00147     FDOSQLSERVER_OV_API void SetIdentityIsGloballyUnique(bool identityisGloballyUnique);
00148 
00149     /// \brief
00150     /// Sets the first value to use for the identity column, if there is one.
00151     /// 
00152     /// \remarks
00153     /// This override defaults to 1.  This override is ignored on ApplySchema if
00154     /// this column belongs to an existing table in a foreign database.  This override is also
00155     /// ignored if IdentityPropertyName is not specified.
00156     /// 
00157     /// \return
00158     /// Returns the first value to use for the identity column
00159     /// 
00160     FDOSQLSERVER_OV_API FdoInt32 GetIdentitySeed(void);
00161 
00162     /// \brief
00163     /// Gets the first value to use for the identity column, if there is one.
00164     /// 
00165     /// \return
00166     /// Returns nothing
00167     /// 
00168     FDOSQLSERVER_OV_API void SetIdentitySeed(FdoInt32 identitySeed);
00169 
00170     /// \brief
00171     /// Gets the increment value to use for the identity column, if there is one.
00172     /// 
00173     /// \remarks
00174     /// This override defaults to 1.  This override is ignored on ApplySchema if this
00175     /// column belongs to an existing table in a foreign database.  This override is also ignored
00176     /// if IdentityPropertyName is not specified.
00177     /// 
00178     /// \return
00179     /// Returns the increment value to use for the identity column
00180     /// 
00181     FDOSQLSERVER_OV_API FdoInt32 GetIdentityIncrement(void);
00182 
00183     /// \brief
00184     /// Sets the increment value to use for the identity column, if there is one.
00185     /// 
00186     /// \return
00187     /// Returns nothing
00188     /// 
00189     FDOSQLSERVER_OV_API void SetIdentityIncrement(FdoInt32 identityIncrement);
00190 
00191 /// \cond DOXYGEN-IGNORE
00192 
00193     /// Sets the parent of this object. Not part of the API.
00194     void SetParent(FdoPhysicalElementMapping* value);
00195 
00196     /// Initialize this element from its XML attributes
00197     virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00198 
00199     /// Serialize the XML attributes of this class:
00200     virtual void _writeXmlAttributes(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00201 
00202 /// \endcond
00203 
00204 protected:
00205     FdoSqlServerOvClassDefinition();
00206     FdoSqlServerOvClassDefinition(FdoString *name);
00207 
00208     virtual ~FdoSqlServerOvClassDefinition();
00209     void Init();
00210     virtual void Dispose();
00211 
00212     /// Create table override from XML attributes
00213     virtual void SetTable(
00214         FdoXmlSaxContext* context,
00215         FdoXmlAttributeCollection* atts
00216     );
00217 
00218     /// Create data property override from XML attributes
00219     virtual FdoRdbmsOvDataPropertyDefinition* CreateDataProperty( 
00220         FdoXmlSaxContext* context,
00221         FdoXmlAttributeCollection* propAtts,
00222         FdoXmlAttributeCollection* colAtts
00223     );
00224 
00225     /// Create geometric property override from XML attributes
00226     virtual FdoRdbmsOvGeometricPropertyDefinition* CreateGeometricProperty( 
00227         FdoXmlSaxContext* context,
00228         FdoXmlAttributeCollection* propAtts,
00229         FdoXmlAttributeCollection* colAtts
00230     );
00231 
00232     /// Create object property override from XML attributes
00233     virtual FdoRdbmsOvObjectPropertyDefinition* CreateObjectProperty( 
00234         FdoXmlSaxContext* context,
00235         FdoXmlAttributeCollection* propAtts,
00236         FdoString* mappingType,
00237         FdoXmlAttributeCollection* mappingAtts
00238     );
00239 
00240     /// Add the given property override to this class override
00241     virtual void AddProperty( 
00242         FdoRdbmsOvPropertyDefinition* pProp
00243     );
00244 
00245 private:
00246     FdoSqlServerOvPropertiesP  mPropertyDefinitions;
00247     bool  mIdentityIsGloballyUnique;
00248     FdoInt32  mIdentitySeed;
00249     FdoInt32  mIdentityIncrement;
00250     FdoStringP  mIdentityPropertyName;
00251 };
00252 
00253 
00254 /// \brief
00255 /// FdoSqlServerOvClassP is a FdoPtr on FdoSqlServerOvClassDefinition, provided for convenience.
00256 typedef FdoPtr<FdoSqlServerOvClassDefinition> FdoSqlServerOvClassP;
00257 
00258 #endif
00259 
00260 

Comments?