# HG changeset patch # User catherine@cordelia # Date 1207576278 14400 # Node ID 047f82acdc8ff13042b6d031bab297228db5b9cf # Parent 1a52de2c541e110d6bd1d4d98b6eaaee969873a8# Parent 4f80329a1905efe0899810e6804f10637eaa4d71 merging in bugfixes & pgsql additions diff -r 1a52de2c541e -r 047f82acdc8f mysqlpy.py --- a/mysqlpy.py Mon Apr 07 09:37:55 2008 -0400 +++ b/mysqlpy.py Mon Apr 07 09:51:18 2008 -0400 @@ -9,7 +9,7 @@ # http://catherine.devlin.googlepages.com/ from sqlpyPlus import * -import binascii +import binascii, sys class mysqlpy(sqlpyPlus): ''' @@ -156,6 +156,10 @@ def run(): my=mysqlpy() print my.__doc__ + try: + my.do_connect(sys.argv[1]) + except IndexError: + pass my.cmdloop() if __name__ == '__main__': diff -r 1a52de2c541e -r 047f82acdc8f sqlpyPlus.py --- a/sqlpyPlus.py Mon Apr 07 09:37:55 2008 -0400 +++ b/sqlpyPlus.py Mon Apr 07 09:51:18 2008 -0400 @@ -187,7 +187,7 @@ } import sys, os, re, sqlpython, cx_Oracle, pyparsing -from cmd2 import flagReader +from cmd2 import flagReader, Cmd if float(sys.version[:3]) < 2.3: def enumerate(lst): @@ -665,17 +665,9 @@ bufferPosPattern = re.compile('\d+') rangeIndicators = ('-',':') - def do_get(self, fname): - 'Brings SQL commands from a file to the in-memory SQL buffer.' - numCommandsLoaded = self.load(fname) - if numCommandsLoaded: - self.do_list('%d -' % (len(self.history) - numCommandsLoaded)) def do_getrun(self, fname): 'Brings SQL commands from a file to the in-memory SQL buffer, and executes them.' - numCommandsLoaded = self.do_load(fname) * -1 - if numCommandsLoaded: - for command in self.history[numCommandsLoaded:]: - self.onecmd_plus_hooks(command) + Cmd.do_load(self, fname) def do_psql(self, arg): '''Shortcut commands emulating psql's backslash commands. @@ -742,7 +734,7 @@ def do_print(self, arg): 'print VARNAME: Show current value of bind variable VARNAME.' - if arg: + if arg: if arg[0] == ':': arg = arg[1:] try: