[Zope-Checkins] CVS: Products/DCOracle2 - CHANGELOG:1.57 DA.py:1.7 SP.py:1.11 db.py:1.13

Matthew T. Kromer matt@zope.com
Wed, 15 May 2002 17:14:24 -0400


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

Modified Files:
	CHANGELOG DA.py SP.py db.py 
Log Message:
Add user level procedure browser to stored procedure edit screen (does not
discover system-wide procedures)


=== Products/DCOracle2/CHANGELOG 1.56 => 1.57 ===
 		recreated (causes problems with error handling, because the
 		IDs of the error classes change)
+	     o  Add a user-level procedure browser to stored procedure
+	        edit screen.
 
 Desired Features Not Yet Implemented:
 


=== Products/DCOracle2/DA.py 1.6 => 1.7 ===
                                 check=None, REQUEST=None):
     """Add a Stored Procedure to a folder"""
-    self._setObject(id, Procedure(id, title, connection, procname, acquire,
-        check))
+    self._setObject(id, Procedure(id, title, connection, procname,
+        acquire, check))
     if REQUEST is not None: return self.manage_main(self,REQUEST)
 
 


=== Products/DCOracle2/SP.py 1.10 => 1.11 ===
         db = self._v_db = getattr(self,self.connection)() # Get connection
         c = db.cursor                          # Get cursor
-        p = c.findproc(self.procname)        # Get procedure
-        self._v_proc = p
+        self._errors = 0
+        if self.procname:
+            try:
+                p = c.findproc(self.procname)        # Get procedure
+                self._v_proc = p
+            except DCOracle2.DatabaseError:
+                self._errors = self._errors + 1
+                if self._errors > 3: raise
+                
 
     def _finish(self, *ignored):
         self._v_db.db.commit()
@@ -156,6 +163,42 @@
 
         return aq
 
+    def ZSPListPackage(self, package):
+
+        db = self._v_db.db
+
+        cd = db.collapsedesc(db.describe(package))
+
+        package = cd[1]
+        desc = cd[3]
+
+        results = []
+
+        for (schema, name, type, subdesc) in desc:
+            if type == 'procedure' or type == 'function':
+                results.append(('%s.%s' % (package, name),type.upper()))
+
+        return results
+
+    def ZSPListProcs(self):
+
+        results = []
+
+        if getattr(self,"_v_db",None) is None: self._connect()
+
+        objs = self._v_db.db.objects()
+
+        for (name, type) in objs:
+            if type in ('PROCEDURE', 'FUNCTION'):
+                results.append((name, type))
+            elif type == 'PACKAGE':
+                r = self.ZSPListPackage(name)
+                for entry in r:
+                    results.append(entry)
+
+        results.sort()
+        return results
+
     def __call__(self, *args, **kw):
         if not getSecurityManager().checkPermission(
             'Execute %s Stored Procedures' % dbstring, self):
@@ -213,11 +256,11 @@
         return ins
 
     def manage_editZOracleStoredProcedure(self, title, connection, procname,
-        acquire, URL1, RESPONSE=None):
+        procname2, acquire, URL1, RESPONSE=None):
         """Edit the stored procedure"""
         self.title = title
         self.connection = connection
-        self.procname = procname
+        self.procname = procname or procname2
         self.acquire = acquire
         self._v_proc = None
         RESPONSE.redirect(URL1 + "/manage_procview?manage_tabs_message=Stored%20Procedure%20Changed")


=== Products/DCOracle2/db.py 1.12 => 1.13 ===
     __allow_access_to_unprotected_subobjects__ = 1
 
+    #__ac_permissions__ = (
+    #    ('Use LOB objects',     ('','read','write','trim','length')),
+    #    )
+
     def __init__(self, lob):
         self.lob = lob
         self.read = lob.read