|
From: Gerhard <ger...@gm...> - 2002-06-07 18:35:22
|
In a current project, I needed to wrap the PostgreSQL SQL extension MOVE
FORWARD/BACKWARD to move in server-side cursors. I'd suggest to add the
following method to the Cursor class:
def move(self, howmany)
where howmany can be a positive or negative number, which controls
wether the cursor is moved backward or forward. Comments?
One other thing for the PostgreSQL experts (ehem): am I correct that
there is no way of knowing how many rows a cursor contains? Is it really
the easiest solution to first do a SELECT COUNT on the same query?
I can imagine there might be a hack with moving forward/backward by
variying values to examine the number of rows in the cursor. Or is there
a clean solution that I'm missing?
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9 3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
|