OSGeo FDO Provider for MySQL API Reference

OSGeo FDO Provider for MySQL API

API Reference OSGeo FDO Provider for MySQL

RdbmsOvSchemaAutoGeneration.h

Go to the documentation of this file.
00001 #ifndef FDO_RDBMSOVSCHEMAAUTOGENERATION_H
00002 #define FDO_RDBMSOVSCHEMAAUTOGENERATION_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 
00021 #include <Fdo/Commands/Schema/PhysicalElementMapping.h>
00022 #include <Fdo/Xml/NameCollectionHandler.h>
00023 #include <Rdbms/Override/RdbmsOv.h>
00024 
00025 /// <library>
00026 /// FdoRdbms.lib
00027 /// </library>
00028 
00029 ///<summary>
00030 ///This class provides directives for reverse-engineering FDO
00031 ///Feature Schema elements from the physical schema of the currently 
00032 ///connected datastore.
00033 ///</summary>
00034 class FdoRdbmsOvSchemaAutoGeneration: public FdoPhysicalElementMapping
00035 {
00036 
00037 public:
00038     ///<summary>Creates a set of schema autogeneration settings.
00039     ///</summary>
00040     ///<returns>Returns FdoRdbmsOvSchemaAutoGeneration</returns>
00041     FDORDBMS_OV_API static FdoRdbmsOvSchemaAutoGeneration* Create();
00042 
00043     ///<summary>Gets the table prefix for autogenerating class definitions.
00044     ///When set, an FDO Class Definition is automatically generated for
00045     ///each table whose name begins with this prefix. Any table already 
00046     ///referenced by a class definition is skipped. Each generated class is 
00047     ///added to the Feature Schema for this Schema Mapping Set.
00048     ///</summary>
00049     ///<returns>Returns the class autogeneration table name prefix</returns>
00050     FDORDBMS_OV_API FdoString* GetGenTablePrefix();
00051 
00052     ///<summary>
00053     ///Sets the table prefix for autogenerating class definitions.
00054     ///</summary>
00055     /// <param name="tablePrefix">
00056     /// Input the table prefix. If L"" then no 
00057     /// classes will be generated by table prefix.
00058     /// </param>
00059     ///<returns>Returns nothing</returns>
00060     FDORDBMS_OV_API void SetGenTablePrefix(FdoString* tablePrefix);
00061 
00062     ///<summary>Gets the table prefix removal setting. This setting affects
00063     ///how classes, generated from tables matching the table prefix, are named:
00064     ///    * when true, the class name is the table name with prefix removed. 
00065     ///    true is the default setting.
00066     ///    * when false, the class name is the table name. 
00067     ///</summary>
00068     ///<returns>Returns FdoBoolean.</returns>
00069     FDORDBMS_OV_API FdoBoolean GetRemoveTablePrefix();
00070 
00071     ///<summary>Sets the "remove table prefix" setting.</summary>
00072     /// <param name="removeTablePrefix">
00073     /// Input the "remove table prefix" setting.
00074     // </param>
00075     ///<returns>Returns nothing</returns>
00076     FDORDBMS_OV_API void SetRemoveTablePrefix(FdoBoolean removeTablePrefix);
00077 
00078     ///<summary>Gets the list of tables or views for which class definitions 
00079     ///will be autogenerated. Once retrieved, the caller can populate this 
00080     ///list.
00081     ///When set, an FDO Class Definition is automatically generated for
00082     ///each table in this list. Any table already 
00083     ///referenced by a class definition is skipped. Each generated class is 
00084     ///added to the Feature Schema for this Schema Mapping Set.
00085     ///
00086     ///Note: the only way to autogenerate a class definition from a view
00087     ///is to add the view name to this list. There is one caveat in that
00088     ///the generated class will not have identity properties. 
00089     ///</summary>
00090     ///<returns>Returns FdoStringCollection</returns>
00091     FDORDBMS_OV_API FdoStringCollection* GetGenTableList();
00092 
00093     ///<summary>Gets the maximum number of rows to sample when table data
00094     ///must be examined to determine schema information. The situations 
00095     ///where this must be done depend on the provider. For example, 
00096     ///when a geometric property is generated from a geometric column, the 
00097     ///geomety types might be determined by examining some of the geometry
00098     ///values in the column.
00099     ///
00100     ///MaxSampleRows can be any positive integer or one of the following:
00101     ///    * 0: all rows in the table are sampled. (Not recommended for
00102     ///    large datastores).
00103     ///    * -1: no rows are sampled.
00104     ///
00105     ///</summary>
00106     ///<returns>Returns FdoBoolean.</returns>
00107     FDORDBMS_OV_API FdoInt32 GetMaxSampleRows();
00108 
00109     ///<summary>Sets the maximum number of rows to sample when 
00110     ///determining schema from table data. Higher values give a more
00111     ///accurate result but lower values provide better performance.</summary>
00112     /// <param name="maxRows">Input the maximum number of rows to sample.</param>
00113     ///<returns>Returns nothing</returns>
00114     FDORDBMS_OV_API void SetMaxSampleRows(FdoInt32 maxRows);
00115 
00116 //DOM-IGNORE-BEGIN
00117     // Initialize this element from its XML attributes
00118     virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00119 
00120     // Serialize this property to XML.
00121     virtual void _writeXml(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00122 //DOM-IGNORE-END
00123 
00124 protected:
00125     FdoRdbmsOvSchemaAutoGeneration();
00126     virtual ~FdoRdbmsOvSchemaAutoGeneration();
00127     virtual void Dispose();
00128 
00129     // Handle the table list.
00130     FdoXmlSaxHandler* XmlStartElement(
00131         FdoXmlSaxContext* context,
00132         FdoString* uri,
00133         FdoString* name,
00134         FdoString* qname,
00135         FdoXmlAttributeCollection* atts
00136     );
00137 private:
00138     FdoStringP                      mGenTablePrefix;
00139     FdoBoolean                      mRemoveTablePrefix;
00140     FdoInt32                        mMaxSampleRows;
00141 
00142     FdoXmlNameCollectionHandlerP    mTableListSerializer;
00143 };
00144 
00145 ///<summary>FdoRdbmsOvSchemaAutoGenerationP is a FdoPtr on FdoRdbmsOvSchemaAutoGeneration, provided for convenience.</summary>
00146 typedef FdoPtr<FdoRdbmsOvSchemaAutoGeneration> FdoRdbmsOvSchemaAutoGenerationP;
00147 
00148 #endif
00149 

Comments?