Changes between Version 16 and Version 17 of MapGuideRfc86


Ignore:
Timestamp:
09/24/09 20:08:50 (15 years ago)
Author:
leaf
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc86

    v16 v17  
    2828
    2929Currently MapGuide Server maintains an FDO connection pool in order to improve performance. Once MapGuide Server receives a request to access data in a feature source, it will try to find an available FDO connection in FDO connection pool. It avoids exhausting FDO connections to the underlying RDBMS and improves performance of MapGuide Server when many users use MapGuide Server in the same time. However, it means that one user session may use the different FDO connection for the same feature source at the different time. Sometimes, it will result in some unexpected errors. Let’s take a look at one example.
     30
     31{{{
     32    featureService.ExecuteSqlQuery(featureSourceId, "SAVEPOINT X", null, null);
     33    try
     34    {
     35        MgSqlDataReader reader1 = featureService.ExecuteSqlQuery(featureSourceId, "SELECT FID FROM DUMMY", null, null);
     36        featureService..ExecuteSqlNonQuery(featureSourceId, "SAVEPOINT Y", null, null);
     37        try
     38        {
     39            featureService.ExecuteSqlNonQuery(featureSourceId, "INSERT INTO TEST2 (FID) VALUES (1)", null, null);
     40        }
     41        catch (System.Exception)
     42        {
     43            featureService.ExecuteSqlQuery(featureSourceId, "ROLLBACK TO Y", null, null);
     44        }
     45
     46        while (reader1.ReadNext())
     47        {
     48            MgParameterCollection parameters = new MgParameterCollection();
     49            MgInt32Property inFid = new MgInt32Property("myInput", r1.GetInt32("FID"));
     50            MgParameter inParameter = new MgParameter(inFid, MgParameterDirection.Input);
     51            parameters.Add(inParameter);
     52            featureService.ExecuteSqlNonQuery(featureSourceId, "INSERT INTO TEST(FID) VALUES(:myInput)", parameters, null);
     53        }
     54        r1.Close();
     55        r1.Dispose();
     56    }
     57    catch (System.Exception)
     58    {
     59        featureService.ExecuteSqlQuery(featureSourceId, "ROLLBACK TO X", null, null);
     60    }
     61    featureService.ExecuteSqlQuery(featureSourceId, "COMMIT", null, null);
     62}}}
    3063
    3164In the example above, it is possible that FDO connections used by executing SQL statements "SAVEPOINT X", "ROLLBACK TO X" and "COMMIT" are completely different FDO connections. If so, it will result in an error when executing SQL statement "ROLLBACK TO X" or "COMMIT".