Mercurial > sqlpython
comparison sqlpython/sqlpython.py @ 198:b2d8bf5f89db
merged with changes from work
author | catherine@Elli.myhome.westell.com |
---|---|
date | Tue, 02 Dec 2008 11:00:21 -0500 |
parents | 3af1615e6ea8 |
children | 3ca2271847e2 |
comparison
equal
deleted
inserted
replaced
197:3af1615e6ea8 | 198:b2d8bf5f89db |
---|---|
92 print self.do_terminators.__doc__ | 92 print self.do_terminators.__doc__ |
93 | 93 |
94 terminatorSearchString = '|'.join('\\' + d.split()[0] for d in do_terminators.__doc__.splitlines()) | 94 terminatorSearchString = '|'.join('\\' + d.split()[0] for d in do_terminators.__doc__.splitlines()) |
95 | 95 |
96 def default(self, arg): | 96 def default(self, arg): |
97 stmt = '%s %s' % (arg.parsed.command, arg.parsed.args) | 97 self.varsUsed = sqlpyPlus.findBinds(arg, self.binds, givenBindVars={}) |
98 self.varsUsed = sqlpyPlus.findBinds(stmt, self.binds, givenBindVars={}) | 98 self.curs.execute('%s %s' % (arg.parsed.command, arg.parsed.args), self.varsUsed) |
99 self.curs.execute(stmt, self.varsUsed) | |
100 print '\nExecuted%s\n' % ((self.curs.rowcount > 0) and ' (%d rows)' % self.curs.rowcount or '') | 99 print '\nExecuted%s\n' % ((self.curs.rowcount > 0) and ' (%d rows)' % self.curs.rowcount or '') |
101 | 100 |
102 ''' | 101 def do_commit(self, arg=''): |
103 def do_commit(self, arg): | 102 self.default(self.parsed('commit %s;' % (arg))) |
104 self.default('commit %s' % (arg)) | 103 def do_rollback(self, arg=''): |
105 def do_rollback(self, arg): | 104 self.default(self.parsed('rollback %s;' % (arg))) |
106 self.default('rollback %s;' % (arg)) ''' | |
107 def do_quit(self, arg): | 105 def do_quit(self, arg): |
108 if self.commit_on_exit and hasattr(self, 'curs'): | 106 if self.commit_on_exit and hasattr(self, 'curs'): |
109 self.default(self.parsed('commit')) | 107 self.default(self.parsed('commit')) |
110 return cmd2.Cmd.do_quit(self, None) | 108 return cmd2.Cmd.do_quit(self, None) |
111 do_exit = do_quit | 109 do_exit = do_quit |