# HG changeset patch # User catherine@cordelia # Date 1208871175 14400 # Node ID 4b5d4e5798dd5086f21eb9a72629abfa3d2127b3 # Parent 9427aa0726fa24004d95d51f9c53b9b74bdbe1b9 \d with wildcard diff -r 9427aa0726fa -r 4b5d4e5798dd sqlpyPlus.py --- a/sqlpyPlus.py Mon Apr 21 09:35:31 2008 -0400 +++ b/sqlpyPlus.py Tue Apr 22 09:32:55 2008 -0400 @@ -564,7 +564,17 @@ def do_describe(self, arg): "emulates SQL*Plus's DESCRIBE" + + if not arg: + self.do_select("""object_name, object_type FROM all_objects WHERE object_type IN ('TABLE','VIEW','INDEX') ORDER BY object_name""") + return object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) + if not object_type: + self.do_select("""object_name, object_type FROM all_objects + WHERE object_type IN ('TABLE','VIEW','INDEX') + AND object_name LIKE '%%%s%%' + ORDER BY object_name""" % arg.upper() ) + return self.stdout.write("%s %s.%s\n" % (object_type, owner, object_name)) descQ = descQueries.get(object_type) if descQ: @@ -679,6 +689,7 @@ \i getrun \o spool \p list + \q quit \w save \db _dir_tablespaces \dd comments @@ -698,14 +709,13 @@ except IndexError: args = '' try: - self.onecmd('%s %s' % (commands[abbrev], args)) - self.onecmd('q') + return self.onecmd('%s %s' % (commands[abbrev], args)) except KeyError: print 'psql command \%s not yet supported.' % abbrev - + def do__dir_tables(self, arg): self.do_select("""table_name, 'TABLE' as type, owner FROM all_tables WHERE table_name LIKE '%%%s%%'""" % arg.upper()) - + def do__dir_views(self, arg): self.do_select("""view_name, 'VIEW' as type, owner FROM all_views WHERE view_name LIKE '%%%s%%'""" % arg.upper())