Changes between Initial Version and Version 1 of MapGuideRfc84


Ignore:
Timestamp:
09/07/09 23:32:33 (15 years ago)
Author:
leaf
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc84

    v1 v1  
     1= !MapGuide RFC 84 - Fetch Size =
     2
     3This page contains a change request (RFC) for the !MapGuide Open Source project.
     4More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page.
     5
     6== Status ==
     7
     8||RFC Template Version||(1.0)||
     9||Submission Date||August 14, 2009||
     10||Last Modified||(Leaf Li) (Fri Aug 14 09:46:19 2009)||
     11||Author||(Klain Qin)||
     12||RFC Status||Draft||
     13||Implementation Status||(pending)||
     14||Proposed Milestone||(2.2)||
     15||Assigned PSC guide(s)||(Tom Fukushima)||
     16||'''Voting History'''||(vote date)||
     17||+1||||
     18||+0||||
     19||-0||||
     20||-1||||
     21
     22== Overview ==
     23
     24This proposal is to extend MapGuide Feature Service so that the client can set the size of the fetch array when executing a query.
     25
     26== Motivation ==
     27
     28For queries that return a large number of objects many feature sources support improving performance by configuring the row fetch size in order to reduce the number database server round trips required to satisfy the selection criteria. For example, Oracle and Microsoft SQL Server support fetching many rows at once. While many FDO providers take advantage of this internally, the fetch size they use is fixed and does not allow the caller to tune it based on their circumstances. In FDO RFC 41 (http://trac.osgeo.org/fdo/wiki/FDORfc41), it enhances FDO API to allow callers to tune the fetch size for providers that will support this. Providers that do not use a fetch size or have a fixed internal implementation simply will ignore the set fetch size. In either case, this does not affect the actual results of queries as it is a performance tuning parameter. This RFC will do the similar enhancement for MapGuide Feature Service.
     29
     30== Proposed Solution ==
     31
     32The following two methods will be added to class MgFeatureService to allow users to set fetch size for a FdoISelect and FdoISelectAggregate command.
     33
     34{{{
     35    /// \brief
     36    /// Selects features from a feature source according to the
     37    /// criteria set in the MgFeatureQueryOptions argument The
     38    /// criteria are applied to all of the features in the feature
     39    /// source. Use the coordinateSystem argument to set the target
     40    /// coordinate system if you want to transform and use fetchSize
     41    /// argument to set the fetch size of query.
     42    ///
     43    /// \param resource (MgResourceIdentifier)
     44    /// A resource identifier for the feature source.
     45    /// \param className (String/string)
     46    /// The name of the feature class from which
     47    /// the properties of interest are selected.
     48    /// \param options (MgFeatureQueryOptions)
     49    /// MgFeatureQueryOptions instance
     50    /// containing all required filters for this
     51    /// select operation.
     52    /// \param coordinateSystem (String/string)
     53    /// The name of the coordinate system to transform to.
     54    /// \param fetchSize (int)
     55    /// The fetch size of query. This method returns all data
     56    /// of query if setting the fetch size to 0.
     57    ///
     58    /// \return
     59    /// Returns an MgFeatureReader containing the set of selected
     60    /// features.
     61    ///
     62    virtual MgFeatureReader*  SelectFeatures(   MgResourceIdentifier* resource,
     63                                                CREFSTRING className,
     64                                                MgFeatureQueryOptions* options,
     65                                                CREFSTRING coordinateSystem,
     66                                                INT32 fetchSize ) = 0;
     67
     68    /// \brief
     69    /// Selects groups of features from a feature source and applies
     70    /// filters to each of the groups according to the criteria set
     71    /// in the MgFeatureAggregateOptions argument. Use fetchSize
     72    /// argument to set the fetch size of query.
     73    ///
     74    /// \param resource (MgResourceIdentifier)
     75    /// A resource identifier for the feature
     76    /// source.
     77    /// \param className (String/string)
     78    /// The name of the feature class on which
     79    /// the select operation is performed.
     80    /// \param options (MgFeatureAggregateOptions)
     81    /// An MgFeatureAggregateOptions instance
     82    /// containing all the criteria and filters
     83    /// required for this select operation.
     84    /// \param fetchSize (int)
     85    /// The fetch size of query. This method returns all data
     86    /// of query if setting the fetch size to 0.
     87    ///
     88    /// \return
     89    /// Returns an MgDataReader containing the group values.
     90    ///
     91    virtual MgDataReader*  SelectAggregate( MgResourceIdentifier* resource,
     92                                            CREFSTRING className,
     93                                            MgFeatureAggregateOptions* options,
     94                                            INT32 fetchSize) = 0;
     95}}}
     96
     97The following two methods in MgFeatureService will be extended to add one argument fetchSize to allow callers to set fetch size for a SQL query.
     98
     99{{{
     100    //////////////////////////////////////////////////////////////
     101    /// \brief
     102    /// Executes the SQL SELECT statement with the specified parameters
     103    /// on the specified feature source.
     104    ///
     105    /// \param resource (MgResourceIdentifier)
     106    /// A resource identifier referring to a feature source.
     107    /// \param sqlStatement (String/string)
     108    /// The SQL SELECT statement.
     109    /// \param params (MgParameterCollection)
     110    /// Parameters binded to the SQL statement.
     111    /// \param fetchSize (int)
     112    /// The fetch size of query. This method returns all data
     113    /// of query if setting the fetch size to 0.
     114    ///
     115    /// \return
     116    /// Returns an MgSqlDataReader instance (or NULL).
     117    ///
     118    virtual MgSqlDataReader* ExecuteSqlQuery( MgResourceIdentifier* resource,
     119                                              CREFSTRING sqlStatement,
     120                                              MgParameterCollection* params,
     121                                              INT32 fetchSize ) = 0;
     122
     123    ///////////////////////////////////////////////////////
     124    /// \brief
     125    /// Executes SQL statements NOT including SELECT statements
     126    /// with the specified parameters.
     127    ///
     128    /// \param resource (MgResourceIdentifier)
     129    /// A resource identifier for a feature source.
     130    /// \param sqlNonSelectStatement (String/string)
     131    /// The SQL statement that is NOT a SELECT statement.
     132    /// \param params (MgParameterCollection)
     133    /// Parameters binded to the SQL statement.
     134    /// \param fetchSize (int)
     135    /// The fetch size of query. This method returns all data
     136    /// of query if setting the fetch size to 0.
     137    ///
     138    /// \return
     139    /// Returns a positive integer value indicating how many
     140    /// instances (rows) have been affected.
     141    ///
     142    virtual INT32 ExecuteSqlNonQuery( MgResourceIdentifier* resource,
     143                                      CREFSTRING sqlNonSelectStatement,
     144                                      MgParameterCollection* params,
     145                                      INT32 fetchSize ) = 0;
     146}}}
     147
     148== Implications ==
     149
     150This is new API only. There will be no effect on existing applications. However, API documentation needs to be updated.
     151
     152== Test Plan ==
     153
     154Add unit tests for those new methods into the existing Feature Service unit tests.
     155
     156== Funding/Resources ==
     157
     158Supplied by Autodesk.