# HG changeset patch # User devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil # Date 1196807737 18000 # Node ID f9ec5c20beb4cb4d79c0a99b2dd1fcbf7714d6a7 # Parent 65ae6cec71c62bba4400d48e1635df04eedcbaf7 working on resolving more objects diff -r 65ae6cec71c6 -r f9ec5c20beb4 sqlpyPlus.py --- a/sqlpyPlus.py Tue Dec 04 17:19:18 2007 -0500 +++ b/sqlpyPlus.py Tue Dec 04 17:35:37 2007 -0500 @@ -32,6 +32,27 @@ FROM all_source WHERE owner = :owner AND name = :object_name +""",), +'PACKAGE':(""" +text +FROM all_source +WHERE owner = :owner +AND name = :object_name +AND type = 'PACKAGE_BODY' +""",), +'TYPE':(""" +text +FROM all_source +WHERE owner = :owner +AND name = :object_name +AND type = 'TYPE' +""", +""" +text +FROM all_source +WHERE owner = :owner +AND name = :object_name +AND type = 'TYPE_BODY' """,) } pullQueries['TRIGGER'] = pullQueries['PROCEDURE'] @@ -145,6 +166,14 @@ WHERE asyn.synonym_name = :objName AND ao.object_type != 'SYNONYM' AND asyn.owner = 'PUBLIC' + UNION ALL + SELECT 'DIRECTORY' object_type, dir.directory_name, dir.owner, 6 priority + FROM all_directories dir + WHERE dir.directory_name = :objName + UNION ALL + SELECT 'DATABASE LINK' object_type, db_link, owner, 7 priority + FROM all_db_links dbl + WHERE dbl.db_link = :objName ) ORDER BY priority ASC""", 'tabComments': """ SELECT comments @@ -622,6 +651,16 @@ print paramName, ' - was: ', current setattr(self, paramName.lower(), val) print 'now: ', val + + def do_pull(self, arg): + "Displays source code." + + object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) + print "%s %s.%s" % (object_type, owner, object_name) + pullQ = pullQueries.get(object_type) + if pullQ: + for q in pullQ: + self.do_select(q,bindVarsIn={'object_name':object_name, 'owner':owner}) def do_describe(self, arg): "emulates SQL*Plus's DESCRIBE"