# HG changeset patch # User catherine@dellzilla # Date 1237917551 14400 # Node ID d727f209acf964e9530a9f88d3d1fcdb621c1086 # Parent 2103616cffcddd829bd01524527413dabb6e9eae py really working right now diff -r 2103616cffcd -r d727f209acf9 sqlpython/mysqlpy.py --- a/sqlpython/mysqlpy.py Mon Mar 23 12:07:18 2009 -0400 +++ b/sqlpython/mysqlpy.py Tue Mar 24 13:59:11 2009 -0400 @@ -195,7 +195,7 @@ pass my.do_connect(connectstring) for arg in sys.argv[1:]: - if my.onecmd(arg) == my._STOP_AND_EXIT: + if my.onecmd(arg + '\n') == my._STOP_AND_EXIT: return except IndexError: pass diff -r 2103616cffcd -r d727f209acf9 sqlpython/sqlpyPlus.py --- a/sqlpython/sqlpyPlus.py Mon Mar 23 12:07:18 2009 -0400 +++ b/sqlpython/sqlpyPlus.py Tue Mar 24 13:59:11 2009 -0400 @@ -435,6 +435,7 @@ self.wildsql = False self.serveroutput = True self.scan = True + self.nonpythoncommand = 'sql' self.substvars = {} self.result_history = [] self.store_results = True @@ -500,17 +501,16 @@ next = self.pseudo_raw_input(self.continuation_prompt) return self.onecmd('\n'.join(statement)) - def do_py(self, arg): + def do_py(self, arg): ''' py : Executes a Python command. - py: Enters interactive Python mode (end with `\py`). - Past SELECT results are stored in list `r`; + py: Enters interactive Python mode; end with `Ctrl-D`, `quit()`, or 'exit`. + Past SELECT results are exposed as list `r`; most recent resultset is `r[-1]`. - SQL bind variables can be accessed/changed via `binds`; - substitution variables via `substs`. - Single SQL commands can be issued by beginning commands with `sql`. + SQL bind, substitution variables are exposed as `binds`, `substs`. + SQL and sqlpython commands can be issued with sql('your non-python command here'). ''' - return Cmd.do_py(self, arg, escape='sql') + return Cmd.do_py(self, arg) def do_get(self, args): """