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

afa at codespeak.net afa at codespeak.net
Wed Nov 25 13:48:37 CET 2009


Author: afa
Date: Wed Nov 25 13:48:36 2009
New Revision: 69633

Modified:
   pypy/trunk/pypy/module/oracle/interp_variable.py
   pypy/trunk/pypy/module/oracle/test/test_lobvar.py
Log:
Bah. Fix the test, then fix the bug.


Modified: pypy/trunk/pypy/module/oracle/interp_variable.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/interp_variable.py	(original)
+++ pypy/trunk/pypy/module/oracle/interp_variable.py	Wed Nov 25 13:48:36 2009
@@ -1026,6 +1026,10 @@
         amountptr[0] = rffi.cast(roci.ub4, databuf.size)
 
         try:
+            # nothing to do if no data to write
+            if databuf.size == 0:
+                return
+
             status = roci.OCILobWrite(
                 self.connection.handle,
                 self.environment.errorHandle,

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 13:48:36 2009
@@ -19,16 +19,17 @@
 
         longString = ""
         for i in range(2):
+            cur.execute("truncate table pypy_temp_lobtable")
             if i > 0:
                 longString += chr(65+i) * 25000
 
-        cur.setinputsizes(lob=inputType)
-        cur.execute("insert into pypy_temp_lobtable values (:lob)",
-                    lob=longString)
-        cur.execute("select lobcol from pypy_temp_lobtable")
-        lob, = cur.fetchone()
-        assert lob.size() == len(longString)
-        assert lob.read() == longString
+            cur.setinputsizes(lob=inputType)
+            cur.execute("insert into pypy_temp_lobtable values (:lob)",
+                        lob=longString)
+            cur.execute("select lobcol from pypy_temp_lobtable")
+            lob, = cur.fetchone()
+            assert lob.size() == len(longString)
+            assert lob.read() == longString
 
     def test_trim(self):
         inputType = getattr(oracle, self.lobType)



More information about the Pypy-commit mailing list