Mercurial > sqlpython
comparison sqlpyPlus.py @ 13:7c073794564a
holy cow, pull -f works even better
author | devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil |
---|---|
date | Tue, 18 Dec 2007 19:09:18 -0500 |
parents | 7d27bb74ba90 |
children | 1300a997d319 |
comparison
equal
deleted
inserted
replaced
12:7d27bb74ba90 | 13:7c073794564a |
---|---|
662 setattr(self, paramName.lower(), val) | 662 setattr(self, paramName.lower(), val) |
663 print 'now: ', val | 663 print 'now: ', val |
664 | 664 |
665 pullflags = flagReader.FlagSet([flagReader.Flag('full')]) | 665 pullflags = flagReader.FlagSet([flagReader.Flag('full')]) |
666 def do_pull(self, arg): | 666 def do_pull(self, arg): |
667 "Displays source code." | 667 "Displays source code (pull -f to get dependent objects as well)." |
668 | 668 |
669 options, arg = self.pullflags.parse(arg) | 669 options, arg = self.pullflags.parse(arg) |
670 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) | 670 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) |
671 print "%s %s.%s" % (object_type, owner, object_name) | 671 print "%s %s.%s" % (object_type, owner, object_name) |
672 print self.curs.callfunc('DBMS_METADATA.GET_DDL', cx_Oracle.CLOB, | 672 print self.curs.callfunc('DBMS_METADATA.GET_DDL', cx_Oracle.CLOB, |
673 [object_type, object_name, owner]) | 673 [object_type, object_name, owner]) |
674 if options.has_key('full'): | 674 if options.has_key('full'): |
675 if object_type == 'TABLE': | 675 for dependent_type in ('OBJECT_GRANT', 'CONSTRAINT', 'TRIGGER'): |
676 dependent_types = ['TRIGGER'] | 676 try: |
677 else: | 677 print self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB, |
678 dependent_types = [] | 678 [dependent_type, object_name, owner]) |
679 for dependent_type in dependent_types: | 679 except cx_Oracle.DatabaseError: |
680 print self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB, | 680 pass |
681 [dependent_type, object_name, owner]) | |
682 | 681 |
683 def do_describe(self, arg): | 682 def do_describe(self, arg): |
684 "emulates SQL*Plus's DESCRIBE" | 683 "emulates SQL*Plus's DESCRIBE" |
685 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) | 684 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) |
686 print "%s %s.%s" % (object_type, owner, object_name) | 685 print "%s %s.%s" % (object_type, owner, object_name) |