comparison sqlpyPlus.py @ 69:1551db32abff

do_pull was crashing when object not resolved
author catherine@DellZilla.myhome.westell.com
date Thu, 10 Apr 2008 15:10:20 -0400
parents ffd095bf466c
children 9427aa0726fa
comparison
equal deleted inserted replaced
68:ffd095bf466c 69:1551db32abff
535 535
536 --full, -f: get dependent objects as well""" 536 --full, -f: get dependent objects as well"""
537 537
538 options, arg = self.pullflags.parse(arg) 538 options, arg = self.pullflags.parse(arg)
539 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) 539 object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper())
540 self.stdout.write("%s %s.%s\n" % (object_type, owner, object_name)) 540 if object_type and owner and object_name:
541 self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DDL', cx_Oracle.CLOB, 541 self.stdout.write("%s %s.%s\n" % (object_type, owner, object_name))
542 [object_type, object_name, owner]))) 542 self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DDL', cx_Oracle.CLOB,
543 if options.has_key('full'): 543 [object_type, object_name, owner])))
544 for dependent_type in ('OBJECT_GRANT', 'CONSTRAINT', 'TRIGGER'): 544 if options.has_key('full'):
545 try: 545 for dependent_type in ('OBJECT_GRANT', 'CONSTRAINT', 'TRIGGER'):
546 self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB, 546 try:
547 [dependent_type, object_name, owner]))) 547 self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB,
548 except cx_Oracle.DatabaseError: 548 [dependent_type, object_name, owner])))
549 pass 549 except cx_Oracle.DatabaseError:
550 pass
550 551
551 findflags = flagReader.FlagSet([flagReader.Flag('insensitive')]) 552 findflags = flagReader.FlagSet([flagReader.Flag('insensitive')])
552 def do_find(self, arg): 553 def do_find(self, arg):
553 """Finds argument in source code. 554 """Finds argument in source code.
554 555