Revision 863
Added by Aaron Marcuse-Kubitza about 13 years ago
lib/sql.py | ||
---|---|---|
98 | 98 |
|
99 | 99 |
##### Basic queries |
100 | 100 |
|
101 |
def select(db, table, fields, conds, limit=None, recover=None): |
|
101 |
def select(db, table, fields, conds, limit=None, start=None, recover=None):
|
|
102 | 102 |
assert limit == None or type(limit) == int |
103 | 103 |
check_name(table) |
104 | 104 |
map(check_name, fields) |
... | ... | |
115 | 115 |
if conds != {}: |
116 | 116 |
query += ' WHERE '+' AND '.join(map(cond, conds.iteritems())) |
117 | 117 |
if limit != None: query += ' LIMIT '+str(limit) |
118 |
if start != None: query += ' OFFSET '+str(start) |
|
118 | 119 |
return run_query(db, query, conds.values(), recover) |
119 | 120 |
|
120 | 121 |
def insert(db, table, row, recover=None): |
Also available in: Unified diff
sql.py: Added start option to select() to set the OFFSET