Mercurial > sqlpython
changeset 255:39ecc4b65b11
smart prompt now works with db connect
author | catherine@Elli.myhome.westell.com |
---|---|
date | Thu, 12 Mar 2009 21:29:51 -0400 |
parents | b61e21386383 |
children | d09f16b71f66 |
files | sqlpython/mysqlpy.py sqlpython/sqlpython.py |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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()
--- 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)