Mercurial > sqlpython
comparison sqlpyPlus.py @ 73:bce8396ab625
more condensation
author | catherine@cordelia |
---|---|
date | Mon, 14 Apr 2008 16:02:49 -0400 |
parents | db0e1ff5e407 |
children | bfc81b9b99a7 |
comparison
equal
deleted
inserted
replaced
72:db0e1ff5e407 | 73:bce8396ab625 |
---|---|
730 except: | 730 except: |
731 pass | 731 pass |
732 arg = ' '.join(args) | 732 arg = ' '.join(args) |
733 self.do_select('* from %s;%d' % (arg, nrows)) | 733 self.do_select('* from %s;%d' % (arg, nrows)) |
734 | 734 |
735 def printall(self): | |
736 for (var, val) in self.binds.items(): | |
737 print ':%s = %s' % (var, val) | |
738 | |
739 def do_print(self, arg): | 735 def do_print(self, arg): |
740 'print VARNAME: Show current value of bind variable VARNAME.' | 736 'print VARNAME: Show current value of bind variable VARNAME.' |
741 if arg: | 737 if arg: |
742 if arg[0] == ':': | 738 if arg[0] == ':': |
743 arg = arg[1:] | 739 arg = arg[1:] |
744 try: | 740 try: |
745 self.stdout.write(self.binds[arg]+'\n') | 741 self.stdout.write(self.binds[arg]+'\n') |
746 except KeyError: | 742 except KeyError: |
747 self.stdout.write('No bind variable %s\n' % arg) | 743 self.stdout.write('No bind variable %s\n' % arg) |
748 else: | 744 else: |
749 self.printall() | 745 for (var, val) in self.binds.items(): |
746 print ':%s = %s' % (var, val) | |
750 | 747 |
751 def do_setbind(self, arg): | 748 def do_setbind(self, arg): |
752 args = arg.split(None, 2) | 749 args = arg.split(None, 2) |
753 if len(args) < 2: | 750 if len(args) < 2: |
754 self.do_print(arg) | 751 self.do_print(arg) |