Changes between Version 34 and Version 35 of MapGuideRfc78


Ignore:
Timestamp:
07/24/09 08:29:32 (15 years ago)
Author:
brucedechant
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc78

    v34 v35  
    4545== Proposed Solution ==
    4646
    47 A new class of MgTransaction will be added to represent a transaction to be performed in a data store.
     47A new class of !MgTransaction will be added to represent a transaction to be performed in a data store.
    4848{{{
    4949/// \brief
     
    7676Changes to Feature Service
    7777
    78 ExecuteSqlQuery() and ExecuteSqlNonQuery() must use the same underlying connection on which the transaction started. So MgTransaction instance is passed in as parameters for both of these two methods. The MgTransaction implementation can return the undelying connection.
     78!ExecuteSqlQuery() and !ExecuteSqlNonQuery() must use the same underlying connection on which the transaction started. So !MgTransaction instance is passed in as parameters for both of these two methods. The !MgTransaction implementation can return the undelying connection.
    7979
    80 The existing UpdateFeatures function will execute the standard commands in some other connection from the connection pool. If passing in true for useTransaction, it will use a different transaction other than the one started by BeginTransaction().
     80The existing !UpdateFeatures function will execute the standard commands in some other connection from the connection pool. If passing in true for useTransaction, it will use a different transaction other than the one started by !BeginTransaction().
    8181
    82 So in order to be consistent with UpdateFeatures function, an overloaded version of UpdateFeatures function will be added taking a transaction object as well. It executes the standard commands within the same transaction explicityly started by BeginTransaction(). However this needs to be documented clearly to the users that if they are using the new APIs with the transaction object, they should stick to that and not mix in the old UpdateFeatures() API.
     82So in order to be consistent with !UpdateFeatures function, an overloaded version of !UpdateFeatures function will be added taking a transaction object as well. It executes the standard commands within the same transaction explicityly started by !BeginTransaction(). However this needs to be documented clearly to the users that if they are using the new APIs with the transaction object, they should stick to that and not mix in the old !UpdateFeatures() API.
    8383
    8484{{{
     
    138138}}}
    139139
    140 Note:
    141 a. If any exception is thrown within the sql statement execution, the new API won't rollback the transaction internally. Instead, it depends on the client application to rollback the transaction explicitly as illustrated in above codes.
    142 b. If a provider doesn't support transaction, BeginTransaction() will throw an MgInvalidOperationException saying transaction is not supported.
    143 c. If passing in NULL for the parameter, ExecuteSqlQuery and ExecuteSqlNonQuery will work the same as before taking no transaction is started. For new version of UpdateFeatures function, it will work the same as you pass in false for useTransaction.
     140Notes:
     141 * If any exception is thrown within the sql statement execution, the new API won't rollback the transaction internally. Instead, it depends on the client application to rollback the transaction explicitly as illustrated in above codes.
     142 * If a provider doesn't support transaction, !BeginTransaction() will throw an !MgInvalidOperationException saying transaction is not supported.
     143 * If passing in NULL for the parameter, !ExecuteSqlQuery and !ExecuteSqlNonQuery will work the same as before taking no transaction is started. For new version of !UpdateFeatures function, it will work the same as you pass in false for useTransaction.
    144144
    145 Timeout configuration for MgTransaction
     145Timeout configuration for !MgTransaction
    146146
    147147As the transaction is a critical resource for database applications, a server-side transaction can be left open while the application is doing other things in between sql or even worse the application may fail or hang and the server would not know. So it needs to set a timeout for all transactions. If a transaction hasn't been committed or rollbacked within the timeout, the server will automatically rollback the transaction. If you call Commit() or Rollback() on the MgTransaction instance after timeout, an exception will be thrown reminding that the transaction has been timeout and reverted.
     
    162162This new API is designed for sql statement execution. You have to use the API with !ExecuteSqlQuery() or !ExecuteSqlNonQuery() within the transaction.
    163163
    164 If the user uses the new UpdateFeatures function taking the transaction object, they should stick to that and not mix in the old UpdateFeatures() API.
     164If the user uses the new !UpdateFeatures function taking the transaction object, they should stick to that and not mix in the old !UpdateFeatures() API.
    165165
    166166== Test Plan ==