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

afa at codespeak.net afa at codespeak.net
Thu Nov 19 00:58:43 CET 2009


Author: afa
Date: Thu Nov 19 00:58:42 2009
New Revision: 69406

Modified:
   pypy/trunk/pypy/module/oracle/__init__.py
   pypy/trunk/pypy/module/oracle/interp_variable.py
   pypy/trunk/pypy/module/oracle/test/test_stringvar.py
Log:
Ensure that variables are created with enough size


Modified: pypy/trunk/pypy/module/oracle/__init__.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/__init__.py	(original)
+++ pypy/trunk/pypy/module/oracle/__init__.py	Thu Nov 19 00:58:42 2009
@@ -10,6 +10,7 @@
         'STRING': 'interp_variable.VT_String',
         'DATETIME': 'interp_variable.VT_DateTime',
         'BINARY': 'interp_variable.VT_Binary',
+        'LONG_STRING': 'interp_variable.VT_LongString',
         'Variable': 'interp_variable.W_Variable',
     }
 

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	Thu Nov 19 00:58:42 2009
@@ -988,4 +988,4 @@
 
     # everything else ought to be a Python type
     varType = typeByPythonType(space, cursor, w_value)
-    return varType(cursor, numElements)
+    return varType(cursor, numElements, varType.size)

Modified: pypy/trunk/pypy/module/oracle/test/test_stringvar.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/test/test_stringvar.py	(original)
+++ pypy/trunk/pypy/module/oracle/test/test_stringvar.py	Thu Nov 19 00:58:42 2009
@@ -2,6 +2,16 @@
 
 class AppTestStringVar(OracleTestBase):
 
+    def test_bind_inout(self):
+        cur = self.cnx.cursor()
+        vars = cur.setinputsizes(value=oracle.STRING)
+        cur.execute("""
+            begin
+              :value := :value || ' output';
+            end;""",
+            value="input")
+        assert vars["value"].getvalue() == "input output"
+
     def test_rowid(self):
         cur = self.cnx.cursor()
         cur.execute("select rowid from dual")



More information about the Pypy-commit mailing list