http://www.charlesandhudson.com/archives/hand-tools-list-important.jpgPPT_LOGO_4b
‹#›
Autodesk Confidential Information November 2008
增强了MapGuide要素服务的事物能力,在一个事物中支持执行一系列的SQL语句
The Wine – New APIs
MgTransaction tran = nullptr;
try
{
    tran = MgFeatureService.StartTransaction(resourceId);
    MgFeatureService.ExecuteSql(resourceId, sql statement1, tran);
    MgFeatureService.ExecuteSql(resourceId, sql statement2, tran);
    MgFeatureService.UpdateFeatures(resourceId, MgFeatureCommandCollection, tran);
    tran.Commit();
}
catch(...)
{
    if(nullptr != tran)
        tran.Rollback();
}
Example
This improvement is to enhance the transaction capability of MapGuide Feature Service to support executing not only a sequence of standard commands(delete/update/insert) but also a sequence of sql statements within a single transaction.

In previous release, Feature Service supports executing a sequence of standard commands within a single transaction through the API illustrated below. The standard commands are delete/update/insert. If you pass in true for useTransaction, the API will start a transaction and commit(or rollback) it at the end. Thus all command execution will reside inside a single transaction.

virtual MgPropertyCollection* UpdateFeatures( MgResourceIdentifier* resource, MgFeatureCommandCollection* commands, bool useTransaction ) = 0;

However, in new release, MapGuide Feature Service also provides another two APIs to execute sql statements as illustrated below, where a database transaction will internally be started and committed before and after the sql statement execution. Here the capability of executing a sequence of sql statements within a single transaction is missing.

virtual MgSqlDataReader* ExecuteSqlQuery(MgResourceIdentifier* resource, CREFSTRING sqlStatemen) = 0;
virtual INT32 ExecuteSqlNonQuery( MgResourceIdentifier* resource, CREFSTRING sqlNonSelectStatement ) = 0;

This proposal is to expose a seperate transaction control from Feature Service to enable executing a sequence of sql statements within a single transaction.