[pypy-svn] r69438 - in pypy/trunk/pypy/module/oracle: . test

afa at codespeak.net afa at codespeak.net
Thu Nov 19 13:22:45 CET 2009


Author: afa
Date: Thu Nov 19 13:22:44 2009
New Revision: 69438

Modified:
   pypy/trunk/pypy/module/oracle/interp_cursor.py
   pypy/trunk/pypy/module/oracle/test/test_select.py
Log:
Add cursor.fetchvars()


Modified: pypy/trunk/pypy/module/oracle/interp_cursor.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/interp_cursor.py	(original)
+++ pypy/trunk/pypy/module/oracle/interp_cursor.py	Thu Nov 19 13:22:44 2009
@@ -1033,6 +1033,9 @@
     if obj.bindDict:
         return obj.bindDict
 
+def cursor_fetchvars_get(space, obj):
+    return space.newlist(obj.fetchVariables)
+
 W_Cursor.typedef = TypeDef(
     'Cursor',
     execute = interp2app(W_Cursor.execute,
@@ -1072,5 +1075,6 @@
     rowcount = interp_attrproperty('rowCount', W_Cursor),
     statement = interp_attrproperty_w('w_statement', W_Cursor),
     bindvars = GetSetProperty(cursor_bindvars_get),
+    fetchvars = GetSetProperty(cursor_fetchvars_get),
     description = GetSetProperty(W_Cursor.getDescription),
 )

Modified: pypy/trunk/pypy/module/oracle/test/test_select.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/test/test_select.py	(original)
+++ pypy/trunk/pypy/module/oracle/test/test_select.py	Thu Nov 19 13:22:44 2009
@@ -10,6 +10,9 @@
         assert isinstance(row[1], str)
         assert row == (42, 'Hello')
 
+        assert isinstance(cur.fetchvars[0], oracle.Variable)
+        assert isinstance(cur.fetchvars[1], oracle.Variable)
+
     def test_sysdate(self):
         import datetime
         cur = self.cnx.cursor()
@@ -19,7 +22,7 @@
         assert isinstance(sysdate, datetime.datetime)
         delta = abs(sysdate - datetime.datetime.now())
         assert delta < datetime.timedelta(seconds=2)
-        
+
     def test_fetchall(self):
         cur = self.cnx.cursor()
         # An Oracle trick to retrieve 42 lines
@@ -44,4 +47,3 @@
             assert row == (i,)
         assert i == 41
 
-        



More information about the Pypy-commit mailing list