- Main Page
- Classes
- Files

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

Please send us your comment about this page