Changes between Version 27 and Version 28 of MapGuideRfc78
- Timestamp:
- 07/16/09 19:30:47 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MapGuideRfc78
v27 v28 41 41 CREFSTRING sqlNonSelectStatement ) = 0; 42 42 }}} 43 This proposal is to ex tend Feature Service to supportexecuting a sequence of sql statements within a single transaction.43 This proposal is to expose a seperate transaction control from Feature Service to enable executing a sequence of sql statements within a single transaction. 44 44 45 45 == Proposed Solution == 46 46 47 A new class of !MgTransaction will be added to represent a transaction to be performed in a data store.47 A new class of MgTransaction will be added to represent a transaction to be performed in a data store. 48 48 {{{ 49 49 /// \brief … … 76 76 Changes to Feature Service 77 77 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. 79 79 80 80 {{{ … … 113 113 One example using the new API 114 114 {{{ 115 MgTransaction* tran = AcMapFeatureService::StartTransaction(resourceId);116 AcMapFeatureService::ExecuteSql(resourceId, sql statement1, tran);117 AcMapFeatureService::ExecuteSql(resourceId, sql statement2, tran);115 MgTransaction* tran = MgFeatureService::StartTransaction(resourceId); 116 MgFeatureService::ExecuteSql(resourceId, sql statement1, tran); 117 MgFeatureService::ExecuteSql(resourceId, sql statement2, tran); 118 118 tran->Commit() // or tran->Rollback(); 119 119 }}} 120 120 121 Timeout configuration for !MgTransaction121 Timeout configuration for MgTransaction 122 122 123 If an !MgTransaction has been started but hasn't been committed or rollbacked within the timeout, the transaction will be automatically rollbacked. If you call Commit() or Rollback() after timeout, an exception will be thrown reminding that the transaction has been timeout.123 As 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. 124 124 125 Two items will be added into serverconfig.ini for transaction timeout setting. If the transaction hasn't been committed or rollbacked within thirtyminutes, it will be automatically rollbacked.125 Two items will be added into serverconfig.ini for transaction timeout setting. If the transaction hasn't been committed or rollbacked within 2 minutes, it will be automatically rollbacked. 126 126 {{{ 127 127 DataTransactionTimeout = 120