changeset 292:d727f209acf9

py really working right now
author catherine@dellzilla
date Tue, 24 Mar 2009 13:59:11 -0400
parents 2103616cffcd
children 569cba4da162
files sqlpython/mysqlpy.py sqlpython/sqlpyPlus.py
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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 <command>: 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):
         """