Changeset 2033
- Timestamp:
- 05/04/10 13:29:00 (4 months ago)
- Location:
- trunk/modules
- Files:
-
- 3 modified
-
Db/source/database.cl (modified) (2 diffs)
-
Db/source/model.cl (modified) (1 diff)
-
Dbo/source/update.cl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/Db/source/database.cl
r1988 r2033 312 312 // commit all queries in a definitive way whereas rollbackTransaction(self) would 313 313 // left the database unchanged in addition to end the transaction. 314 [beginTransaction(self:Database) : void -> dbBeginTransaction(self)] 314 [beginTransaction(self:Database) : void -> 315 if (self.onTransaction?) commitTransaction(self), 316 self.onTransaction? := true, 317 dbBeginTransaction(self)] 315 318 316 319 // @doc Transaction 317 320 // commitTransaction(self) commits all queries that have been executed since 318 321 // the call to beginTransaction(self) and ends the current transaction. 319 [commitTransaction(self:Database) : void -> dbCommitTransaction(self)] 322 [commitTransaction(self:Database) : void -> 323 if self.onTransaction? 324 (self.onTransaction? := false, 325 dbCommitTransaction(self)) 326 else //[1] warning : call dbCommitTransaction(~S) without starting transaction // self 327 ] 320 328 321 329 // @doc Transaction 322 330 // rollbackTransaction(self) cancel all queries that have been executed since 323 331 // the call to beginTransaction(self) and ends the current transaction. 324 [rollbackTransaction(self:Database) : void -> dbRollbackTransaction(self)] 325 326 332 [rollbackTransaction(self:Database) : void -> 333 if self.onTransaction? 334 (self.onTransaction? := false, 335 dbRollbackTransaction(self)) 336 else //[1] warning : call dbCommitTransaction(~S) without starting transaction // self 337 ] 338 327 339 328 340 // @cat Disconnection … … 339 351 -> //[2] disconnect(DataBase = ~S) // self, 340 352 while self.queries free(self.queries[length(self.queries)]), 353 if self.onTransaction? commitTransaction(self), 341 354 dbDisconnect(self)] 342 355 -
trunk/modules/Db/source/model.cl
r1988 r2033 115 115 private/firstQuery:Query, // chained queries start here 116 116 private/currentQuery:Query, // the current working query 117 private/autoCommit?:boolean) 117 private/autoCommit?:boolean, 118 onTransaction?:boolean = false, 119 autoStartTransaction?:boolean = false) 118 120 119 121 (inverse(queries) := database) -
trunk/modules/Dbo/source/update.cl
r993 r2033 4 4 [dbUpdate(db:Db/Database, self:object, lp:list[dbProperty]) : boolean -> 5 5 //[DBOJECTS] dbUpdate(object = ~S, lp = (~A)) // self, lp, 6 if (db.Db/autoStartTransaction? & not(db.Db/onTransaction?)) Db/beginTransaction(db), 6 7 let idProp := getIdProperty(self), nParam := 1, Params := list<any>(), 7 8 prepare? := (db.shouldPrepare? & … … 41 42 42 43 -> //[DBOJECTS] dbUpdate(self = ~S,values = (~A), wheres = (~A)) // cl,values,wheres, 44 if (db.Db/autoStartTransaction? & not(db.Db/onTransaction?)) Db/beginTransaction(db), 43 45 let tmp:boolean := false, 44 46 n := 0, nParam := 1, Params := list<any>(),
