Mercurial > hg > ZDBInterface
changeset 21:5f3d6623b71e
fixed bug when params to ZDBInlineSearch are not strings.
new method ZDBSlice.
author | casties |
---|---|
date | Fri, 08 Feb 2013 20:40:25 +0100 |
parents | 0e87d5d80709 |
children | 7ee835840724 |
files | DBInterface.py version.txt |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/DBInterface.py Fri Jan 11 19:14:07 2013 +0100 +++ b/DBInterface.py Fri Feb 08 20:40:25 2013 +0100 @@ -20,6 +20,9 @@ if s is None: return "" + if not isinstance(s, basestring): + s = str(s) + # remove ' s = s.replace("'","") # all else -> "_" @@ -92,6 +95,15 @@ return Results(res) + def ZDBSlice(self, results, size=0, offset=0): + """return a (subset-) list of rows from results. + ZRDB.Results doesn't do list-slicing.""" + res = [x for x in results] + if size > 0: + return res[offset:(offset+size)] + else: + return res[offset:] + # # Old way using cursor from DA #