Mercurial > sqlpython
comparison sqlpyPlus.py @ 75:2060f9e4b27b
outstanding changes?
author | catherine@cordelia |
---|---|
date | Mon, 21 Apr 2008 09:25:47 -0400 |
parents | bfc81b9b99a7 |
children | 9427aa0726fa |
comparison
equal
deleted
inserted
replaced
74:bfc81b9b99a7 | 75:2060f9e4b27b |
---|---|
742 except KeyError: | 742 except KeyError: |
743 self.stdout.write('No bind variable %s\n' % arg) | 743 self.stdout.write('No bind variable %s\n' % arg) |
744 else: | 744 else: |
745 for (var, val) in self.binds.items(): | 745 for (var, val) in self.binds.items(): |
746 print ':%s = %s' % (var, val) | 746 print ':%s = %s' % (var, val) |
747 | |
748 # keep bind vars in sync on both sides? | |
749 | |
750 def push_binds(self): | |
751 commands = [":%s := '%s'" for b in self.binds.items()] | |
752 curs.execute('begin\n%s\nend;' % '\n'.join(commands)) | |
753 def pull_binds(self): | |
754 i DON'T THINK THIS WILL WORK! | |
755 | |
756 | 747 |
757 def do_setbind(self, arg): | 748 def do_setbind(self, arg): |
758 args = arg.split(None, 2) | 749 args = arg.split(None, 2) |
759 if len(args) < 2: | 750 if len(args) < 2: |
760 self.do_print(arg) | 751 self.do_print(arg) |
768 try: | 759 try: |
769 val = float(val) | 760 val = float(val) |
770 except ValueError: | 761 except ValueError: |
771 val = self.curs.callfunc(val, []) | 762 val = self.curs.callfunc(val, []) |
772 # submit to sql | 763 # submit to sql |
764 | |
773 self.binds[var] = val # but what if val is a function call? | 765 self.binds[var] = val # but what if val is a function call? |
774 else: | 766 else: |
775 print 'Could not parse ', args | 767 print 'Could not parse ', args |
776 | 768 |
777 def do_exec(self, arg): | 769 def do_exec(self, arg): |