[pypy-svn] r69631 - in pypy/trunk/pypy/module/oracle: . test
afa at codespeak.net
afa at codespeak.net
Wed Nov 25 12:58:09 CET 2009
Author: afa
Date: Wed Nov 25 12:58:08 2009
New Revision: 69631
Modified:
pypy/trunk/pypy/module/oracle/interp_lob.py
pypy/trunk/pypy/module/oracle/test/test_lobvar.py
Log:
Add method ExternalLob.size()
Modified: pypy/trunk/pypy/module/oracle/interp_lob.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/interp_lob.py (original)
+++ pypy/trunk/pypy/module/oracle/interp_lob.py Wed Nov 25 12:58:08 2009
@@ -21,6 +21,11 @@
return self.lobVar.read(space, self.pos, offset, amount)
read.unwrap_spec=['self', ObjSpace, int, int]
+ def size(self, space):
+ self._verify(space)
+ return space.wrap(self.lobVar.getLength(space, self.pos))
+ size.unwrap_spec=['self', ObjSpace]
+
def desc_str(self, space):
return self.read(space, offset=1, amount=-1)
desc_str.unwrap_spec=['self', ObjSpace]
@@ -29,6 +34,8 @@
'ExternalLob',
read = interp2app(W_ExternalLob.read,
unwrap_spec=W_ExternalLob.read.unwrap_spec),
+ size = interp2app(W_ExternalLob.size,
+ unwrap_spec=W_ExternalLob.size.unwrap_spec),
__str__ = interp2app(W_ExternalLob.desc_str,
unwrap_spec=W_ExternalLob.desc_str.unwrap_spec),
)
Modified: pypy/trunk/pypy/module/oracle/test/test_lobvar.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/test/test_lobvar.py (original)
+++ pypy/trunk/pypy/module/oracle/test/test_lobvar.py Wed Nov 25 12:58:08 2009
@@ -27,6 +27,7 @@
lob=longString)
cur.execute("select lobcol from pypy_temp_lobtable")
lob, = cur.fetchone()
+ assert lob.size() == len(longString)
assert lob.read() == longString
class AppTestLob(LobTests, OracleTestBase):
More information about the Pypy-commit
mailing list