comparison sqlpyPlus.py @ 60:4f80329a1905

loading fix
author catherine.devlin@gmail.com
date Fri, 04 Apr 2008 13:40:35 -0400
parents de6278a3bf53
children 047f82acdc8f
comparison
equal deleted inserted replaced
59:3828db4f3c94 60:4f80329a1905
185 and c1.owner = :owner 185 and c1.owner = :owner
186 """ 186 """
187 } 187 }
188 188
189 import sys, os, re, sqlpython, cx_Oracle, pyparsing 189 import sys, os, re, sqlpython, cx_Oracle, pyparsing
190 from cmd2 import flagReader 190 from cmd2 import flagReader, Cmd
191 191
192 if float(sys.version[:3]) < 2.3: 192 if float(sys.version[:3]) < 2.3:
193 def enumerate(lst): 193 def enumerate(lst):
194 return zip(range(len(lst)), lst) 194 return zip(range(len(lst)), lst)
195 195
663 diffMergeSearcher.invoke(fnames[0], fnames[1]) 663 diffMergeSearcher.invoke(fnames[0], fnames[1])
664 664
665 bufferPosPattern = re.compile('\d+') 665 bufferPosPattern = re.compile('\d+')
666 rangeIndicators = ('-',':') 666 rangeIndicators = ('-',':')
667 667
668 def do_get(self, fname):
669 'Brings SQL commands from a file to the in-memory SQL buffer.'
670 numCommandsLoaded = self.load(fname)
671 if numCommandsLoaded:
672 self.do_list('%d -' % (len(self.history) - numCommandsLoaded))
673 def do_getrun(self, fname): 668 def do_getrun(self, fname):
674 'Brings SQL commands from a file to the in-memory SQL buffer, and executes them.' 669 'Brings SQL commands from a file to the in-memory SQL buffer, and executes them.'
675 numCommandsLoaded = self.do_load(fname) * -1 670 Cmd.do_load(self, fname)
676 if numCommandsLoaded:
677 for command in self.history[numCommandsLoaded:]:
678 self.onecmd_plus_hooks(command)
679 def do_psql(self, arg): 671 def do_psql(self, arg):
680 '''Shortcut commands emulating psql's backslash commands. 672 '''Shortcut commands emulating psql's backslash commands.
681 673
682 \c connect 674 \c connect
683 \d desc 675 \d desc