|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -#$Id: rdbms_common.py,v 1.177 2006-08-23 12:57:10 schlatterbeck Exp $ |
| 18 | +#$Id: rdbms_common.py,v 1.178 2006-08-29 04:20:50 richard Exp $ |
19 | 19 | ''' Relational database (SQL) backend common code. |
20 | 20 |
|
21 | 21 | Basics: |
@@ -1188,23 +1188,30 @@ def pack(self, pack_before): |
1188 | 1188 | "action<>'create'"%(classname, self.arg) |
1189 | 1189 | self.sql(sql, (date_stamp,)) |
1190 | 1190 |
|
1191 | | - def sql_commit(self): |
| 1191 | + def sql_commit(self, fail_ok=False): |
1192 | 1192 | ''' Actually commit to the database. |
1193 | 1193 | ''' |
1194 | 1194 | logging.getLogger('hyperdb').info('commit') |
| 1195 | + |
1195 | 1196 | self.conn.commit() |
1196 | 1197 |
|
1197 | 1198 | # open a new cursor for subsequent work |
1198 | 1199 | self.cursor = self.conn.cursor() |
1199 | 1200 |
|
1200 | | - def commit(self): |
| 1201 | + def commit(self, fail_ok=False): |
1201 | 1202 | ''' Commit the current transactions. |
1202 | 1203 |
|
1203 | 1204 | Save all data changed since the database was opened or since the |
1204 | 1205 | last commit() or rollback(). |
| 1206 | +
|
| 1207 | + fail_ok indicates that the commit is allowed to fail. This is used |
| 1208 | + in the web interface when committing cleaning of the session |
| 1209 | + database. We don't care if there's a concurrency issue there. |
| 1210 | +
|
| 1211 | + The only backend this seems to affect is postgres. |
1205 | 1212 | ''' |
1206 | 1213 | # commit the database |
1207 | | - self.sql_commit() |
| 1214 | + self.sql_commit(fail_ok) |
1208 | 1215 |
|
1209 | 1216 | # now, do all the other transaction stuff |
1210 | 1217 | for method, args in self.transactions: |
|
0 commit comments