[pypy-svn] r69461 - pypy/trunk/pypy/module/oracle

afa at codespeak.net afa at codespeak.net
Fri Nov 20 10:28:55 CET 2009


Author: afa
Date: Fri Nov 20 10:28:54 2009
New Revision: 69461

Modified:
   pypy/trunk/pypy/module/oracle/interp_connect.py
   pypy/trunk/pypy/module/oracle/interp_cursor.py
   pypy/trunk/pypy/module/oracle/roci.py
Log:
Some fixes found when trying to translate.


Modified: pypy/trunk/pypy/module/oracle/interp_connect.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/interp_connect.py	(original)
+++ pypy/trunk/pypy/module/oracle/interp_connect.py	Fri Nov 20 10:28:54 2009
@@ -43,7 +43,7 @@
         W_Connection.__init__(self)
 
         # set up the environment
-        if w_pool:
+        if 0 and w_pool: # XXX
             pool = space.instance_w(W_Pool, w_pool)
             self.environment = pool.environment.clone()
         else:
@@ -150,6 +150,8 @@
         finally:
             lltype.free(handleptr, flavor='raw')
 
+        credentialType = roci.OCI_CRED_EXT
+
         # set user name in session handle
         stringBuffer.fill(space, self.w_username)
         try:
@@ -322,7 +324,7 @@
             return self.w_version
 
         # allocate a cursor to retrieve the version
-        cursor = self.newCursor(space)
+        cursor = W_Cursor(space, self)
 
         # allocate version and compatibility variables
         versionVar = VT_String(cursor, cursor.arraySize, MAX_STRING_CHARS)

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	Fri Nov 20 10:28:54 2009
@@ -128,7 +128,7 @@
         # queries are not supported as the result is undefined
         if self.statementType == roci.OCI_STMT_SELECT:
             raise OperationError(
-                w_NotSupportedErrorException,
+                get(space).w_NotSupportedErrorException,
                 space.wrap("queries not supported: results undefined"))
 
         # perform binds
@@ -207,8 +207,8 @@
             w_vars = w_args
 
         # build up the statement
-        args = ', '.join(':%d' % (i + offset + 1,)
-                         for i in range(numArguments))
+        args = ', '.join([':%d' % (i + offset + 1,)
+                          for i in range(numArguments)])
         if retvar:
             stmt = "begin :1 := %s(%s); end;" % (name, args)
         else:
@@ -226,7 +226,7 @@
         if not self.handle:
             return
         if self.isOwned:
-            roci.OciHandleFree(self.handle, OCI_HTYPE_STMT)
+            roci.OCIHandleFree(self.handle, roci.OCI_HTYPE_STMT)
         elif self.connection.handle:
             tagBuffer = StringBuffer()
             tagBuffer.fill(space, self.w_statementTag)
@@ -958,7 +958,7 @@
             numElements = space.int_w(w_value)
         else:
             raise OperationError(
-                w_NotSupportedErrorException,
+                get(space).w_NotSupportedErrorException,
                 space.wrap("expecting integer or list of values"))
 
         # create the variable
@@ -1017,24 +1017,24 @@
     setoutputsize.unwrap_spec = ['self', ObjSpace, int, int]
 
 
-def cursor_arraysize_get(space, obj):
-    return space.wrap(obj.arraySize)
-def cursor_arraysize_set(space, obj, w_value):
-    obj.arraySize = space.int_w(w_value)
-
-def cursor_bindarraysize_get(space, obj):
-    return space.wrap(obj.bindArraySize)
-def cursor_bindarraysize_set(space, obj, w_value):
-    obj.bindArraySize = space.int_w(w_value)
-
-def cursor_bindvars_get(space, obj):
-    if obj.bindList:
-        return space.newlist(obj.bindList)
-    if obj.bindDict:
-        return obj.bindDict
+    def arraysize_get(space, self):
+        return space.wrap(self.arraySize)
+    def arraysize_set(space, self, w_value):
+        self.arraySize = space.int_w(w_value)
+
+    def bindarraysize_get(space, self):
+        return space.wrap(self.bindArraySize)
+    def bindarraysize_set(space, self, w_value):
+        self.bindArraySize = space.int_w(w_value)
 
-def cursor_fetchvars_get(space, obj):
-    return space.newlist(obj.fetchVariables)
+    def bindvars_get(space, self):
+        if self.bindList:
+            return space.newlist(self.bindList)
+        if self.bindDict:
+            return self.bindDict
+
+    def fetchvars_get(space, self):
+        return space.newlist(self.fetchVariables)
 
 W_Cursor.typedef = TypeDef(
     'Cursor',
@@ -1070,11 +1070,13 @@
     __iter__ = interp2app(W_Cursor.descr_iter),
     next = interp2app(W_Cursor.descr_next),
 
-    arraysize = GetSetProperty(cursor_arraysize_get, cursor_arraysize_set),
-    bindarraysize = GetSetProperty(cursor_bindarraysize_get, cursor_bindarraysize_set),
+    arraysize = GetSetProperty(W_Cursor.arraysize_get,
+                               W_Cursor.arraysize_set),
+    bindarraysize = GetSetProperty(W_Cursor.bindarraysize_get,
+                                   W_Cursor.bindarraysize_set),
     rowcount = interp_attrproperty('rowCount', W_Cursor),
     statement = interp_attrproperty_w('w_statement', W_Cursor),
-    bindvars = GetSetProperty(cursor_bindvars_get),
-    fetchvars = GetSetProperty(cursor_fetchvars_get),
+    bindvars = GetSetProperty(W_Cursor.bindvars_get),
+    fetchvars = GetSetProperty(W_Cursor.fetchvars_get),
     description = GetSetProperty(W_Cursor.getDescription),
 )

Modified: pypy/trunk/pypy/module/oracle/roci.py
==============================================================================
--- pypy/trunk/pypy/module/oracle/roci.py	(original)
+++ pypy/trunk/pypy/module/oracle/roci.py	Fri Nov 20 10:28:54 2009
@@ -51,7 +51,7 @@
     OCI_HTYPE_ERROR OCI_HTYPE_SVCCTX OCI_HTYPE_SERVER OCI_HTYPE_SESSION
     OCI_HTYPE_STMT OCI_HTYPE_DESCRIBE OCI_HTYPE_ENV
     OCI_DTYPE_PARAM
-    OCI_CRED_RDBMS OCI_SPOOL_ATTRVAL_NOWAIT
+    OCI_CRED_RDBMS OCI_CRED_EXT OCI_SPOOL_ATTRVAL_NOWAIT
     OCI_ATTR_SERVER OCI_ATTR_SESSION OCI_ATTR_USERNAME OCI_ATTR_PASSWORD
     OCI_ATTR_STMT_TYPE OCI_ATTR_PARAM_COUNT OCI_ATTR_ROW_COUNT
     OCI_ATTR_NAME OCI_ATTR_SCALE OCI_ATTR_PRECISION OCI_ATTR_IS_NULL



More information about the Pypy-commit mailing list