API Reference | OSGeo FDO Provider for MySQL |
00001 #ifndef FDO_MySQLOVCLASSDEFINITION_H 00002 #define FDO_MySQLOVCLASSDEFINITION_H 00003 // 00004 // 00005 // Copyright (C) 2004-2006 Autodesk, Inc. 00006 // 00007 // This library is free software; you can redistribute it and/or 00008 // modify it under the terms of version 2.1 of the GNU Lesser 00009 // General Public License as published by the Free Software Foundation. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 // 00020 #include <Rdbms/Override/RdbmsOvClassDefinition.h> 00021 #include <Rdbms/Override/MySQL/MySqlOv.h> 00022 #include <Rdbms/Override/MySQL/MySqlOvDataPropertyDefinition.h> 00023 #include <Rdbms/Override/MySQL/MySqlOvGeometricPropertyDefinition.h> 00024 #include <Rdbms/Override/MySQL/MySqlOvObjectPropertyDefinition.h> 00025 #include <Rdbms/Override/MySQL/MySqlOvPropertyDefinitionCollection.h> 00026 #include <Rdbms/Override/MySQL/MySqlOvTable.h> 00027 #include <Rdbms/Override/MySQL/MySqlOvGeometricColumn.h> 00028 00029 /// \brief 00030 /// Concrete class defining physical schema overrides for a class definition. 00031 class FdoMySQLOvClassDefinition : public FdoRdbmsOvClassDefinition 00032 { 00033 00034 public: 00035 /// \brief 00036 /// Constructs a default of an FdoMySQLOvClassDefinition 00037 /// 00038 /// \return 00039 /// Returns FdoMySQLOvClassDefinition 00040 /// 00041 FDOMYSQL_OV_API static FdoMySQLOvClassDefinition* Create(); 00042 00043 /// \brief 00044 /// Constructs an instance of an FdoMySQLOvClassDefinition using the specified arguments 00045 /// 00046 /// \param name 00047 /// Input name 00048 /// 00049 /// \return 00050 /// Returns FdoMySQLOvClassDefinition 00051 /// 00052 FDOMYSQL_OV_API static FdoMySQLOvClassDefinition* Create(FdoString* name); 00053 00054 /// \brief 00055 /// Gets a collection of MySQL property overrides 00056 /// 00057 /// \return 00058 /// Returns the collection of MySQL property overrides 00059 /// 00060 FDOMYSQL_OV_API FdoMySQLOvPropertyDefinitionCollection* GetProperties(); 00061 00062 /// \brief 00063 /// Gets the MySQL table override for this class override 00064 /// 00065 /// \return 00066 /// Returns FdoMySQLOvTable 00067 /// 00068 FDOMYSQL_OV_API FdoMySQLOvTable* GetTable(); 00069 00070 /// \brief 00071 /// Sets the MySQL table override for this class override 00072 /// 00073 /// \param name 00074 /// Input MySQL table override 00075 /// 00076 /// \return 00077 /// Returns nothing 00078 /// 00079 FDOMYSQL_OV_API void SetTable(FdoMySQLOvTable* table); 00080 00081 /// \brief 00082 /// Which FDO property maps to an MySQL auto-increment column, if any. 00083 /// 00084 /// \remarks 00085 /// An empty string indicates 00086 /// there is no such column on this class’s table. There can only be at most one auto-increment column 00087 /// per table, it must be indexed, and it cannot have a default value. As of MySQL 3.23, an AutoIncrement 00088 /// column works properly only if it contains only positive values. Inserting a negative number is 00089 /// regarded as inserting a very large positive number. For MyISAM and BDB tables, you can specify an 00090 /// AUTO_INCREMENT secondary column in a multiple-column key. The first value in an AutoIncrement column 00091 /// is always 1 and always increments by 1 for each new value. This override is ignored on ApplySchema if 00092 /// this class refers to an existing table in a foreign database. 00093 /// 00094 /// \param name 00095 00096 /// 00097 /// \return 00098 /// Returns nothing 00099 /// 00100 FDOMYSQL_OV_API void SetAutoIncrementPropertyName(FdoString* autoIncrementPropertyName); 00101 00102 /// \brief 00103 /// Gets which FDO property corresponds to the single MySQL auto-increment column 00104 /// 00105 /// \return 00106 /// Returns the FDO property corresponding to the single MySQL auto-increment column, 00107 /// or an empty string if there is no such property 00108 /// 00109 FDOMYSQL_OV_API FdoString* GetAutoIncrementPropertyName(void); 00110 00111 /// \brief 00112 /// The initial value to use for the first row in the auto-increment column, if any. 00113 /// 00114 /// \remarks 00115 /// This override is only valid if the AutoIncrementProperty override is set to a non-empty string. 00116 /// This works only for the following storage engine types: MyISAM, MEMORY as of MySQL 4.1, and InnoDB 00117 /// as of MySQL 5.0.3. This override is ignored on ApplySchema if this table is an existing table in 00118 /// a foreign database. 00119 /// 00120 /// \return 00121 /// Returns the initial value to use for the first row in the auto-increment column 00122 /// 00123 FDOMYSQL_OV_API FdoInt64 GetAutoIncrementSeed(void); 00124 00125 /// \brief 00126 /// Sets the initial value to use for the first row in the auto-increment column, if any 00127 /// 00128 /// \return 00129 /// Returns nothing 00130 /// 00131 FDOMYSQL_OV_API void SetAutoIncrementSeed(FdoInt64 autoIncrementSeed); 00132 00133 00134 /// \cond DOXYGEN-IGNORE 00135 00136 /// Sets the parent of this object. Not part of the API. 00137 void SetParent(FdoPhysicalElementMapping* value); 00138 00139 /// Initialize this element from its XML attributes 00140 virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs); 00141 00142 /// Serialize the XML attributes of this class: 00143 virtual void _writeXmlAttributes(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags); 00144 00145 /// \endcond 00146 00147 protected: 00148 FdoMySQLOvClassDefinition(); 00149 FdoMySQLOvClassDefinition(FdoString *name); 00150 00151 virtual ~FdoMySQLOvClassDefinition(); 00152 void Init(); 00153 virtual void Dispose(); 00154 00155 /// Create table override from XML attributes 00156 virtual void SetTable( 00157 FdoXmlSaxContext* context, 00158 FdoXmlAttributeCollection* atts 00159 ); 00160 00161 /// Create data property override from XML attributes 00162 virtual FdoRdbmsOvDataPropertyDefinition* CreateDataProperty( 00163 FdoXmlSaxContext* context, 00164 FdoXmlAttributeCollection* propAtts, 00165 FdoXmlAttributeCollection* colAtts 00166 ); 00167 00168 /// Create geometric property override from XML attributes 00169 virtual FdoRdbmsOvGeometricPropertyDefinition* CreateGeometricProperty( 00170 FdoXmlSaxContext* context, 00171 FdoXmlAttributeCollection* propAtts, 00172 FdoXmlAttributeCollection* colAtts 00173 ); 00174 00175 /// Create object property override from XML attributes 00176 virtual FdoRdbmsOvObjectPropertyDefinition* CreateObjectProperty( 00177 FdoXmlSaxContext* context, 00178 FdoXmlAttributeCollection* propAtts, 00179 FdoString* mappingType, 00180 FdoXmlAttributeCollection* mappingAtts 00181 ); 00182 00183 /// Add the given property override to this class override 00184 virtual void AddProperty( 00185 FdoRdbmsOvPropertyDefinition* pProp 00186 ); 00187 00188 private: 00189 FdoMySQLOvPropertiesP mPropertyDefinitions; 00190 FdoInt64 mAutoIncrementSeed; 00191 FdoStringP mAutoIncrementPropertyName; 00192 }; 00193 00194 00195 /// \brief 00196 /// FdoMySQLOvClassP is a FdoPtr on FdoMySQLOvClassDefinition, provided for convenience. 00197 typedef FdoPtr<FdoMySQLOvClassDefinition> FdoMySQLOvClassP; 00198 00199 #endif 00200 00201
Comments? |