# HG changeset patch # User catherine@Elli.myhome.westell.com # Date 1236907791 14400 # Node ID 39ecc4b65b11fe42e58c45e33858a3b3c1bc91ff # Parent b61e21386383ce227d786046d9cdf9cdabad479b smart prompt now works with db connect diff -r b61e21386383 -r 39ecc4b65b11 sqlpython/mysqlpy.py --- a/sqlpython/mysqlpy.py Thu Mar 12 21:10:55 2009 -0400 +++ b/sqlpython/mysqlpy.py Thu Mar 12 21:29:51 2009 -0400 @@ -120,8 +120,14 @@ def do_db(self,args,filepath='pass.txt'): '''Exec do_connect to db_alias in args (credentials form the file pass.txt) ''' - f = open(filepath,'r') - connectstr = f.readline().strip() +'@'+args + try: + f = open(filepath,'r') + except IOError: + print 'Need a file %s containing username/password' % filepath + raise + connectstr = f.readline().strip() + if args: + connectstr += '@'+args self.do_connect(connectstr) f.close() diff -r b61e21386383 -r 39ecc4b65b11 sqlpython/sqlpython.py --- a/sqlpython/sqlpython.py Thu Mar 12 21:10:55 2009 -0400 +++ b/sqlpython/sqlpython.py Thu Mar 12 21:29:51 2009 -0400 @@ -28,6 +28,7 @@ def do_connect(self, arg): '''Opens the DB connection''' modeval = 0 + oraserv = None for modere, modevalue in self.connection_modes.items(): if modere.search(arg): arg = modere.sub('', arg)