# HG changeset patch # User devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil # Date 1200688665 18000 # Node ID 33c9bc61db660b175d1f4383eacd391fdecac7a5 # Parent 1fb9f7dee7d818860abeedeae259f960030b289e separation surgery successful? diff -r 1fb9f7dee7d8 -r 33c9bc61db66 sqlpyPlus.py --- a/sqlpyPlus.py Fri Jan 18 15:07:10 2008 -0500 +++ b/sqlpyPlus.py Fri Jan 18 15:37:45 2008 -0500 @@ -364,46 +364,13 @@ 'command' and 'args' may be None if the line couldn't be parsed. Overrides cmd.cmd.parseline to accept variety of shortcuts..""" - cmd, arg. line = sqlpython.parseline(self, line) + cmd, arg, line = sqlpython.sqlpython.parseline(self, line) if cmd in ('select', 'sleect', 'insert', 'update', 'delete', 'describe', 'desc', 'comments', 'pull', 'refs', 'desc', 'triggers', 'find') \ and not hasattr(self, 'curs'): print 'Not connected.' return '', '', '' return cmd, arg, line - - def precmd(self, line): - """Hook method executed just before the command line is - interpreted, but after the input prompt is generated and issued. - Makes commands case-insensitive (but unfortunately does not alter command completion). - """ - - ''' - pipedCommands = pipeSeparator.separate(line) - if len(pipedCommands) > 1: - pipefilename = 'sqlpython.pipe.tmp' - for (idx, pipedCommand) in enumerate(pipedCommands[:-1]): - savestdout = sys.stdout - f = open(pipefilename,'w') - sys.stdout = f - self.precmd(pipedCommand) - self.onecmd(pipedCommand) - self.postcmd(False, pipedCommands[0]) - f.close() - sys.stdout = savestdout - f = os.popen('%s < %s' % (pipedCommands[idx+1], pipefilename)) - f.read() - - ''' - try: - args = line.split(None,1) - args[0] = args[0].lower() - statement = ' '.join(args) - if args[0] in self.multiline: - statement = sqlpython.finishStatement(statement) - return statement - except Exception: - return line def onecmd_plus_hooks(self, line): line = self.precmd(line) @@ -508,7 +475,7 @@ result = sqlpython.pmatrix(self.rows, self.curs.description, self.maxfetch) return result - def findTerminator(statement): + def findTerminator(self, statement): m = self.statementEndPattern.search(statement) if m: return m.groups() diff -r 1fb9f7dee7d8 -r 33c9bc61db66 sqlpython.py --- a/sqlpython.py Fri Jan 18 15:07:10 2008 -0500 +++ b/sqlpython.py Fri Jan 18 15:37:45 2008 -0500 @@ -120,7 +120,7 @@ do_q = do_quit do_exit = do_quit - stmtEndSearchString = r'(.*)(%s)\s*(\d+)?\s*$' % sqlpython.terminatorSearchString + stmtEndSearchString = r'(.*)(%s)\s*(\d+)?\s*$' % terminatorSearchString statementEndPattern = re.compile(stmtEndSearchString, re.MULTILINE | re.DOTALL) def pmatrix(rows,desc,maxlen=30):