changeset 60:4f80329a1905

loading fix
author catherine.devlin@gmail.com
date Fri, 04 Apr 2008 13:40:35 -0400
parents 3828db4f3c94
children 047f82acdc8f
files mysqlpy.py sqlpyPlus.py
diffstat 2 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mysqlpy.py	Wed Apr 02 22:47:06 2008 -0400
+++ b/mysqlpy.py	Fri Apr 04 13:40:35 2008 -0400
@@ -9,7 +9,7 @@
 #           http://catherine.devlin.googlepages.com/
 
 from sqlpyPlus import *
-import binascii
+import binascii, sys
 
 class mysqlpy(sqlpyPlus):
     '''
@@ -152,6 +152,10 @@
 def run():
     my=mysqlpy()
     print my.__doc__
+    try:
+        my.do_connect(sys.argv[1])
+    except IndexError:
+        pass
     my.cmdloop()
 
 if __name__ == '__main__':
--- a/sqlpyPlus.py	Wed Apr 02 22:47:06 2008 -0400
+++ b/sqlpyPlus.py	Fri Apr 04 13:40:35 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.