comparison sqlpyPlus.py @ 150:b00a020b81c6

ready ? with 1.4.9
author catherine@dellzilla
date Fri, 26 Sep 2008 13:03:10 -0400
parents 3b1e25cc0e38
children 802d8df993da
comparison
equal deleted inserted replaced
149:3b1e25cc0e38 150:b00a020b81c6
836 return 836 return
837 except ValueError: 837 except ValueError:
838 try: 838 try:
839 self.binds[var] = float(val) 839 self.binds[var] = float(val)
840 return 840 return
841 except ValueError: 841 except ValueError:
842 statekeeper = Statekeeper(self, ('autobind',)) 842 statekeeper = Statekeeper(self, ('autobind',))
843 self.autobind = True 843 self.autobind = True
844 self.do_select('%s AS %s FROM dual;' % (val, var)) 844 self.do_select('%s AS %s FROM dual;' % (val, var))
845 statekeeper.restore() 845 statekeeper.restore()
846 846
912 result.append('%s/%s' % (object_type, qualified_name)) 912 result.append('%s/%s' % (object_type, qualified_name))
913 self.stdout.write('\n'.join(result) + '\n') 913 self.stdout.write('\n'.join(result) + '\n')
914 914
915 def do_cat(self, arg): 915 def do_cat(self, arg):
916 '''cat TABLENAME --> SELECT * FROM equivalent''' 916 '''cat TABLENAME --> SELECT * FROM equivalent'''
917 targets = arg.strip().split() 917 if not arg:
918 print self.do_cat.__doc__
919 return
920 arg = self.parsed(arg)
921 targets = arg.unterminated.split()
918 for target in targets: 922 for target in targets:
919 self.do_select('* from %s' % target) 923 self.do_select('* from %s%s%s' % (target, arg.terminator, arg.rowlimit)) # permissive of space before terminator
920 924
921 @options([make_option('-i', '--ignore-case', dest='ignorecase', action='store_true', help='Case-insensitive search')]) 925 @options([make_option('-i', '--ignore-case', dest='ignorecase', action='store_true', help='Case-insensitive search')])
922 def do_grep(self, arg, opts): 926 def do_grep(self, arg, opts):
923 """grep PATTERN TABLE - search for term in any of TABLE's fields""" 927 """grep PATTERN TABLE - search for term in any of TABLE's fields"""
924 928