changeset 263:362db47c17b4

error reported
author catherine@Elli.myhome.westell.com
date Mon, 16 Mar 2009 17:48:54 -0400
parents f1916065f95d
children a8deaa38f11e
files sqlpython/sqlpython.py
diffstat 1 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/sqlpython.py	Mon Mar 16 16:24:49 2009 -0400
+++ b/sqlpython/sqlpython.py	Mon Mar 16 17:48:54 2009 -0400
@@ -193,7 +193,32 @@
             command = '%s %s;'
         else:
             command = '%s %s'        
-        self.curs.execute(command % (arg.parsed.command, arg.parsed.args), self.varsUsed)            
+        self.curs.execute('select sysdate from dual')
+        timestamp = self.curs.fetchone()[0]
+        self.orcl.commit()
+        self.curs.execute(command % (arg.parsed.command, arg.parsed.args), self.varsUsed)
+        self.curs.execute('''
+            SELECT ae.owner, ae.name, ae.type, ae.position, ae.line, ae.attribute, 
+                   ae.text error_text,
+                   src.text object_text,
+                   ao.last_ddl_time
+            FROM   all_errors ae
+            JOIN   all_objects ao ON (    ae.owner = ao.owner
+                                      AND ae.name = ao.object_name
+                                      AND ae.type = ao.object_type)
+            JOIN   all_source src ON (    ae.owner = src.owner
+                                      AND ae.name = src.name
+                                      AND ae.type = src.type
+                                      AND ae.line = src.line)
+            WHERE  ao.last_ddl_time >= :timestamp
+            ORDER BY ae.sequence ASC'''
+                          , {'timestamp': timestamp}
+                                       )
+        for err in self.curs:
+            print '%s at line %d of %s %s.%s:' % (err[5], err[4], err[2], err[0], err[1])
+            print err[7]
+            print (' ' * (err[3]-1)) + '^'
+            print err[6]
         print '\nExecuted%s\n' % ((self.curs.rowcount > 0) and ' (%d rows)' % self.curs.rowcount or '')
             
     def do_commit(self, arg=''):