Revision 1872
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1 | 1 |
# Database access |
2 | 2 |
|
3 | 3 |
import copy |
4 |
import random |
|
5 | 4 |
import re |
6 | 5 |
import sys |
7 | 6 |
import warnings |
8 | 7 |
|
9 | 8 |
import exc |
9 |
import rand |
|
10 | 10 |
import strings |
11 | 11 |
import util |
12 | 12 |
|
... | ... | |
129 | 129 |
##### Recoverable querying |
130 | 130 |
|
131 | 131 |
def with_savepoint(db, func): |
132 |
savepoint = 'savepoint_'+str(random.randint(0, sys.maxint)) # must be unique
|
|
132 |
savepoint = 'savepoint_'+str(rand.rand_int()) # must be unique
|
|
133 | 133 |
run_raw_query(db, 'SAVEPOINT '+savepoint) |
134 | 134 |
try: return_val = func() |
135 | 135 |
except: |
Also available in: Unified diff
sql.py: with_savepoint(): Use new rand.rand_int()