changeset 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
files sqlpyPlus.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpyPlus.py	Thu Apr 10 12:36:49 2008 -0400
+++ b/sqlpyPlus.py	Thu Apr 10 15:10:20 2008 -0400
@@ -537,16 +537,17 @@
         
         options, arg = self.pullflags.parse(arg)
         object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper())
-        self.stdout.write("%s %s.%s\n" % (object_type, owner, object_name))
-        self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DDL', cx_Oracle.CLOB,
-                                 [object_type, object_name, owner])))
-        if options.has_key('full'):
-            for dependent_type in ('OBJECT_GRANT', 'CONSTRAINT', 'TRIGGER'):        
-                try:
-                    self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB,
-                                          [dependent_type, object_name, owner])))
-                except cx_Oracle.DatabaseError:
-                    pass
+        if object_type and owner and object_name:
+            self.stdout.write("%s %s.%s\n" % (object_type, owner, object_name))
+            self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DDL', cx_Oracle.CLOB,
+                                     [object_type, object_name, owner])))
+            if options.has_key('full'):
+                for dependent_type in ('OBJECT_GRANT', 'CONSTRAINT', 'TRIGGER'):        
+                    try:
+                        self.stdout.write(str(self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB,
+                                              [dependent_type, object_name, owner])))
+                    except cx_Oracle.DatabaseError:
+                        pass
 
     findflags = flagReader.FlagSet([flagReader.Flag('insensitive')])            
     def do_find(self, arg):