[Zope-Checkins] CVS: Products/DCOracle2/DCOracle2 - DCOracle2.py:1.83

Matthew T. Kromer matt@zope.com
Thu, 11 Apr 2002 12:14:54 -0400


Update of /cvs-repository/Products/DCOracle2/DCOracle2
In directory cvs.zope.org:/tmp/cvs-serv5799/DCOracle2

Modified Files:
	DCOracle2.py 
Log Message:
Made synonyms work with stored procedures; the synonym will now be dereferenced
when the getattr is made on the procedure object


=== Products/DCOracle2/DCOracle2/DCOracle2.py 1.82 => 1.83 ===
             answer.append(contains)
 
+        if type == "synonym":
+            answer.append("%s.%s" % (
+                desc['OCI_ATTR_SCHEMA_NAME'],
+                desc['OCI_ATTR_NAME']
+                ))
+
+        if len(answer) < 4: answer.append(None)
+
         return answer
                 
 
@@ -519,6 +527,12 @@
                 answer = "%s\n%s%s" % (answer, "\t" * indent,
                     self.decodedesc(args[i],indent+1))
 
+        if type == "synonym":
+            answer = "%sfor %s.%s" % (answer, 
+                desc['OCI_ATTR_SCHEMA_NAME'],
+                desc['OCI_ATTR_NAME']
+                )
+
         if type == "argument" or type == "column":
             if type == "argument":
                 mode = desc['OCI_ATTR_IOMODE']
@@ -587,6 +601,8 @@
                 for d in sdesc[1:]:
                     answer = "%s%s" % (answer, self.decodecdesc(d,
                         indent=indent+1))
+            elif etype == "synonym":
+                answer = "%ssynonym for %s" % (answer, sdesc)
             elif etype == "argument":
                 if name is not None:
                     answer = "%s%s " % (answer, name)
@@ -627,9 +643,9 @@
         proc = {}
 
         (sname, uname, type, desc) = d
-        if type == "procedure" or type == "function":
+
+        if type == "procedure" or type == "function" or type == 'synonym':
             proc[name] = d
-            return proc
         elif type == "package":
             proc[name] = d
             for d1 in desc:
@@ -1358,6 +1374,7 @@
             d = newproc.__dict__    # Temporarily override the target dict
             inpkg = 1
 
+
         # Do all entries within the package
         for p in desc.keys():
             (schema, uname, type, pdesc) = desc[p]
@@ -1386,6 +1403,13 @@
                 newproc.__doc__ = cursor._connection.decodecdesc(
                     newproc._description, newproc.__name__)
                 d[uname] = newproc
+            elif type == 'synonym':
+               # OK now what?  we need to try to look up the synonym in
+               # this proc -- so we have to go back to the top level
+               # proc on the cursor (sigh)
+
+               newproc = cursor.findproc(pdesc)
+               d[uname] = newproc
         
         d = self.__dict__