diff sqlpython.py @ 123:898ed97bec38

fixed bug in setting parameters
author catherine@Elli.myhome.westell.com
date Wed, 30 Jul 2008 11:06:10 -0400
parents e11bbeb3f34c
children 2b42b7bc29cb
line wrap: on
line diff
--- a/sqlpython.py	Wed Jul 30 10:35:16 2008 -0400
+++ b/sqlpython.py	Wed Jul 30 11:06:10 2008 -0400
@@ -25,6 +25,7 @@
         self.failoverSessions = []
         self.terminator = ';'
         self.timeout = 30
+        self.commit_on_exit = True
         
     connection_modes = {re.compile(' AS SYSDBA', re.IGNORECASE): cx_Oracle.SYSDBA, 
                         re.compile(' AS SYSOPER', re.IGNORECASE): cx_Oracle.SYSOPER}
@@ -141,9 +142,12 @@
         self.default('commit %s;' % (arg), do_everywhere=True)
     def do_rollback(self, arg):
         self.default('rollback %s;' % (arg), do_everywhere=True)        
-        
-    # shortcuts
-    do_exit = cmd2.Cmd.do_quit
+    def do_quit(self, arg):
+        if self.commit_on_exit:
+            self.default('commit;')
+        cmd2.Cmd.do_quit()
+    do_exit = do_quit
+    do_q = do_quit
     
 def pmatrix(rows,desc,maxlen=30):
     '''prints a matrix, used by sqlpython to print queries' result sets'''