00001 #ifndef FDO_SqlServerOVCLASSDEFINITION_H
00002 #define FDO_SqlServerOVCLASSDEFINITION_H
00003 //
00004 //
00005 // (C) Copyright 1990-2005 by Autodesk, Inc.
00006 //
00007 //
00008 //
00009 // By using this code, you are agreeing to the terms
00010 // and conditions of the License Agreement that appeared
00011 // and was accepted upon download or installation
00012 // (or in connection with the download or installation)
00013 // of the Autodesk software in which this code is included.
00014 // All permissions on use of this code are as set forth
00015 // in such License Agreement provided that the above copyright
00016 // notice appears in all authorized copies and that both that
00017 // copyright notice and the limited warranty and
00018 // restricted rights notice below appear in all supporting
00019 // documentation.
00020 //
00021 // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
00022 // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
00023 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
00024 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
00025 // UNINTERRUPTED OR ERROR FREE.
00026 //
00027 // Use, duplication, or disclosure by the U.S. Government is subject to
00028 // restrictions set forth in FAR 52.227-19 (Commercial Computer
00029 // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
00030 // (Rights in Technical Data and Computer Software), as applicable.
00031 //
00032 #include <Rdbms/Override/RdbmsOvClassDefinition.h>
00033 #include <Rdbms/Override/SqlServer/SqlServerOv.h>
00034 #include <Rdbms/Override/SqlServer/SqlServerOvDataPropertyDefinition.h>
00035 #include <Rdbms/Override/SqlServer/SqlServerOvGeometricPropertyDefinition.h>
00036 #include <Rdbms/Override/SqlServer/SqlServerOvObjectPropertyDefinition.h>
00037 #include <Rdbms/Override/SqlServer/SqlServerOvPropertyDefinitionCollection.h>
00038 #include <Rdbms/Override/SqlServer/SqlServerOvTable.h>
00039 #include <Rdbms/Override/SqlServer/SqlServerOvGeometricColumn.h>
00040
00041 /// \brief
00042 /// Concrete class defining physical schema overrides for a class definition.
00043 class FdoSqlServerOvClassDefinition : public FdoRdbmsOvClassDefinition
00044 {
00045
00046 public:
00047 /// \brief
00048 /// Constructs a default of an FdoSqlServerOvClassDefinition
00049 ///
00050 /// \return
00051 /// Returns FdoSqlServerOvClassDefinition
00052 ///
00053 FDOSQLSERVER_OV_API static FdoSqlServerOvClassDefinition* Create();
00054
00055 /// \brief
00056 /// Constructs an instance of an FdoSqlServerOvClassDefinition using the specified arguments
00057 ///
00058 /// \param name
00059 /// Input name
00060 ///
00061 /// \return
00062 /// Returns FdoSqlServerOvClassDefinition
00063 ///
00064 FDOSQLSERVER_OV_API static FdoSqlServerOvClassDefinition* Create(FdoString* name);
00065
00066 /// \brief
00067 /// Gets a collection of SqlServer property overrides
00068 ///
00069 /// \return
00070 /// Returns the collection of SqlServer property overrides
00071 ///
00072 FDOSQLSERVER_OV_API FdoSqlServerOvPropertyDefinitionCollection* GetProperties();
00073
00074 /// \brief
00075 /// Gets the SqlServer table override for this class override
00076 ///
00077 /// \return
00078 /// Returns FdoSqlServerOvTable
00079 ///
00080 FDOSQLSERVER_OV_API FdoSqlServerOvTable* GetTable();
00081
00082 /// \brief
00083 /// Sets the SqlServer table override for this class override
00084 ///
00085 /// \param name
00086 /// Input SqlServer table override
00087 ///
00088 /// \return
00089 /// Returns nothing
00090 ///
00091 FDOSQLSERVER_OV_API void SetTable(FdoSqlServerOvTable* table);
00092
00093 /// \brief
00094 /// Sets the SqlServer geometry column override for this class override
00095 ///
00096 /// \param column
00097 /// Input SqlServer Geometric Column override
00098 ///
00099 /// \return
00100 /// Returns nothing
00101 ///
00102 FDOSQLSERVER_OV_API void SetGeometryColumn(FdoSqlServerOvGeometricColumn* column);
00103
00104 /// \brief
00105 /// Specifies which FDO property corresponds to the single SqlServer IDENTITY column.
00106 /// This property corresponds to the singleton IDENTITY column of the SQL Server table.
00107 /// This is not to be confused with the usual FDO identity properties, which instead
00108 /// correspond to the primary key of a SQL Server table.
00109 ///
00110 /// \param name
00111 /// Input SqlServer identity property name override.
00112 /// An empty string means there is no identity column for this class.
00113 ///
00114 /// \return
00115 /// Returns nothing
00116 ///
00117 FDOSQLSERVER_OV_API void SetIdentityPropertyName(FdoString* identityPropertyName);
00118
00119 /// \brief
00120 /// Gets which FDO property corresponds to the single SqlServer IDENTITY column
00121 ///
00122 /// \return
00123 /// Returns the FDO property corresponding to the single SqlServer IDENTITY column,
00124 /// or an empty string if there is no such property
00125 ///
00126 FDOSQLSERVER_OV_API FdoString* GetIdentityPropertyName(void);
00127
00128 /// \brief
00129 /// Retrieves the identity column's type, whether it is a non-globally-unique
00130 /// identity column or a globally-unique identity column.
00131 ///
00132 /// \remarks
00133 /// Non-globally-unique identity columns have their value
00134 /// automatically populated by SQL Server on insert; the first value is set to the specified
00135 /// IdentitySeed, and all subsequent values are set using the specified IdentityIncrement.
00136 /// If defining such a column during ApplySchema, it must be one of the following SQL Server
00137 /// native data types: decimal, int, numeric, smallint, bigint, or tinyint. Note that the
00138 /// not for replication identity column flag is not exposed. Also note that the identifier
00139 /// column must not be nullable and must not contain a default value.
00140 /// Globally-unique identity columns do not have their value automatically populated by SQL Server.
00141 /// Instead SQL Server relies on the default value or the user to populate this value. To have
00142 /// this value populated automatically on insert, the user should set the default value to use the
00143 /// NEWID() function to obtain a globally-unique identity value.
00144 /// This override is ignored on ApplySchema if this column belongs to an existing table in a
00145 /// foreign database. This override is also ignored if IdentityPropertyName is not specified.
00146 ///
00147 /// \return
00148 /// Returns the type of the single IDENTITY column, if it exists
00149 ///
00150 FDOSQLSERVER_OV_API bool GetIdentityIsGloballyUnique(void);
00151
00152 /// \brief
00153 /// Set the type of the single IDENTITY column, if it exists
00154 ///
00155 /// \return
00156 /// Returns nothing
00157 ///
00158 FDOSQLSERVER_OV_API void SetIdentityIsGloballyUnique(bool identityisGloballyUnique);
00159
00160 /// \brief
00161 /// Sets the first value to use for the identity column, if there is one.
00162 ///
00163 /// \remarks
00164 /// This override defaults to 1. This override is ignored on ApplySchema if
00165 /// this column belongs to an existing table in a foreign database. This override is also
00166 /// ignored if IdentityPropertyName is not specified.
00167 ///
00168 /// \return
00169 /// Returns the first value to use for the identity column
00170 ///
00171 FDOSQLSERVER_OV_API FdoInt32 GetIdentitySeed(void);
00172
00173 /// \brief
00174 /// Gets the first value to use for the identity column, if there is one.
00175 ///
00176 /// \return
00177 /// Returns nothing
00178 ///
00179 FDOSQLSERVER_OV_API void SetIdentitySeed(FdoInt32 identitySeed);
00180
00181 /// \brief
00182 /// Gets the increment value to use for the identity column, if there is one.
00183 ///
00184 /// \remarks
00185 /// This override defaults to 1. This override is ignored on ApplySchema if this
00186 /// column belongs to an existing table in a foreign database. This override is also ignored
00187 /// if IdentityPropertyName is not specified.
00188 ///
00189 /// \return
00190 /// Returns the increment value to use for the identity column
00191 ///
00192 FDOSQLSERVER_OV_API FdoInt32 GetIdentityIncrement(void);
00193
00194 /// \brief
00195 /// Sets the increment value to use for the identity column, if there is one.
00196 ///
00197 /// \return
00198 /// Returns nothing
00199 ///
00200 FDOSQLSERVER_OV_API void SetIdentityIncrement(FdoInt32 identityIncrement);
00201
00202 /// \cond DOXYGEN-IGNORE
00203
00204 /// Sets the parent of this object. Not part of the API.
00205 void SetParent(FdoPhysicalElementMapping* value);
00206
00207 /// Initialize this element from its XML attributes
00208 virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00209
00210 /// Serialize the XML attributes of this class:
00211 virtual void _writeXmlAttributes(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00212
00213 /// \endcond
00214
00215 protected:
00216 FdoSqlServerOvClassDefinition();
00217 FdoSqlServerOvClassDefinition(FdoString *name);
00218
00219 virtual ~FdoSqlServerOvClassDefinition();
00220 void Init();
00221 virtual void Dispose();
00222
00223 /// Create table override from XML attributes
00224 virtual void SetTable(
00225 FdoXmlSaxContext* context,
00226 FdoXmlAttributeCollection* atts
00227 );
00228
00229 /// Create data property override from XML attributes
00230 virtual FdoRdbmsOvDataPropertyDefinition* CreateDataProperty(
00231 FdoXmlSaxContext* context,
00232 FdoXmlAttributeCollection* propAtts,
00233 FdoXmlAttributeCollection* colAtts
00234 );
00235
00236 /// Create geometric property override from XML attributes
00237 virtual FdoRdbmsOvGeometricPropertyDefinition* CreateGeometricProperty(
00238 FdoXmlSaxContext* context,
00239 FdoXmlAttributeCollection* propAtts,
00240 FdoXmlAttributeCollection* colAtts
00241 );
00242
00243 /// Create object property override from XML attributes
00244 virtual FdoRdbmsOvObjectPropertyDefinition* CreateObjectProperty(
00245 FdoXmlSaxContext* context,
00246 FdoXmlAttributeCollection* propAtts,
00247 FdoString* mappingType,
00248 FdoXmlAttributeCollection* mappingAtts
00249 );
00250
00251 /// Add the given property override to this class override
00252 virtual void AddProperty(
00253 FdoRdbmsOvPropertyDefinition* pProp
00254 );
00255
00256 private:
00257 FdoSqlServerOvPropertiesP mPropertyDefinitions;
00258 bool mIdentityIsGloballyUnique;
00259 FdoInt32 mIdentitySeed;
00260 FdoInt32 mIdentityIncrement;
00261 FdoStringP mIdentityPropertyName;
00262 };
00263
00264
00265 /// \brief
00266 /// FdoSqlServerOvClassP is a FdoPtr on FdoSqlServerOvClassDefinition, provided for convenience.
00267 typedef FdoPtr<FdoSqlServerOvClassDefinition> FdoSqlServerOvClassP;
00268
00269 #endif
00270
00271