comparison sqlpyPlus.py @ 6:f9ec5c20beb4

working on resolving more objects
author devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil
date Tue, 04 Dec 2007 17:35:37 -0500
parents 65ae6cec71c6
children d44784122203
comparison
equal deleted inserted replaced
5:65ae6cec71c6 6:f9ec5c20beb4
30 'PROCEDURE':(""" 30 'PROCEDURE':("""
31 text 31 text
32 FROM all_source 32 FROM all_source
33 WHERE owner = :owner 33 WHERE owner = :owner
34 AND name = :object_name 34 AND name = :object_name
35 """,),
36 'PACKAGE':("""
37 text
38 FROM all_source
39 WHERE owner = :owner
40 AND name = :object_name
41 AND type = 'PACKAGE_BODY'
42 """,),
43 'TYPE':("""
44 text
45 FROM all_source
46 WHERE owner = :owner
47 AND name = :object_name
48 AND type = 'TYPE'
49 """,
50 """
51 text
52 FROM all_source
53 WHERE owner = :owner
54 AND name = :object_name
55 AND type = 'TYPE_BODY'
35 """,) 56 """,)
36 } 57 }
37 pullQueries['TRIGGER'] = pullQueries['PROCEDURE'] 58 pullQueries['TRIGGER'] = pullQueries['PROCEDURE']
38 pullQueries['FUNCTION'] = pullQueries['PROCEDURE'] 59 pullQueries['FUNCTION'] = pullQueries['PROCEDURE']
39 60
143 FROM all_objects ao 164 FROM all_objects ao
144 JOIN all_synonyms asyn ON (asyn.table_owner = ao.owner AND asyn.table_name = ao.object_name) 165 JOIN all_synonyms asyn ON (asyn.table_owner = ao.owner AND asyn.table_name = ao.object_name)
145 WHERE asyn.synonym_name = :objName 166 WHERE asyn.synonym_name = :objName
146 AND ao.object_type != 'SYNONYM' 167 AND ao.object_type != 'SYNONYM'
147 AND asyn.owner = 'PUBLIC' 168 AND asyn.owner = 'PUBLIC'
169 UNION ALL
170 SELECT 'DIRECTORY' object_type, dir.directory_name, dir.owner, 6 priority
171 FROM all_directories dir
172 WHERE dir.directory_name = :objName
173 UNION ALL
174 SELECT 'DATABASE LINK' object_type, db_link, owner, 7 priority
175 FROM all_db_links dbl
176 WHERE dbl.db_link = :objName
148 ) ORDER BY priority ASC""", 177 ) ORDER BY priority ASC""",
149 'tabComments': """ 178 'tabComments': """
150 SELECT comments 179 SELECT comments
151 FROM all_tab_comments 180 FROM all_tab_comments
152 WHERE owner = :owner 181 WHERE owner = :owner
620 return 649 return
621 val = self.cast(current, val.strip(';')) 650 val = self.cast(current, val.strip(';'))
622 print paramName, ' - was: ', current 651 print paramName, ' - was: ', current
623 setattr(self, paramName.lower(), val) 652 setattr(self, paramName.lower(), val)
624 print 'now: ', val 653 print 'now: ', val
654
655 def do_pull(self, arg):
656 "Displays source code."
657
658 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper())
659 print "%s %s.%s" % (object_type, owner, object_name)
660 pullQ = pullQueries.get(object_type)
661 if pullQ:
662 for q in pullQ:
663 self.do_select(q,bindVarsIn={'object_name':object_name, 'owner':owner})
625 664
626 def do_describe(self, arg): 665 def do_describe(self, arg):
627 "emulates SQL*Plus's DESCRIBE" 666 "emulates SQL*Plus's DESCRIBE"
628 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) 667 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper())
629 print "%s %s.%s" % (object_type, owner, object_name) 668 print "%s %s.%s" % (object_type, owner, object_name)