comparison sqlpyPlus.py @ 84:a7be838c4ad5

fixes to --all
author catherine@cordelia
date Thu, 15 May 2008 17:37:54 -0400
parents 5701fb63e81d
children b336d049cac7
comparison
equal deleted inserted replaced
83:5701fb63e81d 84:a7be838c4ad5
738 except KeyError: 738 except KeyError:
739 print 'psql command \%s not yet supported.' % abbrev 739 print 'psql command \%s not yet supported.' % abbrev
740 740
741 @options([make_option('-a','--all',action='store_true', 741 @options([make_option('-a','--all',action='store_true',
742 help='Describe all objects (not just my own)')]) 742 help='Describe all objects (not just my own)')])
743 def do__dir_tables(self, arg): 743 def do__dir_tables(self, arg, opts):
744 if opts.all: 744 if opts.all:
745 which_view = (', owner', 'all') 745 which_view = (', owner', 'all')
746 else: 746 else:
747 which_view = ('', 'user') 747 which_view = ('', 'user')
748 self.do_select("""table_name, 'TABLE' as type%s FROM %s_tables WHERE table_name LIKE '%%%s%%'""" % 748 self.do_select("""table_name, 'TABLE' as type%s FROM %s_tables WHERE table_name LIKE '%%%s%%'""" %
749 (which_view[0], which_view[1], arg.upper())) 749 (which_view[0], which_view[1], arg.upper()))
750 750
751 @options([make_option('-a','--all',action='store_true', 751 @options([make_option('-a','--all',action='store_true',
752 help='Describe all objects (not just my own)')]) 752 help='Describe all objects (not just my own)')])
753 def do__dir_views(self, arg): 753 def do__dir_views(self, arg, opts):
754 if opts.all: 754 if opts.all:
755 which_view = (', owner', 'all') 755 which_view = (', owner', 'all')
756 else: 756 else:
757 which_view = ('', 'user') 757 which_view = ('', 'user')
758 self.do_select("""view_name, 'VIEW' as type%s FROM %s_views WHERE view_name LIKE '%%%s%%'""" % 758 self.do_select("""view_name, 'VIEW' as type%s FROM %s_views WHERE view_name LIKE '%%%s%%'""" %
759 (which_view[0], which_view[1], arg.upper())) 759 (which_view[0], which_view[1], arg.upper()))
760 760
761 @options([make_option('-a','--all',action='store_true', 761 @options([make_option('-a','--all',action='store_true',
762 help='Describe all objects (not just my own)')]) 762 help='Describe all objects (not just my own)')])
763 def do__dir_indexes(self, arg): 763 def do__dir_indexes(self, arg, opts):
764 if opts.all: 764 if opts.all:
765 which_view = (', owner', 'all') 765 which_view = (', owner', 'all')
766 else: 766 else:
767 which_view = ('', 'user') 767 which_view = ('', 'user')
768 self.do_select("""index_name, index_type%s FROM %s_indexes WHERE index_name LIKE '%%%s%%' OR table_name LIKE '%%%s%%'""" % 768 self.do_select("""index_name, index_type%s FROM %s_indexes WHERE index_name LIKE '%%%s%%' OR table_name LIKE '%%%s%%'""" %